Page 1 of 1
Service check to run daily at specific time
Posted: Thu Jul 06, 2017 6:31 am
by nms
Hi all,
I have a service check, basically a query in which i need to return a value for a whole 24 hours, hence the idea was to run this at approximately midnight.
i could set the monitor to run every 1440 mins but in this case this would not run at the appropriate time.
Was thinking into pushing a downtime scheduler but am not sure then about the graph.
Is there a possibility to stick to an exact time every day?
Thanks
Re: Service check to run daily at specific time
Posted: Thu Jul 06, 2017 4:00 pm
by tmcdonald
Best way to do this would be to schedule it as a cron job, honestly. Do that and send it back as a passive check through NRDP, or an external command if you want to get fancy:
https://assets.nagios.com/downloads/nag ... mands.html
Re: Service check to run daily at specific time
Posted: Mon Jul 17, 2017 5:22 am
by nms
Hi,
The NRDP seems interesting. i did not exactly understand the concept though. Ok, let assume i set a script/query to run at midnight, every day. i guess the result should be sent in a text output or something similar.
Then, the part which was not very clear to me: From the wizard i can configure a passive check, inserting the address of the host, but then i got confused of how to link the service name with the script found on the server. Tried to follow
https://assets.nagios.com/downloads/nag ... ios-XI.pdf but could not understand the pat where you link the service with script in the server.
Can you kindly shed some light?
Re: Service check to run daily at specific time
Posted: Mon Jul 17, 2017 3:03 pm
by tmcdonald
Can you show me what you have set up already? Ideally the script that you have running on the remote machine, as well as the host and service definitions you have set up in XI.
Re: Service check to run daily at specific time
Posted: Tue Jul 18, 2017 3:02 am
by nms
Hi,
Apologies was too quick and eager to understand the passive mode! Basically this is the script which runs daily at midnight. The script sends the output to file:
Code: Select all
0 0 * * * /home/nagios/bin/Nagios_alarms_last24Hr_soft.sh > /home/nagios/bin/Nagios_alarms_last24Hr_soft_Nagios.txt 2>&1
The output file is of this format (for Nagios output of course)
Code: Select all
cat Nagios_alarms_last24Hr_soft_Nagios.txt
OK=834, WARNING=319, CRITICAL=1192, UNKNOWN=45 | OK=834; WARNING=319; CRITICAL=1192; UNKNOWN=45;
Now on Nagios i simply added a command in order to added to the new service (Please see command.png attached). Not sure if this is required since we need passive.
Then using the configuration wizard i set a passive service on the host (Please see attached passive_check.png) . It's here that i'm blocked. How do i associate a passive check with the script on the monitored machine?
With thanks,
Matthew
Re: Service check to run daily at specific time
Posted: Tue Jul 18, 2017 4:42 pm
by tmcdonald
I'm guessing you skipped over this part of the documentation -
https://assets.nagios.com/downloads/nag ... erview.pdf
Please read that document, especially page 6 where it shows how to use the
send_nrdp.php script to send the data back. Simply running your script on the remote machine is not enough, you need to send the results back to Nagios.