Foglight 5.9.3 introduces the following two Rest APIs to help you push alarms:

Push Alarm By Properties

API URL:  http://serverURL:port/api/v1/alarm/pushAlarmByProperies

Request Type: POST

Header:

  • Access-Token: The access-token from Login REST API
  • Content-Type: "application/xml" for XML format data; "application/json" for JSON format data

Description:

We can use this API to push an alarm according to the object property without the object ID. The following demonstrates how to push an alarm using this API in the XML format. 

<externalAlarmParamBean>
<alarmMessage>Test Alarm. This is a test alarm message from postman</alarmMessage>
<severity>2</severity>
<type>Host</type>
<properties>
<entry>
<key>name</key>
<value>localhost.localdomain</value>
</entry>
</properties>
</externalAlarmParamBean>

The sample above will push an alarm to an object which name is "localhost.localdomain" and type is "Host".

The following is the sample code in the JSON fomat. 

{"alarmMessage":"Test Alarm. This is a test alarm message from postman", "severity":"2", "type":"Host", "properties":{"name":"localhost.localdomain"}}

You can check the property value on the =data browser (Dashboards > Configuration > Data);

Note: Please ensure the properties you are using can identify one object only. If the Management Server finds multiple objects according to the properties value, the server will fail to push the alarm.

Push Alarm By Query

API URL:  http://serverURL:port/api/v1/alarm/pushAlarmByQuery

Request Type: Post

Header:

  • Access-Token: The access-token from Login REST API
  • Content-Type: "application/xml" for XML format data; "application/json" for JSON fomat data

Description:

We can use this API to push an alarm according to the object query without the object ID. The following demonstrates how to push an alarm using this API in the XML format.

<externalAlarmParamBean>
  <alarmMessage>Test Alarm. This is a test alarm message from postman</alarmMessage>
  <severity>3</severity>  
  <query>!Host:name="q1t19j92.prod.quest.corp"</query>
</externalAlarmParamBean>

The sample above will  push an alarm to an object which name is "dsg1t19j92.prod.quest.corp" and type is "Host".

The following is the sample code in the JSON fomat. 

{"alarmMessage":"This is a test alarm message from postman. asdfasdf", "severity":"2", "query":"!Host:name='dsg1t19j92.prod.quest.corp'"}

You can find the information about Foglight query language knowledge in the Foglight Help. On the Help tab, Search for "query" and locate the item "Using the Query Language", and then click "Query language tutorial".

Note: Please ensure the query you are using can identify one object only. If the Management Server finds multiple objects according to the query, the server will fail to push the alarm.

Anonymous
Related Content