I’m looking at a way to use nagios to capture the results of long running jobs, as these checks will take more then 20 mins to run I have written a plugin that will run the checks and pass the results back using the external command pipe to a service check that receives it’s data passively
So far I have the plugin all working and it passes the results back to nagios as I expect
However I need a way to call this plugin and this is where I have a problem
I could just kick it off using cron but we would like to schedule it in nagios so my idea was to create a little parent bash script that would:-
Call the long running plugin (the child script) and run it in the background
Then return with a message and a return value of 0
I’ve tried various different scripts and they all work when called via a command line (i.e. the child process is kicked off and the parent script returns immediately), however when run via nagios then the parent script goes into wait until the child plugin finishes or the nagios timeout is reached.
In a ps –ef I see
nagios 16057 16056 0 12:04 ? 00:00:00 [call-script]
So does anyone have a way to call a plugin and run it in the background via a nagios command?