I understand how Nagios works in that it periodically polls the status of the system. It can for example check for existence of some files or availability of some web page each minute.

But what about when I want to create alerts straight from my application code? Say user tries to perform some illegal operation and I want to receive an alert from that.

I could for example log this event into a file and configure Nagios to periodically poll this file. This just seems an indirect way of doing this. Why go through writing, polling, and parsing a file in filesystem if I could just call some interface (REST,SOAP) with the alert details?

Is there something available which lets my application call Nagios directly (or would this be a bad design for some reason)?


What you are looking for is NAGIOS' concept of passive services, coupled with the use of NSCA for status injections.

The service is passive - that is, NAGIOS will never poll it at all. You run the NSCA daemon on the NAGIOS server, and inject status information from the client by having your application call send_nsca. When NAGIOS gets this status information, it will alert according to the service definitions.

If you are setting up such a service it is a good idea to enable freshness checking for it, to trigger at about twice the maximum delay you ever expect between successive status injections, and have the freshness checker go straight to CRITICAL when invoked. This will mean that if ever status injection breaks down, NAGIOS will let you know that updates have stopped arriving.


You can achieve your hypothetical example with a combination of passive checks and volatile services.

Also, as MadHatter said, no discussion of volatile services would be complete without freshness checking.

If you insist on using a web-based API, there may be something workable in the API category of Nagios Exchange.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.