Admin Outages API
If you have a maintenance window or a scheduled outage for a device then you will likely want to suspend alerting for that device during that period.
NMIS has supported this for a long time, please refer to the NMIS Outages documentation for further information.
Now, it is also possible to manage Outages within the Administration console or API.
Released in opCharts 4.3.5
Summary
Operation | Method | API |
---|---|---|
Get a list of Outages | GET | http://server/en/omk/admin/api/v2/outages |
Get an Outage | GET | http://server/en/omk/admin/api/v2/outages/:id |
Create an Outage | POST | http://server/en/omk/admin/api/v2/outages |
Update an Outage | PUT | http://server/en/omk/admin/api/v2/outages |
Delete an Outage | DELETE | http://server/en/omk/admin/api/v2/outages/:id |
Note: At the moment, this only works for local nodes.
Authentication
All these methods require authentication.
POST http://server/en/omk/admin/login
Form data:
- username
- password
Methods
Get Outages
GET http://server/en/omk/admin/api/v2/outages
Returns a list of outages.
Response:
[ { "change_id": "1234", "current": null, "description": "my_test_outage", "end": 1678627263, "frequency": "once", "id": "a059db21-d7c8-4fc8-9e95-ad47b5ba3dae", "nodes": [ "asgard", "apc-ups" ], "options": {}, "start": 1678454463 }, { "change_id": "1234", "current": null, "description": "my_test_outage", "end": 1678627263, "frequency": "once", "id": "a9dac944-ef21-4019-a24d-d993926922a1", "nodes": [ "asgard", "apc-ups" ], "options": {}, "start": 1678454463 } ]
Get Outage
GET http://server/en/omk/admin/api/v2/outages/#ID
Ex. http://server/en/omk/admin/api/v2/outages/f14d4f34-2fd0-4be0-9d54-7431c5de294f
Returns an outage.
Response:
{ "change_id": "1234", "current": null, "description": "my_test_outage", "end": 1678627263, "frequency": "once", "id": "e5ad10c2-5869-4b03-ae6a-c4d86a174688", "nodes": [ "asgard", "apc-ups" ], "options": {}, "start": 1678454463 }
Create Outage
POST http://server/en/omk/admin/api/v2/outages
Returns 200 if the outage was successfully created.
Payload example:
{ "change_id": "ticket #1234", "description": "Emergency outage", "end": "11-Mar-2022 23:21:03", "nodes": ["Asgard","apc-ups"], "start": "10-Mar-2022 23:21:03" }
Returns:
{ "id": "9ede91fc-45c3-4538-8bbd-35ddc893a51f", "success": 1 }
Update Outage
PUT http://server/en/omk/admin/api/v2/outages
Returns 200 if the outage was successfully updated.
Payload example:
{ "change_id": "ticket #1234", "description": "Firewall updates", "end": "11-Mar-2022 23:21:03", "nodes": ["Asgard","apc-ups"], "start": "10-Mar-2022 23:21:03", "id": "9ede91fc-45c3-4538-8bbd-35ddc893a51f" }
Returns:
{ "id": "9ede91fc-45c3-4538-8bbd-35ddc893a51f", "success": 1 }
Delete Outage
DELETE http://server/en/omk/admin/api/v2/outages/2a07c78a-65b6-49df-a052-a97d7a899c58
Returns 200 if the outage was successfully removed.