Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White-space in process name & monit #60

Closed
s0undt3ch opened this issue Jun 12, 2011 · 3 comments
Closed

White-space in process name & monit #60

s0undt3ch opened this issue Jun 12, 2011 · 3 comments

Comments

@s0undt3ch
Copy link

I'm unable to monitor thin with monit because it's process name contains whitespace.

# ps aux | grep thin
gitosis  28109  0.0 15.3 253032 117244 ?       D    Jun11   0:33 thin server (/usr/share/redmine/tmp/sockets/thin.0.socket)                                                                                                                                                                                                                                                                                      
gitosis  28115  0.0  0.1 229912   872 ?        S    Jun11   0:14 thin server (/usr/share/redmine/tmp/sockets/thin.1.socket)

My monit rc file for thin.

check process thin-0
    with pidfile /var/run/redmine/thin.0.pid
    start program = "/etc/init.d/thin start"
    stop program = "/etc/init.d/thin stop"
    if totalmem > 150.0 MB for 10 cycles then restart

    if failed unixsocket /var/run/redmine/sockets/default/thin.0.socket then restart
    if failed unixsocket /var/run/redmine/sockets/default/thin.1.socket then restart

    if cpu is greater than 40% for 2 cycles then alert
    if cpu usage > 95% for 3 cycles then restart
    if 5 restarts within 10 cycles then timeout

Here's how monit behaves:

# monit validate
'thin-0' process is not running
'thin-0' trying to restart
'thin-0' start: /etc/init.d/thin
[start] /etc/thin1.8/redmine.yml ...
Starting server on /usr/share/redmine/tmp/sockets/thin.0.socket ... 
/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/daemonizing.rb:171:in `remove_stale_pid_file': /usr/share/redmine/tmp/pids/thin.0.pid already exists, seems like it's already running (process ID: 28109). Stop the process or delete /usr/share/redmine/tmp/pids/thin.0.pid. (Thin::PidFileExist)
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/daemonizing.rb:42:in `daemonize'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:61:in `start'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
        from /var/lib/gems/1.8/gems/thin-1.2.11/bin/thin:6
        from /usr/local/bin/thin:19:in `load'
        from /usr/local/bin/thin:19
Starting server on /usr/share/redmine/tmp/sockets/thin.1.socket ... 
/var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/daemonizing.rb:171:in `remove_stale_pid_file': /usr/share/redmine/tmp/pids/thin.1.pid already exists, seems like it's already running (process ID: 28115). Stop the process or delete /usr/share/redmine/tmp/pids/thin.1.pid. (Thin::PidFileExist)
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/daemonizing.rb:42:in `daemonize'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:61:in `start'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
        from /var/lib/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
        from /var/lib/gems/1.8/gems/thin-1.2.11/bin/thin:6
        from /usr/local/bin/thin:19:in `load'
        from /usr/local/bin/thin:19
^C'thin-0' failed to start

It also does not work if I make monit check the process thin nor "thin server (/usr/share/redmine/tmp/sockets/thin.1.socket)". The first because there no such process, the second because white-space and commas are not allowed in process names on monitrc files.

@macournoyer
Copy link
Owner

Have you checked the monit examples in https://github.com/macournoyer/thin/blob/master/example/monit_sockets ?

@s0undt3ch
Copy link
Author

Yes, I have, they failed. Re-installed thin from gem and not from distro. Will try again to see if it now works

@s0undt3ch
Copy link
Author

Funny, it now works?!!?!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants