+ All Categories
Home > Technology > Metis - RubyConf 2011 Lightning Talk

Metis - RubyConf 2011 Lightning Talk

Date post: 15-Jan-2015
Category:
Upload: ken-robertson
View: 3,213 times
Download: 4 times
Share this document with a friend
Description:
Metis - Ruby daemon implementing the Nagios NRPE protocol for monitoring your network and servers.
Popular Tags:
16
Monitoring A boring topic to most
Transcript
Page 1: Metis - RubyConf 2011 Lightning Talk

MonitoringA boring topic to most

Page 2: Metis - RubyConf 2011 Lightning Talk

Me

Ken Robertson

@krobertson

Demandbase

SF

Hiring! (HR made me do it)

Page 3: Metis - RubyConf 2011 Lightning Talk

DevOpsSexy Server Talk

Page 4: Metis - RubyConf 2011 Lightning Talk
Page 5: Metis - RubyConf 2011 Lightning Talk
Page 6: Metis - RubyConf 2011 Lightning Talk
Page 7: Metis - RubyConf 2011 Lightning Talk

Y U NO LIKE?

Page 8: Metis - RubyConf 2011 Lightning Talk

Metis

Page 9: Metis - RubyConf 2011 Lightning Talk

MetisImplements the Nagios NRPE protocol

Ruby daemon

Leverage gems

Simple framework for common stuff

Will add support for test helpers

Page 10: Metis - RubyConf 2011 Lightning Talk

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("We're all good")end

endend

Page 11: Metis - RubyConf 2011 Lightning Talk

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("We're all good")end

endend

Page 12: Metis - RubyConf 2011 Lightning Talk

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("We're all good")end

endend

Page 13: Metis - RubyConf 2011 Lightning Talk

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("We're behind a lot!") if seconds >= params[:critical] warn("We're behind some") if seconds >= params[:warning] ok endend

Page 14: Metis - RubyConf 2011 Lightning Talk

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("We're behind a lot!") if seconds >= params[:critical] warn("We're behind some") if seconds >= params[:warning] ok endend

Page 15: Metis - RubyConf 2011 Lightning Talk

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 == "We're behind a lot!" endend

* This isn’t actually implemented yet, but will soon!

Page 16: Metis - RubyConf 2011 Lightning Talk

Metishttp://github.com/krobertson/metis

gem install metis

photo credit: http://www.flickr.com/photos/mafleen/3295163029/


Recommended