Hello,
I'm facing a weird problem, I've got a simple:
define command {
command_name notify-service-by-email
command_line /opt/test.py --message "$SERVICEOUTPUT$"
}
The test.py contains a loop with a time.sleep(300) between elements, the first element of the loop is executed and then the program is exited. It's strange because it should loop over all items before quiting, When I run manualy the Python script everything is fine.
Is there a timeout or something within 'command_line' preventing the time.sleep() to be executed?
Thank you,
Python time.sleep() doesn't work in command_line
Re: Python time.sleep() doesn't work in command_line
You can adjust the maximum timeout value for service checks by using the service_check_timeout directive in the main configuration file.
From: http://nagios.sourceforge.net/docs/3_0/configmain.html
From: http://nagios.sourceforge.net/docs/3_0/configmain.html
Format: service_check_timeout=<seconds>
Example: service_check_timeout=60
This is the maximum number of seconds that Nagios will allow service checks to run. If checks exceed this limit, they are killed and a CRITICAL state is returned. A timeout error will also be logged.
There is often widespread confusion as to what this option really does. It is meant to be used as a last ditch mechanism to kill off plugins which are misbehaving and not exiting in a timely manner. It should be set to something high (like 60 seconds or more), so that each service check normally finishes executing within this time limit. If a service check runs longer than this limit, Nagios will kill it off thinking it is a runaway processes.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Python time.sleep() doesn't work in command_line
Thank you very much, increasing one of that value fixed the problem