Using passive checks
Nagios offers a very powerful mechanism for scheduling tests. However, there are many situations where you might want to perform tests on your own and just tell Nagios what the result is. One of the typical scenarios for using passive tests can be when performing the actual test takes very little time but the startup overhead is large. Refer to Chapter 9, Passive Checks and NRDP for details.
The next code print contains an example of an application that periodically performs tests and sends their results to Nagios over the external command pipe. This code consists of a method to supply information to Nagios, and a main loop that performs tests every five minutes. It does not contain the actual test that should be performed as this might vary depending on your needs:
var fs = require('fs'); var os = require('os'); var Nagios = function () { var pipeFileName = '/var/nagios/rw/nagios.cmd'; var writeCommand = function (command, callback)...