Created
March 28, 2016 07:31
-
-
Save srgrn/368c6e9c49c79ed2c8a8 to your computer and use it in GitHub Desktop.
monit and service configuration scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process carbon-cache | |
| matching "carbon-cache" | |
| start program = "/usr/sbin/service carbon-cache restart" | |
| stop program = "/usr/sbin/service carbon-cache stop" | |
| if 5 restarts within 5 cycles then alert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # carbon-cache-a upstart job | |
| # | |
| # Daniel Beckham | |
| # @dbeckham | |
| description "Graphite carbon-cache-a instance." | |
| author "Puppet" | |
| start on runlevel [2345] | |
| stop on runlevel [016] | |
| env GRAPHITE_ROOT=/opt/graphite | |
| env PYTHONPATH=/opt/graphite/lib | |
| pre-start script | |
| mkdir -p $GRAPHITE_ROOT/storage/log/carbon-cache/carbon-cache-a | |
| end script | |
| script | |
| exec twistd --nodaemon --reactor=epoll --no_save carbon-cache --config $GRAPHITE_ROOT/conf/carbon.conf 2>&1 >> $GRAPHITE_ROOT/storage/log/carbon-cache/carbon-cache-a/console.log | |
| end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process grafana_server with pidfile /var/run/grafana-server.pid | |
| start program = "/usr/sbin/service grafana-server start" | |
| stop program = "/usr/sbin/service grafana-server stop" | |
| if failed | |
| host monitor.rumble.me | |
| port 443 | |
| protocol http | |
| request "/grafana" | |
| then restart | |
| if 5 restarts within 5 cycles then alert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set daemon 60 | |
| set logfile /var/log/monit.log | |
| set idfile /var/lib/monit/id | |
| set statefile /var/lib/monit/state | |
| set mailserver smtp.mailgun.org | |
| port 587 | |
| username "SMTPUSERNAME" | |
| password "password" | |
| with timeout 60 seconds | |
| set eventqueue | |
| basedir /var/lib/monit/events # set the base directory where events will be stored | |
| slots 100 # optionally limit the queue size | |
| set mail-format { from: monit@<yourdomain> } | |
| set alert <alert>@<yourdomain> not on { instance, action } | |
| set alert <alert>@<yourdomain> not on { instance, action } | |
| set httpd port 2812 and | |
| allow admin:monit # require user 'admin' with password 'monit' | |
| check system localhost | |
| if loadavg (5min) > 5 then alert | |
| if memory usage > 90% then alert | |
| check filesystem root with path /dev/sda1 | |
| if space usage > 80% then alert | |
| include /etc/monit/conf.d/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process nginx with pidfile /var/run/nginx.pid | |
| start program = "/usr/sbin/service nginx restart" | |
| stop program = "/usr/sbin/service nginx stop" | |
| group www-data | |
| if failed port 80 protocol http then restart | |
| if 5 restarts within 5 cycles then alert | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syren upstart job | |
| # | |
| # Eran Zimbler | |
| # @zimbler | |
| # https://github.com/srgrn | |
| description "Syren upstart." | |
| author "Eran Zimbler" | |
| start on runlevel [2345] | |
| stop on runlevel [016] | |
| env SEYREN_FOLDER=/opt/seyren | |
| env SEYREN_VERSION=1.3.0 | |
| env PORT=9876 | |
| env GRAPHITE_URL="http://localhost/graphite" | |
| env SEYREN_LOG_PATH=/var/log/seyren/ | |
| env SEYREN_URL="https://localhost/seyren" | |
| env SMTP_HOST=smtp.mailgun.com | |
| env SMTP_FROM="seyren@<yourdomain>" | |
| env SMTP_USERNAME="SMTPUSER" | |
| env SMTP_PASSWORD="password" | |
| respawn | |
| exec java -jar $SEYREN_FOLDER/seyren-$SEYREN_VERSION.jar -httpPort=$PORT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process statsite | |
| matching "statsite" | |
| start program = "/usr/sbin/service statsite restart" | |
| stop program = "/usr/sbin/service statsite stop" | |
| if 5 restarts within 5 cycles then alert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # statsite upstart job | |
| # | |
| # Eran Zimbler | |
| # @zimbler | |
| # https://github.com/srgrn | |
| description "Statsite - statsd alternative." | |
| author "Eran Zimbler" | |
| start on runlevel [2345] | |
| stop on runlevel [016] | |
| env STATSITE_ROOT=/opt/statsite | |
| script | |
| exec $STATSITE_ROOT/statsite -f $STATSITE_ROOT/statsite.ini | |
| end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check process vsftpd | |
| matching vsftpd | |
| start program = "/usr/sbin/service vsftpd start" | |
| stop = "/usr/sbin/service vsftpd stop" | |
| if 3 restarts within 3 cycles then alert | |
| if failed port 21 protocol ftp then restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment