質問

I'm working on getting a Node server up with upstart and monit instead of using a cron job to run a script to check on things. I've built an admin dashboard for the server that uses the Node os module for things like os.loadavg() and os.totalmem(), etc...

The problem is, when monit is running, os.loadavg() always returns [0, 0, 0]. Has anyone else encountered this problem? Does monit create a lock or something that does not allow Node to read that property?

Thanks in advance for any help!

Monit Script

check process flinch
    with pidfile "/var/run/flinch.pid"
    start program = "/sbin/start flinch"
    stop program = "/sbin/stop flinch"
    if loadavg (1min) > 4 then alert
    if loadavg (5min) > 2 then alert
    if memory usage > 0% then alert
役に立ちましたか?

解決

To give this question some closure, I removed monit from the system check and wrote a custom bash script that checks the process and it runs on during a cron job every minute. Monit seems to put a lock on the system stats when in use.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top