passive service freshness with nagios restart

Ton Voon ton.voon at altinity.com
Thu Jun 21 17:51:10 CEST 2007


On 19 Jun 2007, at 23:11, Ton Voon wrote:

> Rather than another configuration parameter, can I propose this?
>
>    * If check_freshness_interval is defined, Nagios will use that
> value and only check against the last_check_time. No "funny" stuff is
> calculated
>    * If check_freshness_interval is not defined, then Nagios does a
> calculation on the best value - currently it does things like using
> check_interval, add latency time, lowers it if in a soft state. I'll
> rework my change so that it raises the time if startup time is more
> recent than last_check_time
>

I've made a patch for this now, which includes documentation updates  
and tests.

Yes, tests! I've managed to integrate libtap (which Nagios Plugins  
use for testing their C library functions) so now the freshness  
threshold value is tested. While setting up the infrastructure was  
hard, I've found the tests to be immensely helpful - I've refactored  
the logic and found other cases were not necessary. I even found a  
bug in my first attempt where the closing bracket for an if statement  
was in the wrong place.

What was really helpful was working from the abstract (code) to the  
specifics (tests) - I think I gained a better understanding of what  
the freshness threshold should be.

Unfortunately, I had to create a separate freshness.c file in base/  
because using one of the other files brought in too many un-resolved  
symbols. Having a separate file made it much cleaner.

I've blogged about it here: http://altinity.blogs.com/dotorg/2007/06/ 
tweaking-the-fr.html

Ethan, if you can incorporate this into core Nagios, I'll try and  
make sure that any new patches from Altinity will have accompanying  
test code.

(There's a limitation in that you may need to export LD_LIBRARY_PATH=/ 
usr/local/lib to get the libtap library recognised. Nagios Plugins  
get round this because we use libtool to link at compile time, but I  
thought that's too much to add to the core Nagios code at the moment.)

Ton

http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/




More information about the Developers mailing list