ADAPTIVE CHECK CHANGE_SVC_CHECK_COMMAND

Jochen Bern Jochen.Bern at LINworks.de
Mon Jan 14 14:50:49 CET 2013


On 14.01.2013 13:20, Javier Garces Asensio wrote:
> I wanted to use a check with warning and critical values specific
> in hours of production and other values outside production hours

That yells "wrapper script" to me.

The attached one lacks proper documentation, syntax help etc., so here's
a bunch of examples (essentially the same call, but with three different
sets of limits applied due to the advancing time, and three different
service states returned because of that):


> # date ; /usr/local/nagios/libexec/check_varlimits --varlimits-debug \
> > check_http @144020=0.01+0.3 at 144030=0.01+0.03 at 144040=0.5+0.7 -H www.google.de
> Mo 14. Jan 14:40:29 CET 2013
> Current time: 144029
> Parsing spec: @144020=0.01+0.3 at 144030=0.01+0.03 at 144040=0.5+0.7
>    Remaining spec: @144020=0.01+0.3 at 144030=0.01+0.03 at 144040=0.5+0.7
>       Inspecting frame: 144020=0.01+0.3
>          Frame starts at 144020, warn='0.01', crit='0.3'
>          Frame applies, limits set to '--warning 0.01 --critical 0.3'
>    Remaining spec: @144030=0.01+0.03 at 144040=0.5+0.7
>       Inspecting frame: 144030=0.01+0.03
>          Frame starts at 144030, warn='0.01', crit='0.03'
>          Frame hasn't started yet.
>    Remaining spec: @144040=0.5+0.7
>       Inspecting frame: 144040=0.5+0.7
>          Frame starts at 144040, warn='0.5', crit='0.7'
>          Frame hasn't started yet.
> Applied limits: '--warning 0.01 --critical 0.3'
> HTTP WARNING: HTTP/1.1 200 OK - 11359 bytes in 0.079 second response time |time=0.078892s;0.010000;0.300000;0.000000 size=11359B;;;0


> # date ; /usr/local/nagios/libexec/check_varlimits check_http \
> > @144020=0.01+0.3 at 144030=0.01+0.03 at 144040=0.5+0.7 -H www.google.de
> Mo 14. Jan 14:40:37 CET 2013
> HTTP CRITICAL: HTTP/1.1 200 OK - 11371 bytes in 0.074 second response time |time=0.074063s;0.010000;0.030000;0.000000 size=11371B;;;0


> # date ; /usr/local/nagios/libexec/check_varlimits check_http \
> > @144020=0.01+0.3 at 144030=0.01+0.03 at 144040=0.5+0.7 -H www.google.de
> Mo 14. Jan 14:40:44 CET 2013
> HTTP OK: HTTP/1.1 200 OK - 11379 bytes in 0.074 second response time |time=0.073810s;0.500000;0.700000;0.000000 size=11379B;;;0


Of course, if your production hours are fixed long-term (except for
moving holidays?), you can simplify things by hardcoding the timeframes
into the wrapper, instead of trying to parse a spec on the fly.

Regards,
								J. Bern
-- 
*NEU* - NEC IT-Infrastruktur-Produkte im <http://www.linworks-shop.de/>:
Server--Storage--Virtualisierung--Management SW--Passion for Performance
Jochen Bern, Systemingenieur --- LINworks GmbH <http://www.LINworks.de/>
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: check_varlimits
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20130114/c2c96af7/attachment.ksh>
-------------- next part --------------
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list