Minimal check fime for custom plugin


#1

Hello,

I’ve write my own plug-in for Nagios. I need to run this plug-in every 3 seconds to determine that everything is ok. Is that possible? What is the shortest time between each plug-in run. Plug-in works in active check mode. I’ve been looking for the solution but i did not found anything

Please help.


#2

Hello,

I tried sometime ago, and I saw that even with low decimal values in normal_check_interval, nagios will run the service every 10 seconds; I don’t know if you can go lower than that.


#3

run the plugin via crontab with some customizations to force nagios to get that output could be a solution ?


#4

Yes, something like that;

what I would do:
modify your plugin so that it does a loop every 3sec
AND so that it outputs in a log file; like “MM/DD/YYYY hh:mm:ss - OK”

do a test in nagios that will read this log file and return an error whenever it encounters an error line “like KO” or anything.
Also, when nagios runs the test on the log file, make sure that it compares the last line with the current date; if the difference is bigger than - say 30sec - there’s a problem with your plugin…

well, hope this helps, even if you already have thought about all that :slight_smile:


#5

But this is not solution given by Nagios System? So i understand that I can’t monitor any plug-in output directly from Nagios system in less than 1 minute? If it’s not true please give me solution (which parameter should I change/set and where).

If it’s not possible should i use plug-in in a passive mode?


#6

as I said, put decimal values in normal_check_interval. for example, 0.1min means 6sec => nagios will then do the test every 10sec (as I said, that’s the minimal check time I found … maybe there are ways to lower this, but I doubt it)

As for the passive check, you may end up with a service flapping way too fast, that the results are useless …


#7

THX,
I’m testing passive check and it looks nice. But I have another question: do you know how to write multiple lines in nagios plug-in output? I’m using | and all i get is one line in “Performance Data”. I want to print out a little table. Is this possible or not?

Cheers!