I created in /etc/init a monit.conf file that is pretty standard. During reboot, however, when monit tries to start, it checks dns resolution for things in its configuration file (monitrc) but fails. I had to add a pre-start stanza to get it to loop and keep trying to resolve a dns name before it goes and tries to start monit. It just seems kind of clunky though. I am guessing this is related to network stuff not starting until a script in /etc/init.d for networking runs and that my monit stuff starts before that unless I use this loop check. I tried:

start on (net-device-up IFACE=eth0 and runlevel [2345]), thinking that this would make sure that the interface was up and that we were in a runlevel where networking should at least be running, but that did not help. Is there some other key word I can put in start on that checks if resolution is available? Please note my server is not running dns server.


You might try starting when networking is up and running.

start on started networking

However your job is depending on external condition (DNS resolution) therefore loop you created might be inevitable.

You should also re-check your monit configuration: The upstart script provided on Monit web site looks straight forward. No mention of problems you are facing.

Case you haven't done it already check the content of /var/log/upstart/monit.log and debug your script. Knowing exactly why your script is failing on reboot could be helpful.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.