Hi Morne,
You can interact with the conductor's API in the same way as our own web ui does.
In short there three steps for each conductor you want to integrate:
- Login to the API in order to get a token
- Query GraphQL to get a list of (non shelved) alarms
- Filter the data as needed - the result data is in json format
The actual implementation of the calls depends on the programming language (Python, Javascript, Ruby, ...) of your customer's platform, however the calls should be pretty similar. In the snippets below I used "curl":
First - login:
$ curl -X POST 'https://<conductor-fqdn>/api/v1/login' \
-H 'accept: application/JSON' \
-H 'Content-Type: application/json' \
-d '{ "username": "api-user", "password": "secret"}'
The API key starts with eyJhbGciOiJSUzI1NiIs...
Second - GraphQL:
$ result=$(curl -s -X POST 'https://<conductor-fqdn>/api/v1/graphql' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIs...' \
-d '{ "query": "{ allAlarms(shelvedStatus: NOTSHELVED) { nodes {id node router time severity source category message shelvedStatus shelvedReason value process } } }"}')
Third - filtering (I just dump the data...)
There are two ways to filter - already at the query (just list the fields you are after) or post query by filtering the json result.
$ echo "$result" | python -m json.tool
{
"data": {
"allAlarms": {
"nodes": [
{
"category": "SYSTEM",
"id": "d4db8193-3fa3-45c0-b55e-d70a50995b37",
"message": "No connectivity to sample-node.sample-router",
"node": "sample-conductor",
"process": "stateMonitor",
"router": "sample-conductor",
"severity": "MAJOR",
"shelvedReason": "",
"shelvedStatus": "NOTSHELVED",
"source": "",
"time": "2020-06-18 00:00:00Z",
"value": null
}
]
}
}
}
Please keep in mind that this is a synchronous interface, so your customer's platform has to poll this API regularly (e.g. every 5 minutes).
------------------------------
Mathias Jeschke
Sales Engineer
Burlington MA
+1.781.203.8400
------------------------------
Original Message:
Sent: 06-15-2020 08:34
From: Morne Vermeulen
Subject: Alarms and monitoring
Hi All,
We have recently received a request from one of our customers to make the Alarms visible for polling to an external platform.
I would like to know what the relevant API calls are for getting the current alarms out of the conductor, as well as how the alarms are formatted so that we can work on how the data should be presented.
Are there any documents specifically aimed at this sort of thing? We were thinking about using the API function to get the information out of the conductor onto another dashboard, and then having a filter for relevant alarms. Is it easier to do this through events or alarms on the conductor?
Also - how do other customers do this sort of thing?
Regards,
------------------------------
Morne Vermeulen
Core Engineer
+27 (0) 10 141 8512
------------------------------