Class: MuninManager::Plugins::NotificationClassification

Inherits:
Object
  • Object
show all
Includes:
ActsAsMuninPlugin
Defined in:
lib/munin_manager/plugins/notification_classification.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActsAsMuninPlugin

included

Class Method Details

.runObject



17
18
19
20
21
22
23
24
25
# File 'lib/munin_manager/plugins/notification_classification.rb', line 17

def self.run
  allowed_commands = ['config']
  if cmd = ARGV[0] and allowed_commands.include? cmd
    puts new.config
  else
    cmd = "mysql -u #{ENV['mysql_user']} --password=#{ENV['mysql_password']} -h #{ENV['host']} -e 'use #{ENV['database']}; select count(*) from notification_classifications where created_at >= \"#{1.hour.ago.to_s(:db)}\";' --skip-column-names --silent"
    puts "notification_rate.value %s" % `#{cmd}`
  end
end

Instance Method Details

#configObject



8
9
10
11
12
13
14
15
# File 'lib/munin_manager/plugins/notification_classification.rb', line 8

def config
  "graph_title #{ENV['app']} Notification Classification Creation
  graph_vlabel new classifications / hour
  notification_rate.label new classifications / hour
  notification_rate.type derive
  notification_rate.warning 10
  notification_rate.critical 100"
end