Hi All,
I have a question related to the check scheduling.
I'd like to create a check whick will run the same specific time in every hours. E.g. I'd like to run a check at 01:10 and 02:10 and 03:10 ...
Can I do this anyhow?
I know the following possibilities:
- I can create a service with a check_interval 60 minutes, but in this case I cannot force the exact time of the check within the hour.
- I can create a special time period with value '00:10-00:05,01:10-01:15,02:10-02-15...' and I can leave the check_interval's value on 5 minutes, but this is ang ugly solution.
Is there any 'elegant' solution for this issue?
Thanks for your help.
Special time schedule
Re: Special time schedule
To the best of my knowledge there is no more elegant solution to achieve this, the other option is to make that check passive if possible.
Re: Special time schedule
This is not good.
However, I have created a quite elegant solution for this issue. This is a '3rd party' solution.
I have created a script which check the current time on the machine and if the minutes are not between the desired values it sends back an information message about the check postpone and exit with OK state.
Here is the script:
If anybody needs it feel free to modify and use it.
Note: The script should be in the same directory as the original check.
However, I have created a quite elegant solution for this issue. This is a '3rd party' solution.
I have created a script which check the current time on the machine and if the minutes are not between the desired values it sends back an information message about the check postpone and exit with OK state.
Here is the script:
Code: Select all
#!/bin/bash
#
# Check scheduler for check_clamav
#
# Copyright Sandor Szabo <sszabo@taylorandtaylor.hu>, (c) 2011.
# Revised: 2011.11.16.
#
MINUTES=`date | sed -r 's/.*:([0-9][0-9]):.*/\1/g'`
if [[ $MINUTES -ge 10 && $MINUTES -le 15 ]]
then
./check_something $*
else
echo "Service OK: Check postponed to next hour"
exit 0
fi
Note: The script should be in the same directory as the original check.
Re: Special time schedule
I have one modification for my earlier post (code).
The checker script should be used with full path, so e.g. the related row should be modified to this:
The checker script should be used with full path, so e.g. the related row should be modified to this:
Code: Select all
/usr/lib/nagios/plugins/check_service $*
Re: Special time schedule
Very cool way of doing it, glad you find a solution.