15.0 Notification APIs

WAS THIS PAGE HELPFUL? Leave Feedback

15.0 Notification APIs

15.1 Create Host Notifications

Send a batch (1..n) of host NOMA notifications to GroundWork server.

If one or more notification messages fails, others may still succeed. This is not an all-or-none transactional operation. The results of each individual notification message is returned back in the resultset described below with a status of success or failure.

15.1.1 Method: POST

POST /api/notifications/hosts

15.1.2 HTTP Headers
Header Valid Values Required
Content-Type application/xml or application/json True
GWOS-API-TOKEN a valid token returned from login True
GWOS-APP-NAME your application name True
15.1.3 Post Data Attributes and Elements
Field Description Required
hostState A valid Host Monitor Status such as UP, UNREACHABLE, WARNING, PENDING, UNSCHEDULED DOWN, SCHEDULED DOWN, DOWN Yes
hostName the name of the host Yes
hostGroupNames a comma-separated list of one or more valid host group names No
notificationType A valid Notification type such as RECOVERY or PROBLEM Yes
hostAddress the IP address of the host No
hostOutput the textual output to be sent to the notification server Yes
checkDateTime a time stamp in YYYY-MM-DD hh:mm:ss format No
hostNotificationId   No
notificationAuthOrAlias   No
notificationComment Additional comments No
notificationRecipients   No
15.1.4 XML POST Data Example
<notifications>
   <notification
   	      hostName='server-12'
   	      hostAddress='10.0.0.11'
   	      hostGroupNames='group-21,group-22'
   	      hostNotificationId=''
   	      hostOutput='Hypervisor cannot be reached to determine the status'
   	      hostState='PENDING'
   	      notificationComment='Cloud Hub Host Notification'
   	      notificationRecipients=''
   	      notificationType='RECOVERY'
   	      checkDateTime='2014-04-14 07:21:'
   	      notificationAuthOrAlias=''
   />
</notifications>

See Appendix A for examples of usage with Curl
More Post Data Examples: XML - JSON

15.1.5 HTTP Status Codes

200 - Zero or more notifications were created without any internal server errors
500 - An internal server error occurred

15.1.6 Example Response

In this example, we use the POST data above. Two host notifications were successfully created.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<results successful="2" failed="0" entityType="HostNotification"
       operation="Update" warning="0" count="2">
  <result>
    <entity>server-12</entity>
    <message></message>
    <status>success</status>
  </result>
  <result>
    <entity>server-13</entity>
    <message></message>
    <status>success</status>
  </result>
</results>
15.2 Create Service Notifications

Send a batch (1..n) of service NOMA notifications to GroundWork server.

If one or more notification messages fails, others may still succeed. This is not an all-or-none transactional operation. The results of each individual notification message is returned back in the resultset described below with a status of success or failure.

15.2.1 Method: POST

POST /api/notifications/services

15.2.2 HTTP Headers
Header Valid Values Required
Content-Type application/xml or application/json True
GWOS-API-TOKEN a valid token returned from login True
GWOS-APP-NAME your application name True
15.2.3 Post Data Attributes and Elements
Field Description Required
serviceState A valid Service Status such as WARNING, OK, UNKNOWN, UNSCHEDULED CRITICAL, PENDING_SERVICE, SCHEDULED CRITICAL Yes
hostName The name of the host Yes
hostGroupNames a comma-separated list of one or more valid Host Group names No
serviceGroupNames a comma-separated list of one or more valid Service Group names No
serviceDescription the name (description) of the service Yes
serviceOutput the textual output to be sent to the notification server Yes
notificationType A valid Notification type such as RECOVERY or PROBLEM Yes
hostAlias   No
hostAddress the IP address of the host No
checkDateTime a time stamp in YYYY-MM-DD hh:mm:ss format No
serviceNotificationId   No
notificationAuthOrAlias   No
notificationComment Additional comments No
notificationRecipients   No
15.2.4 XML POST Data Example
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<notifications>
    <notification
              hostName='server-12'
              serviceDescription='local_cpu_nagios'
              hostAddress='10.0.0.11'
              hostGroupNames='group-21,group-22'
              hostAlias='host1'
              serviceGroupNames='sg1,sg2'
              serviceOutput='Service cannot be reached to determine the status'
              serviceState='UNKNOWN'
              serviceNotificationId='433'
              notificationComment='Cloud Hub Host Notification'
              notificationRecipients='admin@gwos.com'
              notificationType='RECOVERY'
              checkDateTime='2014-04-14 07:21:33'
              notificationAuthOrAlias='alias'
     />
 /notifications>

See Appendix A for examples of usage with Curl
More Post Data Examples: XML - JSON

15.2.5 HTTP Status Codes

200 - Zero or more notifications were created without any internal server errors
500 - An internal server error occurred

15.2.6 Example Response

In this example, we use the POST data above. Two service notifications were successfully created.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<results successful="2" failed="0" entityType="ServiceNotification"
       operation="Update" warning="0" count="2">
  <result>
    <entity>server-12:local_cpu_nagios</entity>
    <message></message>
    <status>success</status>
  </result>
  <result>
    <entity>service-13:vm.cpu_util</entity>
    <message></message>
    <status>success</status>
  </result>
</results>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.