Time based WARN/CRIT values

Karl DeBisschop karl at debisschop.net
Sun Sep 8 13:38:07 CEST 2002


On Fri, 2002-09-06 at 23:41, Subhendu Ghosh wrote:
> On 6 Sep 2002, Karl DeBisschop wrote:
> 
> > On Fri, 2002-09-06 at 12:07, Furnish, Trever G wrote:
> > > 
> > > > From: Subhendu Ghosh [mailto:sghosh at sghosh.org]
> > > > On Thu, 5 Sep 2002, Jeremy Tinley wrote:
> > > > 
> > > > > Is there a way to change parameters based on time of day without
> > > > > hardcoding it into the script.
> >
> > I'm trying to code a negation wrapper plugin right now, so every hammer
> > I see sort of looks like a plugin wrapper. But here goes...
> > 
> > There is really no reason why a plugin couldn't understand time. But
> > none of us have enough time as is. A single wrapper could be defined to
> > take lists of time periods and arguments. A little kludgey, but it
> > probably can be made to work.
> > 
> > Now it's time for people to call me crazy...
> 
> Crazy.
> 
> So what are the input - a timeperiod within which a real check is made, 
> otherwise returns an OK - with verbiage about no checks scheduled for 
> current timeperiod?

Input would be a list of timperiod/parameter pairs, follwed by all the
parameters that always be passed to the wrapped plugin:

schedule \
	--time 0000-0900,'-w 2 -c 3' \
	--time 0900-1700,'-w 1 -c 2' \
	--time 1700-2400,'-w 2 -c 3' \
	check_http -H www.infoplease.com -w /

It would be nice if it could have access to the timeperiod in the nagios
config files, but I would probably not even suggest trying that fr the
first implementation. Just the functionality implied above should be
fairly straightforward with either perl or C.

> Glad you mentioned the negation wrapper - I was fleshing out one as well
> in perl and trying to get handle around the "spaces in arguments" issue
> with perl at the same time.

I just pass everyting after the POSIX options directly on to the wrapped plugin:

	negate --timeout 9 check_http -w 2 -c 3 -H www.infoplease.com

The only parameter I saw as needed was the timeout (other the help and
version, of course). By specifying a timeout less than the default, you
can take a plugin that normally returns STATE_CRITCAL on timeout, and
have it continue to do so.

So for check_http, you can give CRITICAL either if your search string is
present or if the plugin times out. This is still pretty weak, though.
If the return time exceeded some critical threshold that was not a
timeout, you'd get state_ok.

I don't transform STATE_UNKNOWN or STATE_WARNING at all -- that seem
right to me, but I'm sure there are ways to think of it that I missed.
There seem to be lots of ways to think about it.

Anyway, my negate already works to that point, so I guess I'll check it
in.

-- 
Karl



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390




More information about the Users mailing list