Instantly add Event Enrichment to Nagios using the nagios-api:add_comment method

nagios api 300x145 Instantly add Event Enrichment to Nagios using the nagios api:add comment method

With the nagios-api daemon running, enriching events is much easier. This article explores enrichment via the nagios-api : add_comment method.

NOTE: This method adds event enrichments as persistent comments in the host and service entries. It does not, however, seem to lend itself to forwarding these enrichments as notifications.

Test comment insertion using the nagios-api

curl -X POST -H "Content-Type: application/json" -d '{"host":"web01
", "comment":"test", "persistent":"1"}' http://localhost:8080/
add_comment

RESPONSE: {“content”: “submitted”, “success”: true}

Update to the web01 host entry with an enrichment

curl -X POST -H "Content-Type: application/json" -d '{"host":"web01", "comment":"ESCALATION:--insert-para--This server is a member of the apache cluster which supports the ACME Corp online presence. Escalate this issue to the on-call Systems Engineering team NOW.--insert-para--REMEDIATION:--insert--para--Immediately initiate the steps listed inthe WEBSRVR_DOWN recipe in the Ops Runbook.", "persistent":"1", "author":"Leonard Cohen","host":"web01"}' http://localhost:8080/add_comment

RESPONSE: {“content”: “submitted”, “success”: true}

nagios api example Instantly add Event Enrichment to Nagios using the nagios api:add comment method

Success

Congratulations! You now know how to update Nagios nodes with enrichments, using the persistent comments mechanism. These enrichments will not be forwarded to an escalation platform such as PagerDuty.

An alternate method which does provide end-to-end (NMS to Escalation service) Event Enrichment for Nagios, is located here.

Check out the Beginner’s Guide for an in-depth introduction to the Event Enrichment methodology.

Questions? Leave a comment.

What's your opinion?