Srvconfig
Based on outpost (https://github.com/vinibaggio/outpost)
Example
require 'srvmonitor'
require 'srvmonitor/scouts'
# define your servers
server1 = SrvMonitor::Server.new(:name => 'first server', :description => 'web server', :host => '192.168.0.1', :method => :local, :user => 'deployer')
server2 = SrvMonitor::Server.new(:name => 'second server', :description => 'node server', :host => '192.168.0.2', :method => :local, :user => 'deployer')
# define your applications
railswatch = SrvMonitor::Application.create do
name 'Rails Watch'
scout SrvMonitor::Scouts::TimedHttp, :port => 80, :path => '/', :timeout => 15
report :up, :response_code => 200
server server1, :port => 3000, :method => :local
server server2, :method => :local
end
loadwatch = SrvMonitor::Application.create do
name 'Load Watch'
scout SrvMonitor::Scouts::LoadAverage
report :up, :load_average => { :less_than => 50 }
servers server1, server2, :method => :remote
end
# create the monitor
SrvMonitor::Monitor.create do
notifier SrvMonitor::Notifiers::Mailer, {
:delivery_method => 'smtp',
:address => 'smtp.gmail.com',
:port => '587',
:authentication => 'plain',
:username => '[email protected]',
:password => 'password',
:enable_starttls_auto => true,
:to => '[email protected]',
:status => :down }
alert :if => :down, :retries => 5
applications railswatch, loadwatch
forever true
wait 5
run
end
License
MIT License.