Adding monit script for watching node real-time server.

This commit is contained in:
Samuel Clay 2013-05-28 18:21:55 -07:00
parent a5e617c993
commit 123de0dcb7
4 changed files with 29 additions and 2 deletions

19
config/monit_node.conf Normal file
View file

@ -0,0 +1,19 @@
set daemon 120
set logfile /var/log/monit.log
set eventqueue
basedir /var/monit # set the base directory where events will be stored
slots 100 # optionally limit the queue size
# If no real-time updates in last 10 minutes, something is wrong
check file node-newsblur.log with path /srv/newsblur/logs/newsblur.log
if timestamp > 10 minutes then exec "/srv/newsblur/utils/kill_node.sh"
# as uid sclay and gid sclay
check system node_server
if loadavg (1min) > 12 then exec "/srv/newsblur/utils/kill_node.sh"
# as uid sclay and gid sclay
if loadavg (5min) > 8 then exec "/srv/newsblur/utils/kill_node.sh"
# as uid sclay and gid sclay

5
fabfile.py vendored
View file

@ -535,6 +535,11 @@ def config_monit_task():
sudo('echo "startup=1" > /etc/default/monit') sudo('echo "startup=1" > /etc/default/monit')
sudo('/etc/init.d/monit restart') sudo('/etc/init.d/monit restart')
def config_monit_node():
put('config/monit_node.conf', '/etc/monit/conf.d/node.conf', use_sudo=True)
sudo('echo "startup=1" > /etc/default/monit')
sudo('/etc/init.d/monit restart')
def config_monit_app(): def config_monit_app():
put('config/monit_app.conf', '/etc/monit/conf.d/gunicorn.conf', use_sudo=True) put('config/monit_app.conf', '/etc/monit/conf.d/gunicorn.conf', use_sudo=True)
sudo('echo "startup=1" > /etc/default/monit') sudo('echo "startup=1" > /etc/default/monit')

View file

@ -13,8 +13,8 @@
// #define BACKGROUND_REFRESH_SECONDS -5 // #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60 #define BACKGROUND_REFRESH_SECONDS -10*60
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"] // #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"] #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_LINK_COLOR 0x405BA8 #define NEWSBLUR_LINK_COLOR 0x405BA8
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd #define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd

3
utils/kill_node.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
sudo supervisorctl reload