nagios automation issue
Posted: Thu Jan 07, 2016 9:16 am
Hi All,
I have a script that listens to rabbit MQ to pull events down for newly created hosts which it in turn creates the host / service configuration files for. The problem I'm having which I can't figure out is if I run the reconfigure_nagios.sh script from within my python script it always truncates my services after a certain number of services. I've confirmed there is nothing wrong with my service configs as if I either "apply configuration" via the nagios xi web ui or manually run the reconfigure_nagios.sh script by hand it imports fine.
The return code coming back to my python script is 0 which implies that it successfully imported the configs (even though it truncates the number of services during import). Have any of you run into this problem?
this is my code to run the reconfigure script:
Any help or insight would be appreciated.
Cheers,
Danny
I have a script that listens to rabbit MQ to pull events down for newly created hosts which it in turn creates the host / service configuration files for. The problem I'm having which I can't figure out is if I run the reconfigure_nagios.sh script from within my python script it always truncates my services after a certain number of services. I've confirmed there is nothing wrong with my service configs as if I either "apply configuration" via the nagios xi web ui or manually run the reconfigure_nagios.sh script by hand it imports fine.
The return code coming back to my python script is 0 which implies that it successfully imported the configs (even though it truncates the number of services during import). Have any of you run into this problem?
this is my code to run the reconfigure script:
Code: Select all
def reconfigure_nagios():
try:
p = subprocess.Popen(['/usr/local/nagiosxi/scripts/reconfigure_nagios.sh'], cwd='/usr/local/nagiosxi/scripts/')
p.wait()
returnCode = p.returncode
logger.info("Reconfigure output: " + str(returnCode))
if returnCode:
logger.error("Reconfigure has errored: " + str(returnCode))
logger.error("Reconfigure output\n" + str(returnCode))
except Exception as e:
logger.error("Could not reconfigure Nagios, error: " + str(e))
Cheers,
Danny