nagios automation issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
TheHutGroup
Posts: 18
Joined: Wed Feb 11, 2015 12:21 pm

nagios automation issue

Post by TheHutGroup »

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:

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))
Any help or insight would be appreciated.

Cheers,

Danny
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios automation issue

Post by tmcdonald »

This is a bit outside of scope for what the support forums are intended to cover. Myself and a few of the other tech staff know some Python but we don't have any experts on-staff. You'd probably have more luck asking on a forum that specifically deals with Python, since that definitely seems to be the piece that's misbehaving.
Former Nagios employee
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: nagios automation issue

Post by gormank »

How many services does it import?
Why not add the host to a group which is on the service, or add the host to the services?
The XI way of doing things seems to be to not use the features designed into Nagios. That being, for every host, you have X services, rather than having one service applied to many hosts.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios automation issue

Post by tmcdonald »

gormank wrote:The XI way of doing things seems to be to not use the features designed into Nagios. That being, for every host, you have X services, rather than having one service applied to many hosts.
This is just the way that our wizards do it, but there is nothing that requires this to be done in the CCM or in an import.
Former Nagios employee
Locked