supervisord can't start nagiosapi after reboot

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bajinganindy2
Posts: 2
Joined: Tue Jun 05, 2012 11:30 am

supervisord can't start nagiosapi after reboot

Post by bajinganindy2 »

I'm running debian. I have supervisord to start nagiosapi everytime the server starts. The API created a status dump file called status.dat, which will get updated periodically. The following is the conf file that starts the api.

Code: Select all

    [program:nagapi]
    directory = /home/nagapi
    user = api
    command = /bin/bash -c "source /home/nagapi/.virtualenvs/nagapi/bin/activate;    /home/nagapi/nagios-api/nagios-api"
    stdout_logfile = /home/nagapi/supervisor_nagios-api_stdout.log
    stderr_logfile = /home/nagapi/supervisor_nagios-api_stderr.log
Everytime i restart the server, supervisord cannot start the api. stderr.log claims that it cannot find the status.dat file located in /var/cache/nagios3.

It seems like the files was not created yet when supervisor tried to run the api the first time. I'm saying this because if i do a supervisorctl reload, everything would reload just fine, and the api would run ok about 50 seconds after the reload command completes.

should i change the command option of the conf file to check for
bajinganindy2
Posts: 2
Joined: Tue Jun 05, 2012 11:30 am

Re: supervisord can't start nagiosapi after reboot

Post by bajinganindy2 »

ok, i finally figured this out. Depending on how many servers you are monitoring, it might take some time for status.dat to be available upon restart. All I have to do is to wait until the file becomes available. I did so by adding startsecs option in my supervisor config file for the API. in my case, 60 seconds seem to do it.

if you are interested to know the details, i documented this problem in my blog on: http://digitallibraryworld.com/?p=291
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: supervisord can't start nagiosapi after reboot

Post by agriffin »

Well I'm glad you figured it out. Thanks for documenting the solution, too!
Locked