sethttpdport2812anduseaddress172.16.10.6allowlocalhost# 允许本地访问allow172.16.20.0/255.255.255.0#允许本 IP 段访问allowadmin:monit# require user 'admin' with password 'monit'
<!--检查周期,单位为秒-->setdaemon120<!--日志文件位置-->setlogfile/var/log/monit.log<!--存储monit实例的唯一ID-->setidfile/var/lib/monit/id<!--存放监控进程的情况-->setstatefile/var/lib/monit/state<!--设置邮件-->setmailserversmtp.aa.comport25USERNAME"aa@aa.com"PASSWORD"123456"# 如果没配置 email, 会自动丢弃 alert# 该设置可以保存 alertseteventqueuebasedir/var/lib/monit/eventsslots100<!--Email格式-->setmail-format{from:monit@$HOSTsubject:monitalert--$EVENT$SERVICEmessage:$EVENTService$SERVICEDate:$DATEAction:$ACTIONHost:$HOSTDescription:$DESCRIPTIONYourfaithfulemployee,Monit}# 制定报警邮件的格式setmail-format{from:aa@aa.comsubject:$SERVICE$EVENTat$DATEmessage:Monit$ACTION$SERVICEat$DATEon$HOST:$DESCRIPTION.}<!--Email接收人-->setalertsysadm@foo.barwithreminderon3cycles<!--开启http服务,查看监控情况-->sethttpdport2812anduseaddress172.16.10.6# only accept connection from localhost#allow localhost#allow 172.16.20.0/255.255.255.0#allow 10.0.0.0 # allow localhost to connect to the server andallowadmin:monit# require user 'admin' with password 'monit'# allow @monit # allow users of group 'monit' to connect (rw)# allow @users readonly # allow users of group 'users' to connect readonlyinclude/etc/monit/conf.d/*
# Load DSL and Setup Up Stagesrequire'capistrano/setup'require'capistrano/deploy'#require'capistrano/rvm'require'capistrano/bundler'require'capistrano/rails/assets'require'capistrano/rails/migrations'require'capistrano/sidekiq'# 打开 monit 的监控 tasksrequire'capistrano/sidekiq/monit'require'capistrano/puma'# 打开 monit 的监控 tasksrequire'capistrano/puma/monit'# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.Dir.glob('lib/capistrano/tasks/*.rake').each{|r|importr}
# This is an upstart script to keep monit running.# To install disable the old way of doing things:## /etc/init.d/monit stop && update-rc.d -f monit remove## then put this script here:## /etc/init/monit.conf## and reload upstart configuration:## initctl reload-configuration## You can manually start and stop monit like this:# # start monit# stop monit#description"Monit service manager"limitcoreunlimitedunlimitedstartonrunlevel[2345]stoponstartingrcRUNLEVEL=[016]expectdaemonrespawnexec/usr/local/bin/monit-c/etc/monit/monitrcpre-stopexec/usr/local/bin/monit-c/etc/monit/monitrcquit