Metis - RubyConf 2011 Lightning Talk

3,598 views

Published on

Metis - Ruby daemon implementing the Nagios NRPE protocol for monitoring your network and servers.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Metis - RubyConf 2011 Lightning Talk

  1. MonitoringA boring topic to most
  2. MeKen Robertson@krobertsonDemandbaseSFHiring! (HR made me do it)
  3. DevOpsSexy Server Talk
  4. Y U NO LIKE?
  5. Metis
  6. MetisImplements the Nagios NRPE protocolRuby daemonLeverage gemsSimple framework for common stuffWill add support for test helpers
  7. define :eod do execute do if Time.now.hour >= 23 critical("Real close now!") elsif Time.now.hour >= 21 warn("Getting close to the end of the day") else ok("Were all good") end endend
  8. define :eod do execute do if Time.now.hour >= 23 critical("Real close now!") elsif Time.now.hour >= 21 warn("Getting close to the end of the day") else ok("Were all good") end endend
  9. define :eod do attribute :warning, :default => 21 attribute :critical, :default => 23 execute do if Time.now.hour >= params[:critical] critical("Real close now!") elsif Time.now.hour >= params[:warning] warn("Getting close to the end of the day") else ok("Were all good") end endend
  10. define :check_mysql_seconds_behind_master do attribute :host, :kind_of => String, :default => ‘127.0.0.1’ attribute :username, :kind_of => String attribute :password, :kind_of => String attribute :warning, :kind_of => Fixnum, :default => 20 attribute :critical, :kind_of => Fixnum, :default => 60 require_gem mysql execute do connection = Mysql.new(params[:host], params[:username], params[:password]) result = connection.query(show slave status) seconds = result.fetch_hash[Seconds_Behind_Master].to_i result.free connection.close critical("Were behind a lot!") if seconds >= params[:critical] warn("Were behind some") if seconds >= params[:warning] ok endend
  11. define :check_mysql_seconds_behind_master do attribute :host, :kind_of => String, :default => ‘127.0.0.1’ attribute :username, :kind_of => String attribute :password, :kind_of => String attribute :warning, :kind_of => Fixnum, :default => 20 attribute :critical, :kind_of => Fixnum, :default => 60 require_gem mysql execute do connection = Mysql.new(params[:host], params[:username], params[:password]) result = connection.query(show slave status) seconds = result.fetch_hash[Seconds_Behind_Master].to_i result.free connection.close critical("Were behind a lot!") if seconds >= params[:critical] warn("Were behind some") if seconds >= params[:warning] ok endend
  12. describe :check_mysql_seconds_behind_master do include Metis::TestHelpers it should return critical when very far behind do mysql_result = double(result) mysql_result.stub(:fetch_hash).and_return({Seconds_Behind_Master => 120}) Mysql.any_instance.stub(:query).and_return(mysql_result) result = run_monitor(:check_mysql_seconds_behind_master) result.status.should == :critical result.message.should == "Were behind a lot!" endend* This isn’t actually implemented yet, but will soon!
  13. Metishttp://github.com/krobertson/metisgem install metisphoto credit: http://www.flickr.com/photos/mafleen/3295163029/

×