Skip to content

Instantly share code, notes, and snippets.

@monodeep12
Last active February 11, 2016 04:20
Show Gist options
  • Save monodeep12/56c0aba0e9321c69532f to your computer and use it in GitHub Desktop.
Save monodeep12/56c0aba0e9321c69532f to your computer and use it in GitHub Desktop.
monit config file for monitoring a go app server
check process hulk_server
with pidfile /opt/go/src/github.com/xxxx/yyyy/hulk.pid
start program = "/home/hulk/media_planner/run_hulk_server.sh" as uid hulk and gid hulk
stop program = "/bin/bash -c 'fuser -k 5000/tcp'"
if failed host x.x.x.x port 5000 then alert
if failed host x.x.x.x port 5000 then restart
if 5 restarts within 5 cycles then timeout
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if totalmem > 600.0 MB for 5 cycles then restart
@monodeep12
Copy link
Author

This is what I have in the shell script (run_hulk_server.sh) :

#!/bin/bash

export GOPATH="/opt/go"
export HULK_DEPLOYMENT_TYPE="production"
export PATH="/home/hulk/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/opt/go/bin"


cd $GOPATH/src/github.com/xxxx/hulk

hulk >> /usr/hulk/logs/hulk.o 2>> /usr/hulk/logs/hulk.e & echo $! > $GOPATH/src/github.com/xxxx/hulk/hulk.pid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment