Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have problems with monitoring nginx. Monit can monitor nginx and display resources usage (RAM usage, etc.), but is unable to start/stop nginx. I get only a simple message: "Execution failed". Syslog doesn't tell any more information.

My monitrc configuration file:

check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program  = "/etc/init.d/nginx stop"
group www-data

Restarting any other monitored program (eg. dovecot) works. Also, manually running nginx works

/etc/init.d/nginx start

Syslog:

 May  5 17:47:45 vm7508 monit[7079]: restart service 'nginx' on user request
 May  5 17:47:45 vm7508 monit[7079]: monit daemon at 7079 awakened
 May  5 17:47:45 vm7508 monit[7079]: Awakened by User defined signal 1
 May  5 17:47:45 vm7508 monit[7079]: 'nginx' trying to restart
 May  5 17:47:45 vm7508 monit[7079]: 'nginx' stop: /etc/init.d/nginx
 May  5 17:48:15 vm7508 monit[7079]: 'nginx' failed to stop
 May  5 17:48:15 vm7508 monit[7079]: 'nginx' restart action done

Thanks.

share|improve this question
    
The syntax looks correct. Monit is definitely running as root? There are no trailing invisible characters in the monitrc file? –  cjc May 5 '13 at 13:14
    
Thanks for your reply, I am sure that monit is running as root, because the monit process (ps aux) belongs to root and also monit is able to start other processes, for example dovecot (what requires root privileges). What do you mean by invisible trailing characters? (also, this is not complete monitrc file, this is only nginx part) @cjc –  Matoha May 5 '13 at 13:41
    
I was thinking that the monitrc was edited in Windows, and there are invisible carriage returns at the end of the lines. If you look at it in vim/cat/more/less, they may not be obvious because those utilities handle them correctly, but monitrc may not. Try opening the file with vim -b monitrc. The "-b" option for vim will show non-printable characters. Additionally, are there any useful messages in /var/log/messages or the nginx log? –  cjc May 5 '13 at 14:05
    
/var/log/messages: nothing, nginx log: nothing, syslog: see above in the question. The file was editied only on Linux, but I checked it with the vim and found nothing. @cjc –  Matoha May 5 '13 at 15:53
    
I have no generic ideas at this point. Did you take a look at this, though? stackoverflow.com/questions/3356476/debugging-monit –  cjc May 5 '13 at 17:01

1 Answer 1

I had same issue but in my case error was clear, the group was mysql instead of www-data (I run nginx on ubuntu) then I change the conf.d file and then restarted the monit and

Process 'nginx' status Running monitoring status Monitored

Hope it helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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