Heartbeat API (Deprecated)
Please refer to Heartbeat Monitoring for preliminary information.
Create an API Integration and obtain your apiKey to make requests listed below. Please make sure that the integration is not restricted to access configurations. Otherwise, the integration will only be authorized to send Send Heartbeat Requests.
Add Heartbeat Request
Add Heartbeat request is used to define heartbeats in OpsGenie. A heartbeat needs to be added, before sending heartbeat messages to OpsGenie. Add heartbeat takes the following parameters:
Mandatory Parameters
Parameter | Limit | |
---|---|---|
name | Name of the heartbeat | 200 chars |
apiKey | API key is used for authenticating API requests |
Optional Parameters
Parameter | Limit | |
---|---|---|
interval | Specifies how often a heartbeat message should be expected. | |
intervalUnit | interval specified as minutes, hours or days | |
description | An optional description of the heartbeat | 10000 chars |
enabled | Enable/disable heartbeat monitoring |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/heartbeat' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"name" : "nagios server",
"description": "nagios server sending heartbeats once a minute",
"interval": 5,
"intervalUnit": "minutes",
"enabled" : true
}'
Response:
{
"name" : "nagios server",
"status" : "successful",
"code" : 200
}
Update Heartbeat Request
Update Heartbeat is used to change configuration of existing heartbeats.
Mandatory Parameters
Parameter | |
---|---|
name | Name of the heartbeat |
apiKey | API key is used for authenticating API requests |
Optional Parameters
Parameter | Limit | |
---|---|---|
interval | Specifies how often a heartbeat message should be expected. | |
intervalUnit | interval specified as minutes, hours or days | |
description | An optional description of the heartbeat | 10000 chars |
enabled | Enable/disable heartbeat monitoring |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/heartbeat' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"name" : "nagios server",
"description": "nagios server sending heartbeat failed"
}'
Response:
{
"name" : "nagios server",
"status" : "successful",
"code" : 200
}
Send Heartbeat Request
Heartbeat request is used to send heartbeat from applications to OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
Optional Parameters
Parameter | |
---|---|
name | Name of the heartbeat. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/heartbeat/send' -d '
{
"apiKey": "eb243592-faa2-4ba2-a551q-1afdf565c889",
"name" : "host1"
}'
Response:
{
"heartbeat" : 1404816169107,
"willExpireAt" : 1404816769107,
"status" : "successful",
"code" : 200
}
Delete Heartbeat Request
Delete heartbeat request is used to delete monitored heartbeat in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
name | Name of the heartbeat. |
Sample Request
curl -XDELETE 'https://api.opsgenie.com/v1/json/heartbeat?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=host1'
Response:
{
"status" : "successful",
"code" : 200
}
Enable Heartbeat Request
Enable heartbeat request is used to enable monitored heartbeat in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
name | Name of the heartbeat. |
Sample Request
curl -XPOST 'https://api.opsgenie.com/v1/json/heartbeat/enable?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=host1'
Response:
{
"status" : "success",
"code" : 200
}
Disable Heartbeat Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
Get heartbeat request is used to retrieve details of heartbeat monitors in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
name | Name of the heartbeat. |
Sample Request
curl -XGET 'https://api.opsgenie.com/v1/json/heartbeat?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&name=host1'
Response:
{
"name" : "host1",
"status" : "Expired",
"description" : "sample heartbeat",
"enabled" : true,
"lastHeartbeat" : 1404816169107,
"interval" : 10,
"intervalUnit" : "hours",
"expired" : true
}
List Heartbeats Request
This is a read request. Therefore, even if the integration of the API key is configured as read-only, the request will be accepted.
List heartbeats request is used to list details of heartbeat monitors in OpsGenie. It takes the following parameters:
Mandatory Parameters
Parameter | |
---|---|
apiKey | API key is used for authenticating API requests |
Sample Requests
curl -XGET 'https://api.opsgenie.com/v1/json/heartbeat?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'
Response:
Timestamps are Unix Epoch as milliseconds
{
"heartbeats":[
{
"name" : "host1",
"status" : "Expired",
"description" : "sample heartbeat",
"enabled" : true,
"lastHeartbeat" : 1404816169107,
"interval" : 10,
"intervalUnit" : "hours",
"expired" : true
},
{
"name" : "db1",
"status" : "Active",
"description" : "",
"enabled" : false,
"lastHeartbeat" : 1404816169207,
"interval" : 20,
"intervalUnit" : "minutes",
"expired" : false
}
]
}
Updated about 5 years ago