From 1751b31885773d33dcf3efb396f198f1d10a2221 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Tue, 12 Mar 2024 20:45:46 +0000 Subject: [PATCH] Remove munin Fixed: https://github.com/openstreetmap/operations/issues/501 Signed-off-by: Grant Slater --- cookbooks/apache/recipes/default.rb | 4 - cookbooks/chef/recipes/server.rb | 2 - cookbooks/db/recipes/base.rb | 5 - cookbooks/db/recipes/master.rb | 2 +- cookbooks/dev/recipes/default.rb | 7 - cookbooks/exim/recipes/default.rb | 3 - cookbooks/fail2ban/recipes/default.rb | 2 - cookbooks/hardware/recipes/default.rb | 57 +- .../templates/default/munin.hddtemp.erb | 10 - .../templates/default/munin.smart.erb | 9 - cookbooks/memcached/recipes/default.rb | 10 - .../memcached/templates/default/munin.erb | 6 - .../munin/files/default/plugin-conf.d/api | 2 - .../munin/files/default/plugin-conf.d/chef | 2 - .../files/default/plugin-conf.d/hpasmcli2 | 2 - .../munin/files/default/plugins/api_calls_ | 69 - .../munin/files/default/plugins/api_calls_num | 34 - .../files/default/plugins/api_calls_status | 47 - .../munin/files/default/plugins/api_waits_ | 71 - .../munin/files/default/plugins/chef_status | 29 - cookbooks/munin/files/default/plugins/chrony | 119 - .../munin/files/default/plugins/fw_conntrack | 168 -- .../files/default/plugins/fw_forwarded_local | 93 - .../munin/files/default/plugins/hpasmcli2_ | 165 -- .../munin/files/default/plugins/memcached_ | 486 ---- .../files/default/plugins/memcached_multi_ | 1631 ----------- .../files/default/plugins/munin_rrdcached | 45 - cookbooks/munin/files/default/plugins/mysql_ | 2514 ----------------- .../files/default/plugins/passenger_memory | 33 - .../files/default/plugins/passenger_processes | 47 - .../files/default/plugins/passenger_queues | 48 - .../files/default/plugins/passenger_requests | 58 - .../munin/files/default/plugins/planet_age | 58 - .../default/plugins/postgres_replication | 19 - .../files/default/plugins/replication_delay | 29 - .../munin/files/default/plugins/rrdcached | 44 - .../default/plugins/snmp__apcpdu_current | 40 - .../default/plugins/snmp__apcpdu_humidity | 38 - .../files/default/plugins/snmp__apcpdu_power | 36 - .../default/plugins/snmp__apcpdu_temperature | 40 - .../default/plugins/snmp__apcpdu_voltage | 34 - cookbooks/munin/files/default/www/favicon.ico | Bin 15086 -> 0 bytes cookbooks/munin/files/default/www/robots.txt | 2 - cookbooks/munin/recipes/default.rb | 26 +- cookbooks/munin/recipes/plugins.rb | 253 +- cookbooks/munin/recipes/server.rb | 88 +- cookbooks/munin/resources/plugin.rb | 87 - cookbooks/munin/resources/plugin_conf.rb | 55 - cookbooks/munin/templates/default/apache.erb | 59 - .../munin/templates/default/backup.cron.erb | 18 - cookbooks/munin/templates/default/df.erb | 4 - .../munin/templates/default/diskstats.erb | 4 - cookbooks/munin/templates/default/if.erb | 4 - cookbooks/munin/templates/default/ipmi.erb | 4 - .../templates/default/munin-node.conf.erb | 39 - .../munin/templates/default/munin.conf.erb | 655 ----- .../munin/templates/default/rrdcached.erb | 57 - .../munin/templates/default/sensors_volt.erb | 4 - cookbooks/mysql/recipes/default.rb | 26 +- cookbooks/nginx/recipes/default.rb | 10 +- cookbooks/nginx/templates/default/munin.erb | 2 - .../nginx/templates/default/nginx.conf.erb | 2 +- cookbooks/nominatim/recipes/default.rb | 24 - .../nominatim/templates/default/munin.erb | 7 - cookbooks/ntp/recipes/default.rb | 2 - cookbooks/overpass/recipes/default.rb | 26 +- .../overpass/templates/default/munin.erb | 4 - .../templates/default/munin_db_lag.erb | 23 - .../templates/default/munin_request_count.erb | 44 - cookbooks/passenger/recipes/default.rb | 9 - .../passenger/templates/default/munin.erb | 5 - cookbooks/planet/recipes/default.rb | 2 - cookbooks/postgresql/README.md | 1 - cookbooks/postgresql/recipes/default.rb | 40 - cookbooks/postgresql/resources/munin.rb | 66 - .../postgresql/templates/default/munin.erb | 6 - cookbooks/tile/recipes/default.rb | 18 - cookbooks/web/recipes/rails.rb | 11 - roles/base.rb | 7 - roles/chef-server.rb | 14 - roles/db.rb | 20 - roles/gp-dl360e-g8.rb | 11 - roles/hp-dl180-g6.rb | 39 - roles/hp-dl360-g6.rb | 40 - roles/hp-g9.rb | 13 - roles/kessie.rb | 10 - roles/mail.rb | 10 - roles/paulla.rb | 5 +- roles/rhaegal.rb | 18 - roles/stormfly-03.rb | 38 - roles/tile.rb | 9 - .../munin-server/inspec/apache_spec.rb | 18 - .../munin-server/inspec/munin_spec.rb | 2 +- .../munin-server/inspec/rrdcached_spec.rb | 6 +- .../munin/inspec/munin_node_spec.rb | 9 +- 95 files changed, 62 insertions(+), 8012 deletions(-) delete mode 100644 cookbooks/hardware/templates/default/munin.hddtemp.erb delete mode 100644 cookbooks/hardware/templates/default/munin.smart.erb delete mode 100644 cookbooks/memcached/templates/default/munin.erb delete mode 100644 cookbooks/munin/files/default/plugin-conf.d/api delete mode 100644 cookbooks/munin/files/default/plugin-conf.d/chef delete mode 100644 cookbooks/munin/files/default/plugin-conf.d/hpasmcli2 delete mode 100755 cookbooks/munin/files/default/plugins/api_calls_ delete mode 100755 cookbooks/munin/files/default/plugins/api_calls_num delete mode 100755 cookbooks/munin/files/default/plugins/api_calls_status delete mode 100755 cookbooks/munin/files/default/plugins/api_waits_ delete mode 100755 cookbooks/munin/files/default/plugins/chef_status delete mode 100755 cookbooks/munin/files/default/plugins/chrony delete mode 100755 cookbooks/munin/files/default/plugins/fw_conntrack delete mode 100755 cookbooks/munin/files/default/plugins/fw_forwarded_local delete mode 100755 cookbooks/munin/files/default/plugins/hpasmcli2_ delete mode 100755 cookbooks/munin/files/default/plugins/memcached_ delete mode 100755 cookbooks/munin/files/default/plugins/memcached_multi_ delete mode 100644 cookbooks/munin/files/default/plugins/munin_rrdcached delete mode 100644 cookbooks/munin/files/default/plugins/mysql_ delete mode 100755 cookbooks/munin/files/default/plugins/passenger_memory delete mode 100755 cookbooks/munin/files/default/plugins/passenger_processes delete mode 100755 cookbooks/munin/files/default/plugins/passenger_queues delete mode 100755 cookbooks/munin/files/default/plugins/passenger_requests delete mode 100755 cookbooks/munin/files/default/plugins/planet_age delete mode 100755 cookbooks/munin/files/default/plugins/postgres_replication delete mode 100755 cookbooks/munin/files/default/plugins/replication_delay delete mode 100644 cookbooks/munin/files/default/plugins/rrdcached delete mode 100755 cookbooks/munin/files/default/plugins/snmp__apcpdu_current delete mode 100755 cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity delete mode 100755 cookbooks/munin/files/default/plugins/snmp__apcpdu_power delete mode 100755 cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature delete mode 100755 cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage delete mode 100644 cookbooks/munin/files/default/www/favicon.ico delete mode 100644 cookbooks/munin/files/default/www/robots.txt delete mode 100644 cookbooks/munin/resources/plugin.rb delete mode 100644 cookbooks/munin/resources/plugin_conf.rb delete mode 100644 cookbooks/munin/templates/default/apache.erb delete mode 100644 cookbooks/munin/templates/default/backup.cron.erb delete mode 100644 cookbooks/munin/templates/default/df.erb delete mode 100644 cookbooks/munin/templates/default/diskstats.erb delete mode 100644 cookbooks/munin/templates/default/if.erb delete mode 100644 cookbooks/munin/templates/default/ipmi.erb delete mode 100644 cookbooks/munin/templates/default/munin-node.conf.erb delete mode 100644 cookbooks/munin/templates/default/munin.conf.erb delete mode 100644 cookbooks/munin/templates/default/rrdcached.erb delete mode 100644 cookbooks/munin/templates/default/sensors_volt.erb delete mode 100644 cookbooks/nginx/templates/default/munin.erb delete mode 100644 cookbooks/nominatim/templates/default/munin.erb delete mode 100644 cookbooks/overpass/templates/default/munin.erb delete mode 100644 cookbooks/overpass/templates/default/munin_db_lag.erb delete mode 100644 cookbooks/overpass/templates/default/munin_request_count.erb delete mode 100644 cookbooks/passenger/templates/default/munin.erb delete mode 100644 cookbooks/postgresql/resources/munin.rb delete mode 100644 cookbooks/postgresql/templates/default/munin.erb delete mode 100644 test/integration/munin-server/inspec/apache_spec.rb diff --git a/cookbooks/apache/recipes/default.rb b/cookbooks/apache/recipes/default.rb index 6fdafa02e..a689fad95 100644 --- a/cookbooks/apache/recipes/default.rb +++ b/cookbooks/apache/recipes/default.rb @@ -126,10 +126,6 @@ fail2ban_jail "apache-evasive" do maxretry 3 end -munin_plugin "apache_accesses" -munin_plugin "apache_processes" -munin_plugin "apache_volume" - template "/var/lib/prometheus/node-exporter/apache.prom" do source "apache.prom.erb" owner "root" diff --git a/cookbooks/chef/recipes/server.rb b/cookbooks/chef/recipes/server.rb index 48fbfd747..31b6b196a 100644 --- a/cookbooks/chef/recipes/server.rb +++ b/cookbooks/chef/recipes/server.rb @@ -101,5 +101,3 @@ template "/etc/cron.daily/chef-server-backup" do group "root" mode "755" end - -munin_plugin "chef_status" diff --git a/cookbooks/db/recipes/base.rb b/cookbooks/db/recipes/base.rb index 6efbde328..d989d0bc9 100644 --- a/cookbooks/db/recipes/base.rb +++ b/cookbooks/db/recipes/base.rb @@ -26,11 +26,6 @@ include_recipe "ruby" passwords = data_bag_item("db", "passwords") wal_secrets = data_bag_item("db", "wal-secrets") -postgresql_munin "openstreetmap" do - cluster node[:db][:cluster] - database "openstreetmap" -end - directory "/srv/www.openstreetmap.org" do group "rails" mode "2775" diff --git a/cookbooks/db/recipes/master.rb b/cookbooks/db/recipes/master.rb index 323466f00..7d6643dd1 100644 --- a/cookbooks/db/recipes/master.rb +++ b/cookbooks/db/recipes/master.rb @@ -64,7 +64,7 @@ end postgresql_user "munin" do cluster node[:db][:cluster] - password passwords["munin"] + action :drop end postgresql_user "replication" do diff --git a/cookbooks/dev/recipes/default.rb b/cookbooks/dev/recipes/default.rb index d33534491..ebb90accf 100644 --- a/cookbooks/dev/recipes/default.rb +++ b/cookbooks/dev/recipes/default.rb @@ -571,13 +571,6 @@ if node[:postgresql][:clusters][:"15/main"] apache_site "apis.dev.openstreetmap.org" do template "apache.apis.erb" end - - node[:postgresql][:clusters].each_key do |name| - postgresql_munin name do - cluster name - database "ALL" - end - end end directory "/srv/ooc.openstreetmap.org" do diff --git a/cookbooks/exim/recipes/default.rb b/cookbooks/exim/recipes/default.rb index ced5a9196..00c3be082 100644 --- a/cookbooks/exim/recipes/default.rb +++ b/cookbooks/exim/recipes/default.rb @@ -225,9 +225,6 @@ template "/etc/mail.rc" do mode "644" end -munin_plugin "exim_mailqueue" -munin_plugin "exim_mailstats" - prometheus_exporter "exim" do port 9636 user "Debian-exim" diff --git a/cookbooks/fail2ban/recipes/default.rb b/cookbooks/fail2ban/recipes/default.rb index 060251680..ca0a419c3 100644 --- a/cookbooks/fail2ban/recipes/default.rb +++ b/cookbooks/fail2ban/recipes/default.rb @@ -52,8 +52,6 @@ service "fail2ban" do action [:enable, :start] end -munin_plugin "fail2ban" - prometheus_exporter "fail2ban" do port 9635 user "root" diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 4e676f387..fa6cb6cc8 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -445,38 +445,21 @@ disks = disks.map do |disk| if controller && controller[:device] device = controller[:device].sub("/dev/", "") smart = disk[:smart_device] - - if device.start_with?("cciss/") && smart =~ /^cciss,(\d+)$/ - array = node[:hardware][:disk][:arrays][disk[:arrays].first] - munin = "cciss-3#{array[:wwn]}-#{Regexp.last_match(1)}" - elsif smart =~ /^.*,(\d+)$/ - munin = "#{device}-#{Regexp.last_match(1)}" - elsif smart =~ %r{^.*,(\d+)/(\d+)$} - munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}" - end elsif disk[:device] device = disk[:device].sub("/dev/", "") smart = disk[:smart_device] - - if smart =~ /^.*,(\d+),(\d+),(\d+)$/ - munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}:#{Regexp.last_match(3)}" - end end elsif disk[:device] =~ %r{^/dev/(nvme\d+)n\d+$} device = Regexp.last_match(1) - munin = device elsif disk[:device] device = disk[:device].sub("/dev/", "") - munin = device end - next if device.nil? || munin.nil? + next if device.nil? Hash[ :device => device, - :smart => smart, - :munin => munin, - :hddtemp => munin.tr("-:", "_") + :smart => smart ] end @@ -536,48 +519,12 @@ if disks.count.positive? private_users false protect_clock false end - - # Don't try and do munin monitoring of disks behind - # an Areca controller as they only allow one thing to - # talk to the controller at a time and smartd will - # throw errors if it clashes with munin - disks = disks.reject { |disk| disk[:smart]&.start_with?("areca,") } - - disks.each do |disk| - munin_plugin "smart_#{disk[:munin]}" do - target "smart_" - conf "munin.smart.erb" - conf_variables :disk => disk - end - end else service "smartd" do action [:stop, :disable] end end -if disks.count.positive? - munin_plugin "hddtemp_smartctl" do - conf "munin.hddtemp.erb" - conf_variables :disks => disks - end -else - munin_plugin "hddtemp_smartctl" do - action :delete - conf "munin.hddtemp.erb" - end -end - -plugins = Dir.glob("/etc/munin/plugins/smart_*").map { |p| File.basename(p) } - - disks.map { |d| "smart_#{d[:munin]}" } - -plugins.each do |plugin| - munin_plugin plugin do - action :delete - conf "munin.smart.erb" - end -end - if File.exist?("/etc/mdadm/mdadm.conf") mdadm_conf = edit_file "/etc/mdadm/mdadm.conf" do |line| line.gsub!(/^MAILADDR .*$/, "MAILADDR admins@openstreetmap.org") diff --git a/cookbooks/hardware/templates/default/munin.hddtemp.erb b/cookbooks/hardware/templates/default/munin.hddtemp.erb deleted file mode 100644 index 9d5e4958e..000000000 --- a/cookbooks/hardware/templates/default/munin.hddtemp.erb +++ /dev/null @@ -1,10 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[hddtemp_smartctl] -env.drives <%= @disks.map { |d| d[:hddtemp] }.sort.join(" ") %> -<% @disks.sort_by { |d| d[:hddtemp] }.each do |disk| -%> -<% if disk[:smart] -%> -env.type_<%= disk[:hddtemp] %> <%= disk[:smart] %> -<% end -%> -env.dev_<%= disk[:hddtemp] %> <%= disk[:device] %> -<% end -%> diff --git a/cookbooks/hardware/templates/default/munin.smart.erb b/cookbooks/hardware/templates/default/munin.smart.erb deleted file mode 100644 index 1908f8e93..000000000 --- a/cookbooks/hardware/templates/default/munin.smart.erb +++ /dev/null @@ -1,9 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[smart_<%= @disk[:munin] %>] -<% if @disk[:smart] -%> -env.smartargs -H -d <%= @disk[:smart] %> -<% else -%> -env.smartargs -H -<% end -%> -env.ignoreexit 4 diff --git a/cookbooks/memcached/recipes/default.rb b/cookbooks/memcached/recipes/default.rb index 56916ec9e..b178016ad 100644 --- a/cookbooks/memcached/recipes/default.rb +++ b/cookbooks/memcached/recipes/default.rb @@ -35,16 +35,6 @@ template "/etc/memcached.conf" do notifies :restart, "service[memcached]" end -munin_plugin_conf "memcached_multi" do - template "munin.erb" -end - -%w[bytes commands conns evictions items memory].each do |stat| - munin_plugin "memcached_multi_#{stat}" do - target "memcached_multi_" - end -end - prometheus_exporter "memcached" do port 9150 options "--memcached.address=#{node[:memcached][:ip_address]}:#{node[:memcached][:tcp_port]} --memcached.pid-file=/run/memcached/memcached.pid" diff --git a/cookbooks/memcached/templates/default/munin.erb b/cookbooks/memcached/templates/default/munin.erb deleted file mode 100644 index 40d434889..000000000 --- a/cookbooks/memcached/templates/default/munin.erb +++ /dev/null @@ -1,6 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[memcached_multi_*] -user nobody -env.host <%= node[:memcached][:ip_address] %> -env.port <%= node[:memcached][:tcp_port] %> diff --git a/cookbooks/munin/files/default/plugin-conf.d/api b/cookbooks/munin/files/default/plugin-conf.d/api deleted file mode 100644 index 614696eb9..000000000 --- a/cookbooks/munin/files/default/plugin-conf.d/api +++ /dev/null @@ -1,2 +0,0 @@ -[api_calls_num] -user root diff --git a/cookbooks/munin/files/default/plugin-conf.d/chef b/cookbooks/munin/files/default/plugin-conf.d/chef deleted file mode 100644 index 33beeccbc..000000000 --- a/cookbooks/munin/files/default/plugin-conf.d/chef +++ /dev/null @@ -1,2 +0,0 @@ -[chef_*] -user chefrepo diff --git a/cookbooks/munin/files/default/plugin-conf.d/hpasmcli2 b/cookbooks/munin/files/default/plugin-conf.d/hpasmcli2 deleted file mode 100644 index d7673cd84..000000000 --- a/cookbooks/munin/files/default/plugin-conf.d/hpasmcli2 +++ /dev/null @@ -1,2 +0,0 @@ -[hpasmcli2_*] -user root diff --git a/cookbooks/munin/files/default/plugins/api_calls_ b/cookbooks/munin/files/default/plugins/api_calls_ deleted file mode 100755 index 4eae910dd..000000000 --- a/cookbooks/munin/files/default/plugins/api_calls_ +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/ruby - -require "rubygems" -require "date" -require "hpricot" -require "open-uri" - -def uris_from_status(server) - file = open("http://#{server}/server-status").read - doc = Hpricot.parse(file) - tables = doc / "table" - rows = (tables[1] / "tr")[1..-1] - data = rows.collect { |r| (r / "td").collect(&:inner_html) } - # filter where the PID is numeric, status is 'W' and host matches the server - matching_data = data.select { |r| r[1].to_i.positive? && r[3].match(/W/) && r[12].match(server) } - # return only the URI part - matching_data.collect { |r| r[13] } -end - -CALL_TYPES = { - :map => "Map API calls", - :upload => "Changeset diff uploads", - :amf => "AMF API calls", - :history => "Element history fetches", - :full => "Full element fetches", - :trkpts => "GPX trackpoints calls", - :web => "Web site traffic", - :other => "Other API calls" -}.freeze - -def categorise_uri(line) - uri = line.split(" ")[1] - - case uri - when %r{api/0\.6/map} then :map - when %r{api/0\.6/changeset/[0-9]*/upload} then :upload - when %r{api/0\.6/amf} then :amf - when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history - when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full - when %r{api/0\.6/trackpoints} then :trkpts - when %r{api/0\.6/} then :other - else :web - end -end - -server = $PROGRAM_NAME.match("api_calls_(.*)")[1] - -if ARGV[0] == "config" - puts "graph_title Active requests" - puts "graph_vlabel Number of requests" - puts "graph_category api" - CALL_TYPES.each { |k, v| puts "#{k}.label #{v}" } - -else - counts = uris_from_status(server) - .collect { |x| categorise_uri(x) } - .each_with_object({}) do |e, h| - if h.key? e - h[e] += 1 - else - h[e] = 1 - end - end - - CALL_TYPES.each_key do |type| - count = counts[type] || 0 - puts "#{type}.value #{count}" - end -end diff --git a/cookbooks/munin/files/default/plugins/api_calls_num b/cookbooks/munin/files/default/plugins/api_calls_num deleted file mode 100755 index e776505d2..000000000 --- a/cookbooks/munin/files/default/plugins/api_calls_num +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/ruby - -require "json" - -CALL_TYPES = { - :map => "Map API calls", - :upload => "Changeset diff uploads", - :amf => "AMF API calls", - :history => "Element history fetches", - :full => "Full element fetches", - :trkpts => "GPX trackpoints calls", - :web => "Web site traffic", - :other => "Other API calls" -}.freeze - -if ARGV[0] == "config" - puts "graph_title Requests processed" - puts "graph_args --base 1000" - puts "graph_vlabel Number of requests per ${graph_period}" - puts "graph_category api" - - CALL_TYPES.each do |type, label| - puts "#{type}.label #{label}" - puts "#{type}.type DERIVE" - puts "#{type}.min 0" - end -else - statistics = JSON.parse(File.read("/srv/www.openstreetmap.org/rails/tmp/statistics.json")) - - CALL_TYPES.each_key do |type| - count = statistics["uri"][type.to_s] || 0 - puts "#{type}.value #{count}" - end -end diff --git a/cookbooks/munin/files/default/plugins/api_calls_status b/cookbooks/munin/files/default/plugins/api_calls_status deleted file mode 100755 index 4a9623f9b..000000000 --- a/cookbooks/munin/files/default/plugins/api_calls_status +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/ruby - -require "json" - -HTTP_STATUSES = { - "200" => "OK", - "206" => "Partial Content", - "301" => "Moved Permanently", - "302" => "Found", - "303" => "See Other", - "304" => "Not Modified", - "400" => "Bad Request", - "401" => "Unauthorized", - "403" => "Forbidden", - "404" => "Not Found", - "405" => "Method Not Allowed", - "408" => "Request Timeout", - "409" => "Conflict", - "410" => "Gone", - "412" => "Precondition Failed", - "416" => "Requested Range Not Satisfiable", - "422" => "Unprocessable Entity", - "500" => "Internal Server Error", - "502" => "Bad Gateway", - "503" => "Service Unavailable", - "509" => "Bandwidth Limit Exceeded" -}.freeze - -if ARGV[0] == "config" - puts "graph_title HTTP response codes" - puts "graph_args --base 1000" - puts "graph_vlabel Number of requests per ${graph_period}" - puts "graph_category api" - - HTTP_STATUSES.each do |code, label| - puts "http#{code}.label #{code} #{label}" - puts "http#{code}.type DERIVE" - puts "http#{code}.min 0" - end -else - statistics = JSON.parse(File.read("/srv/www.openstreetmap.org/rails/tmp/statistics.json")) - - HTTP_STATUSES.each_key do |code| - count = statistics["status"][code] || 0 - puts "http#{code}.value #{count}" - end -end diff --git a/cookbooks/munin/files/default/plugins/api_waits_ b/cookbooks/munin/files/default/plugins/api_waits_ deleted file mode 100755 index 3d511ec8c..000000000 --- a/cookbooks/munin/files/default/plugins/api_waits_ +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/ruby - -require "rubygems" -require "date" -require "hpricot" -require "open-uri" - -def uri_and_times_from_status(server) - file = open("http://#{server}/server-status").read - doc = Hpricot.parse(file) - tables = doc / "table" - rows = (tables[1] / "tr")[1..-1] - data = rows.collect { |r| (r / "td").collect(&:inner_html) } - # filter where the PID is numeric, status is 'W' and host matches the server - matching_data = data.select { |r| r[1].to_i.positive? && r[3].match(/W/) && r[12].match(server) } - # return URI and number of seconds processing for each request - matching_data.collect { |r| [r[13], r[5].to_i] } -end - -CALL_TYPES = { - :map => "Map API calls", - :upload => "Changeset diff uploads", - :amf => "AMF API calls", - :history => "Element history fetches", - :full => "Full element fetches", - :trkpts => "GPX trackpoints calls", - :web => "Web site traffic", - :other => "Other API calls" -}.freeze - -def categorise_uri(line) - uri = line.split(" ")[1] - - case uri - when %r{api/0\.6/map} then :map - when %r{api/0\.6/changeset/[0-9]*/upload/} then :upload - when %r{api/0\.6/amf} then :amf - when %r{api/0\.6/(node|way|relation)/[0-9]*/history} then :history - when %r{api/0\.6/(node|way|relation)/[0-9]*/full} then :full - when %r{api/0\.6/trackpoints} then :trkpts - when %r{api/0\.6/} then :other - else :web - end -end - -server = $PROGRAM_NAME.match("api_waits_(.*)")[1] - -if ARGV[0] == "config" - puts "graph_title Wait times for active requests" - puts "graph_vlabel Average time of requests" - puts "graph_category api" - CALL_TYPES.each { |k, v| puts "#{k}.label #{v}" } - -else - counts = uri_and_times_from_status(server) - .collect { |x, y| [categorise_uri(x), y] } - .each_with_object({}) do |e, h| - category, time = e - if h.key? category - h[category] += [time] - else - h[category] = [time] - end - end - - CALL_TYPES.each_key do |type| - count = counts[type] || [0] - avg = count.inject(0) { |acc, elem| acc + elem } / (1.0 * count.length) - puts "#{type}.value #{avg}" - end -end diff --git a/cookbooks/munin/files/default/plugins/chef_status b/cookbooks/munin/files/default/plugins/chef_status deleted file mode 100755 index 6680c4aa0..000000000 --- a/cookbooks/munin/files/default/plugins/chef_status +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/ruby - -require "json" - -nodes = JSON.parse(IO.popen(["/opt/chef/embedded/bin/knife", "status", "-c", "/var/lib/chef/.chef/knife.rb", "-F", "json"]).read).sort_by { |node| node["name"] } - -if ARGV[0] == "config" - puts "graph_title Chef node status" - puts "graph_args --base 1000 --logarithmic" - puts "graph_vlabel Time since last checkin" - puts "graph_category chef" - - nodes.each do |node| - name = node["name"].split(".").first - - puts "#{name}.label #{name}" - puts "#{name}.type GAUGE" - puts "#{name}.min 0" - puts "#{name}.warning 14400" - puts "#{name}.critical 43200" - end -else - nodes.each do |node| - name = node["name"].split(".").first - time = Time.now.to_f - node["ohai_time"] - - puts "#{name}.value #{time}" - end -end diff --git a/cookbooks/munin/files/default/plugins/chrony b/cookbooks/munin/files/default/plugins/chrony deleted file mode 100755 index 314860f64..000000000 --- a/cookbooks/munin/files/default/plugins/chrony +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -: <<=cut - -=head1 NAME - -parse Chrony Tracking output for timeserver status information - -=head1 APPLICABLE SYSTEMS - -Any system with a local chronyd service. - -=head1 CONFIGURATION - -No configuration. - -=head1 MAGIC MARKERS - - #%# family=auto - #%# capabilities=autoconf - -=head1 VERSION - -Revision 0.1 2008/08/23 13:06:00 joti - - First version only chronyc tracking, autodetection included. - -Revision 0.2 2008/10/11 16:09:00 joti - - Added scaling of other values to match with frequency, added more description to fields - -Revision 0.3 2014/02/16 zjttoefs - - reduce forking by using awk - do not limit output precision - add stratum monitoring - detect slow/fast time or freqency and adjust sign of value accordingly - remove commented out code - -Revision 0.4 2016/11/10 Lars Kruse - - rewrite field handling - use "which" for "chronyc" location - switch from "bash" to "sh" - fix exit code of failing "autoconf" - -=head1 AUTHOR - - joti - zjttoefs - Lars Kruse - -=cut - -CHRONYC="$(which chronyc | head -1)" - -# Frequency has extremely higher values than other. Therefore they are fitted by scaling via suitable factors. -# field definitions: -# - munin fieldname -# - factor for graph visualization (all values are supposed to reach a similar dimension) -# - regular expression of the chrony output line (may not contain whitespace, case insensitive) -# - label (may include "%d" for including the factor; may contain whitespace) -fields="stratum 1 ^Stratum Stratum - systime 1000 ^System.time System Time (x%d) - frequency 1 ^Frequency Frequency (ppm) - residualfreq 100 ^Residual.freq Residual Freq (ppm, x%d) - skew 100 ^Skew Skew (ppm, x%d) - rootdelay 1000 ^Root.delay Root delay (seconds, x%d) - rootdispersion 1000 ^Root.dispersion Root dispersion (seconds, x%d)" - -# chrony example output (v2.4.1): -# Reference ID : 131.188.3.221 (ntp1.rrze.uni-erlangen.de) -# Stratum : 2 -# Ref time (UTC) : Thu Nov 10 22:39:50 2016 -# System time : 0.000503798 seconds slow of NTP time -# Last offset : +0.000254355 seconds -# RMS offset : 0.002186779 seconds -# Frequency : 17.716 ppm slow -# Residual freq : +0.066 ppm -# Skew : 4.035 ppm -# Root delay : 0.042980 seconds -# Root dispersion : 0.005391 seconds -# Update interval : 258.4 seconds -# Leap status : Normal - - -if [ "$1" = "autoconf" ]; then - if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then - echo yes - else - echo "no (missing 'chronyc' executable)" - fi - exit 0 -fi - -if [ "$1" = "config" ]; then - echo 'graph_title Chrony Tracking Stats' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel (seconds,ppm)' - echo 'graph_category time' - echo "$fields" | while read fieldname factor regex label; do - # insert the factor, if "%d" is part of the label - printf "${fieldname}.label $label\n" "$factor" - echo "${fieldname}.type GAUGE" - done - exit 0 -fi - -chrony_status="$("$CHRONYC" tracking)" -echo "$fields" | while read fieldname factor regex label; do - status_line="$(echo "$chrony_status" | grep -i -- "$regex " | cut -d ":" -f 2-)" - if [ -z "$status_line" ]; then - value="U" - else - # the keyword "slow" indicates negative values - value="$(echo "$status_line" | awk '{ /slow/ ? SIGN=-1 : SIGN=1; print $1 * SIGN * '"$factor"' }')" - fi - echo "${fieldname}.value $value" -done diff --git a/cookbooks/munin/files/default/plugins/fw_conntrack b/cookbooks/munin/files/default/plugins/fw_conntrack deleted file mode 100755 index c575dd8cc..000000000 --- a/cookbooks/munin/files/default/plugins/fw_conntrack +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -fw_conntrack - Plugin to monitor the number of tracked connections -through a Linux 2.4/2.6 firewall - -=head1 CONFIGURATION - -This plugin must run with root privileges - -=head2 CONFIGURATION EXAMPLE - -/etc/munin/plugin-conf.d/global or other file in that dir must contain: - - [fw_*] - user root - -=head1 NOTES - -ESTABLISHED+FIN_WAIT+TIME_WAIT+SYN_SENT+UDP are the most interesting -connections. - -The total list also includes SYN_RECV, CLOSE, CLOSE_WAIT, LAST_ACK and -LISTEN, but these were not (often) observed on my firewall. - -TOTAL is the total number of tracked connections. - -ASSURED and UNREPLIED connections are complimentary subsets of -ESTABLISHED. - -ASSURED is after ACK is seen after SYN_RECV. Therefore ASSURED is -plotted but not UNREPLIED. - -Note that the plugin depends on the netfilter "conntrack" userspace tool. -It comes from http://conntrack-tools.netfilter.org/ - -=head1 AUTHORS - -=over - -=item 2004.05.05: Initial version by Nicolai Langfeldt, Linpro AS, Oslo, Norway - -=item 2004.05.06: Enhanced to count NATed connections after input from Xavier on munin-users list - -=item 2011.09.23: Perl version by Alex Tomlins - -=back - -=head1 LICENSE - -GPL - -=head1 MAGIC MARKERS - - #%# family=auto - #%# capabilities=autoconf - -=cut - -use strict; -use Munin::Plugin; - -my $conntrack = '/usr/sbin/conntrack'; -my $nf_conntrack_file = '/proc/net/nf_conntrack'; -my $ip_conntrack_file = '/proc/net/ip_conntrack'; -my @conntrack_max_files = qw( - /proc/sys/net/nf_conntrack_max - /proc/sys/net/netfilter/nf_conntrack_max - /proc/sys/net/ipv4/ip_conntrack_max - /proc/sys/net/ipv4/netfilter/ip_conntrack_max -); - -if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) { - if ( -x $conntrack or -r $nf_conntrack_file or -r $ip_conntrack_file) { - print "yes\n"; - } else { - print "no\n"; - } - exit 0; -} - -if ( defined($ARGV[0]) and $ARGV[0] eq "config" ) { - print < 0, - 'FIN_WAIT' => 0, - 'TIME_WAIT' => 0, - 'SYN_SENT' => 0, - 'UDP' => 0, - 'ASSURED' => 0, - 'NATTED' => 0, - 'TOTAL' => 0 -); -open CMD, "$command|"; -while () { - $state{'TOTAL'} ++; - $state{'UDP'} ++ if /udp /; - $state{'ASSURED'} ++ if /ASSURED/; - if (/tcp \s*\d+\s+\d+\s+(\S+)/) { - $state{$1} ++; - } - if (/src=(\S+)\s+dst=(\S+)\s+sport.*src=(\S+)\s+dst=(\S+)/) { - $state{'NATTED'} ++ if $1 ne $4 or $2 ne $3; - } -} -close CMD; - -print "established.value $state{'ESTABLISHED'}\n"; -print "fin_wait.value $state{'FIN_WAIT'}\n"; -print "time_wait.value $state{'TIME_WAIT'}\n"; -print "syn_sent.value $state{'SYN_SENT'}\n"; -print "udp.value $state{'UDP'}\n"; -print "assured.value $state{'ASSURED'}\n"; -print "nated.value $state{'NATTED'}\n"; -print "total.value $state{'TOTAL'}\n"; diff --git a/cookbooks/munin/files/default/plugins/fw_forwarded_local b/cookbooks/munin/files/default/plugins/fw_forwarded_local deleted file mode 100755 index f081d3668..000000000 --- a/cookbooks/munin/files/default/plugins/fw_forwarded_local +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -fw_forwarded_local - Plugin to monitor network connections. - -=head1 CONFIGURATION - -This plugin must run with root privileges - -=head2 CONFIGURATION EXAMPLE - -/etc/munin/plugin-conf.d/global or other file in that dir must contain: - - [fw_*] - user root - -=head1 NOTES - -=over - -=item * forward: number of connections forwarded - -=item * local: number of connections for the host itself - -=back - -=head1 AUTHORS - -2011.09.23: Perl version by Alex Tomlins - -=head1 MAGIC MARKERS - - #%# family=auto - #%# capabilities=autoconf - -=cut - -use strict; -use Munin::Plugin; - -my $conntrack = '/usr/sbin/conntrack'; -my $nf_conntrack_file = '/proc/net/nf_conntrack'; -my $ip_conntrack_file = '/proc/net/ip_conntrack'; - -if ( defined($ARGV[0]) and $ARGV[0] eq "autoconf" ) { - if ( -x $conntrack or -r $nf_conntrack_file or -r $ip_conntrack_file) { - print "yes\n"; - } else { - print "no\n"; - } - exit 0; -} - -if ( defined($ARGV[0]) and $ARGV[0] eq "config" ) { - print "graph_title ipconntrack\n"; - print "graph_args -l 0 --base 1000\n"; - print "graph_vlabel established connections\n"; - print "graph_category network\n"; - print "forward.label forward\n"; - print "forward.type GAUGE\n"; - print "local.label local\n"; - print "local.type GAUGE\n"; - exit 0; -} - -my $command; -if ( -x $conntrack) { - $command = "$conntrack -L -o extended 2>/dev/null"; -} elsif ( -r $nf_conntrack_file ) { - $command = "cat $nf_conntrack_file"; -} elsif (-r $ip_conntrack_file ) { - $command = "cat $ip_conntrack_file"; -} else { - die "Can't find conntrack information\n"; -} - -my $local = 0; -my $forward = 0; -open CMD, "$command|"; -while () { - if (/ESTABLISHED\s+src=(\S+)\s+dst=(\S+)\s+sport.*src=(\S+)\s+dst=(\S+)/) { - if ($1 eq $4) { - $local++; - } else { - $forward++; - } - } -} -close CMD; - -print "forward.value $forward\n"; -print "local.value $local\n" diff --git a/cookbooks/munin/files/default/plugins/hpasmcli2_ b/cookbooks/munin/files/default/plugins/hpasmcli2_ deleted file mode 100755 index 216999862..000000000 --- a/cookbooks/munin/files/default/plugins/hpasmcli2_ +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env perl -# -# Plugin to monitor Proliant server health status using hpasmcli. -# -# Config variables: -# user root -- requrired by hpasmcli -# env.hpasmcli -- path to hpasmcli executable (optional) -# env.degree -- Unit of temperatures (C or F / default value is C) -# -# -# Author: Tsuyoshi Wada -# -# v1.0 2007/12/08 - First version -# -# Copyright (c) 2007 Tsuyoshi Wada -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Magic markers -#%# family=contrib -#%# capabilities=autoconf suggest - -use strict; - -my $hpasmcli = exists $ENV{hpasmcli} ? $ENV{hpasmcli} : undef; -$hpasmcli = `which hpasmcli` unless $hpasmcli; -chomp $hpasmcli; -$hpasmcli = undef unless -x $hpasmcli; -my @dirs = qw(/usr/bin /usr/sbin /usr/local/bin /usr/local/sbin); -until ($hpasmcli or @dirs == 0) { - my $dir = shift @dirs; - my $path = $dir.'/hpasmcli'; - $hpasmcli = $path if -x $path; -} -my $degree = exists $ENV{degree} ? $ENV{degree} : 'C'; -my $deg_name = $degree eq 'C' ? "Celsius": "Fahrenheit"; - -if (defined($ARGV[0])) { - if ($ARGV[0] eq 'autoconf') { - if ($hpasmcli and -x $hpasmcli) { - my @chk_result = `$hpasmcli -s \"help\"`; - if ($? eq "0") { - print "yes\n"; - exit 0; - } else { - my $reason = 'Unknown error'; - foreach my $line (@chk_result) { - if ($line =~ /^ERROR/i) { - chomp($line); - $reason = $line; - last; - } - } - print "no ($reason)\n"; - exit 1; - } - } else { - print "no (hpasmcli not found)\n"; - exit 1; - } - } elsif ($ARGV[0] eq 'suggest') { - print "temp\nfans\n"; - exit 0; - } -} - -$0 =~ /hpasmcli2_(.+)*$/; -my $show_target = $1; -my @show_result = `$hpasmcli -s \"show $show_target\"`; -my %output; - -if (defined($show_target) and $show_target eq 'temp') { - foreach my $line (@show_result) { - if ($line =~ /^#/) { - $line =~ s/\s+/ /g; - $line =~ s/^\s//g; - my ($sensor, $loc, $temp, $threshold) = split(/\s/, $line); - next if ($temp eq "-"); - $loc =~ s/\/|#//g; - $temp = $degree eq 'C' ? (split(/\//, $temp))[0] : (split(/\//, $temp))[1]; - $temp =~ s/C|F//g; - $threshold = $degree eq 'C' ? (split(/\//, $threshold))[0] : (split(/\//, $threshold))[1]; - $threshold =~ s/C|F//g; - $sensor =~s/#//g; - $output{$sensor} = { - 'location' => lc($loc), - 'temp' => $temp, - 'threshold' => $threshold - }; - } - } - if (defined($ARGV[0]) and $ARGV[0] eq 'config') { - print "graph_title hpasm: Temperature\n"; - print "graph_args --base 1000 -l 0\n"; - print "graph_vlabel Degrees in $deg_name\n"; - print "graph_category sensors\n"; - print "graph_info This graph shows the temperatures as reported by hpasmcli.\n"; - foreach my $key (sort keys %output) { - print "temp$key.label $output{$key}->{'location'}\n"; - print "temp$key.warning " . ($output{$key}->{'threshold'} * 0.85) . "\n"; - print "temp$key.critical $output{$key}->{'threshold'}\n"; - } - } else { - foreach my $key (sort keys %output) { - print "temp$key.value $output{$key}->{'temp'}\n"; - } - } -} elsif (defined($show_target) and $show_target eq 'fans') { - foreach my $line (@show_result) { - if ($line =~ /^#/) { - $line =~ s/\s+/ /g; - $line =~ s/^\s//g; - my ($fan, $loc, $present, $speed, $rate, $redundant, $partner, $pluggable) = split(/\s/, $line); - next if ($present ne "Yes"); - $loc =~ s/\/|#//g; - $rate =~ s/\%//g; - my $threshold = '100'; - $fan =~s/#//g; - $output{$fan} = { - 'location' => lc($loc), - 'rate' => $rate, - 'threshold' => $threshold - }; - } - } - if (defined($ARGV[0]) and $ARGV[0] eq 'config') { - print "graph_title hpasm: Fans\n"; - print "graph_args --base 1000 -l 0\n"; - print "graph_vlabel of max (%)\n"; - print "graph_category sensors\n"; - print "graph_info This graph shows the info of fans as reported by hpasmcli.\n"; - foreach my $key (sort keys %output) { - print "fan$key.label FAN$key $output{$key}->{'location'}\n"; - print "fan$key.warning " . ($output{$key}->{'threshold'} * 0.75) . "\n"; - print "fan$key.critical $output{$key}->{'threshold'}\n"; - } - } else { - foreach my $key (sort keys %output) { - print "fan$key.value $output{$key}->{'rate'}\n"; - } - } -} else { - die "Unknown target specified ($show_target)\n"; -} - -exit 0; diff --git a/cookbooks/munin/files/default/plugins/memcached_ b/cookbooks/munin/files/default/plugins/memcached_ deleted file mode 100755 index 5838cda2a..000000000 --- a/cookbooks/munin/files/default/plugins/memcached_ +++ /dev/null @@ -1,486 +0,0 @@ -#!/usr/bin/perl -# - -=head1 MEMCACHED - -Memcached - A Plugin to monitor Memcached Servers - -=head1 MUNIN CONFIGURATION - -[memcached_*] - env.host 127.0.0.1 *default* - env.port 11211 *default* - -=head2 MUNIN ENVIRONMENT CONFIGURATION EXPLANATION - - host = host we are going to monitor - port = port we are connecting to, in order to gather stats - -=head1 NODE CONFIGURATION - -Please make sure you can telnet to your memcache servers and issue the - following commands: stats - -Available Graphs contained in this Plugin - -bytes => This graphs the current network traffic in and out - -commands => This graphs the current commands being issued to the memcache machine. - -conns => This graphs the current, max connections as well as avg conns per sec avg conns per sec is derived from total_conns / uptime. - -evictions => This graphs the current evictions on the node. - -items => This graphs the current items and total items in the memcached node. - -memory => This graphs the current and max memory allocation. - -The following example holds true for all graphing options in this plugin. - Example: ln -s /usr/share/munin/plugins/memcached_ /etc/munin/plugins/memcached_bytes - -=head1 ACKNOWLEDGEMENTS - -Thanks to dormando for putting up with me ;) - -=head1 AUTHOR - -Matt West < https://github.com/mhwest13/Memcached-Munin-Plugin > - -=head1 LICENSE - -GPLv2 - -=head1 MAGIC MARKERS - -#%# family=auto -#%# capabilities=autoconf suggest - -=cut - -use strict; -use IO::Socket; - -my $host = $ENV{host} || "127.0.0.1"; -my $port = $ENV{port} || 11211; -my $connection; - -my %stats; - -# This hash contains the information contained in two memcache commands -# stats and stats settings. - -# So I was trying to figure out how to build this up, and looking at some good examples -# I decided to use the format, or for the most part, the format from the mysql_ munin plugin -# for Innodb by Kjell-Magne Ãierud, it just spoke ease of flexibility especially with multigraphs -# thanks btw ;) -# -# %graphs is a container for all of the graph definition information. In here is where you'll -# find the configuration information for munin's graphing procedure. -# Format: -# -# $graph{graph_name} => { -# config => { -# # You'll find keys and values stored here for graph manipulation -# }, -# datasrc => [ -# # Name: name given to data value -# # Attr: Attribute for given value -# { name => 'Name', (Attr) }, -# { ... }, -# ], -# } -my %graphs; - -$graphs{items} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Items in Memcached', - category => 'memcached', - title => 'Items', - info => 'This graph shows the number of items in use by memcached', - }, - datasrc => [ - { name => 'curr_items', label => 'Current Items', min => '0' }, - { - name => 'total_items', - label => 'New Items', - min => '0', - type => 'DERIVE' - }, - ], -}; - -$graphs{memory} = { - config => { - args => '--base 1024 --lower-limit 0', - vlabel => 'Bytes Used', - category => 'memcached', - title => 'Memory Usage', - info => 'This graph shows the memory consumption of memcached', - }, - datasrc => [ - { - name => 'limit_maxbytes', - draw => 'AREA', - label => 'Maximum Bytes Allocated', - min => '0' - }, - { - name => 'bytes', - draw => 'AREA', - label => 'Current Bytes Used', - min => '0' - }, - ], -}; - -$graphs{bytes} = { - config => { - args => '--base 1000', - vlabel => 'bits in (-) / out (+)', - title => 'Network Traffic', - category => 'memcached', - info => -'This graph shows the network traffic in (-) / out (+) of the machine', - order => 'bytes_read bytes_written', - }, - datasrc => [ - { - name => 'bytes_read', - type => 'DERIVE', - label => 'Network Traffic coming in (-)', - graph => 'no', - cdef => 'bytes_read,8,*', - min => '0' - }, - { - name => 'bytes_written', - type => 'DERIVE', - label => 'Traffic in (-) / out (+)', - negative => 'bytes_read', - cdef => 'bytes_written,8,*', - min => '0' - }, - ], -}; - -$graphs{conns} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Connections per ${graph_period}', - category => 'memcached', - title => 'Connections', - info => -'This graph shows the number of connections being handled by memcached', - order => 'curr_conns avg_conns', - }, - datasrc => [ - { name => 'curr_conns', label => 'Current Connections', min => '0' }, - { name => 'avg_conns', label => 'Avg Connections', min => '0' }, - ], -}; - -$graphs{commands} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Commands per ${graph_period}', - category => 'memcached', - title => 'Commands', - info => - 'This graph shows the number of commands being handled by memcached', - }, - datasrc => [ - { - name => 'cmd_get', - type => 'DERIVE', - label => 'Gets', - info => 'Cumulative number of retrieval reqs', - min => '0' - }, - { - name => 'cmd_set', - type => 'DERIVE', - label => 'Sets', - info => 'Cumulative number of storage reqs', - min => '0' - }, - { - name => 'get_hits', - type => 'DERIVE', - label => 'Get Hits', - info => 'Number of keys that were requested and found', - min => '0' - }, - { - name => 'get_misses', - type => 'DERIVE', - label => 'Get Misses', - info => 'Number of keys there were requested and not found', - min => '0' - }, - ], -}; - -$graphs{evictions} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Evictions per ${graph_period}', - category => 'memcached', - title => 'Evictions', - info => 'This graph shows the number of evictions per second', - }, - datasrc => [ - { - name => 'evictions', - label => 'Evictions', - info => 'Cumulative Evictions Across All Slabs', - type => 'DERIVE', - min => '0' - }, - ], -}; - -## -#### Config Check #### -## - -if ( defined $ARGV[0] && $ARGV[0] eq 'config' ) { - - $0 =~ /(?:([^\/]+)_)?memcached_(.+)$/; - my $prefix = $1 ? $1 : ''; - my $plugin = $2; - - die 'Unknown Plugin Specified: ' . ( $plugin ? $plugin : '' ) - unless $graphs{$plugin}; - -# We need to fetch the stats before we do any config, cause its needed for multigraph - fetch_stats(); - - # Now lets go ahead and print out our config. - do_config( $prefix, $plugin ); - exit 0; -} - -## -#### Autoconf Check #### -## - -if ( defined $ARGV[0] && $ARGV[0] eq 'autoconf' ) { - - # Lets attempt to connect to memcached - my $s = get_conn(); - - # Lets check that we did connect to memcached - if ( defined($s) ) { - print "yes\n"; - exit 0; - } - else { - print "no (unable to connect to $connection)\n"; - exit 0; - } -} - -## -#### Suggest Check #### -## - -if ( defined $ARGV[0] && $ARGV[0] eq 'suggest' ) { - - # Lets attempt to connect to memcached - my $s = get_conn(); - - # Lets check that we did connect to memcached - if ( defined($s) ) { - my @rootplugins = - ( 'bytes', 'conns', 'commands', 'evictions', 'items', 'memory' ); - foreach my $plugin (@rootplugins) { - print "$plugin\n"; - } - exit 0; - } - else { - print "no (unable to connect to $connection)\n"; - exit 0; - } -} - -## -#### Well We aren't running (auto)config/suggest so lets print some stats #### -## - -fetch_output(); - -## -#### Subroutines for printing info gathered from memcached #### -## - -## -#### This subroutine performs the bulk processing for printing statistics. -## - -sub fetch_output { - - $0 =~ /(?:([^\/]+)_)?memcached_(.+)$/; - my $prefix = $1 ? $1 : ''; - my $plugin = $2; - - die 'Unknown Plugin Specified: ' . ( $plugin ? $plugin : '' ) - unless $graphs{$plugin}; - - # Well we need to actually fetch the stats before we do anything to them. - fetch_stats(); - - # Now lets go ahead and print out our output. - print_root_output($plugin); - - return; -} - -## -#### This subroutine is for the root non-multigraph graphs which render on the main node page #### -## - -sub print_root_output { - my ($plugin) = (@_); - - my $graph = $graphs{$plugin}; - - #print "graph memcached_$plugin\n"; - - if ( $plugin ne 'conns' ) { - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key ne 'name' ); - my $output = $stats{$value}; - print "$dsrc->{name}.value $output\n"; - } - } - } - else { - my $output; - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - if ( $value eq 'curr_conns' ) { - $output = $stats{curr_connections}; - } - elsif ( $value eq 'avg_conns' ) { - $output = sprintf( "%02d", - $stats{total_connections} / $stats{uptime} ); - } - else { - next; - } - print "$dsrc->{name}.value $output\n"; - } - } - } - - return; -} - -## -#### Subroutines for printing out config information for graphs #### -## - -## -#### This subroutine does the bulk printing the config info per graph #### -## - -sub do_config { - my ( $prefix, $plugin ) = (@_); - print_root_config( $prefix, $plugin ); - - return; -} - -## -#### This subroutine is for the config info for non multigraph graphs which render on the main node page #### -## - -sub print_root_config { - my ( $prefix, $plugin ) = (@_); - - die 'Unknown Plugin Specified: ' . ( $plugin ? $plugin : '' ) - unless $graphs{$plugin}; - - my $graph = $graphs{$plugin}; - - my %graphconf = %{ $graph->{config} }; - - #print "graph memcached_$plugin\n"; - - while ( my ( $key, $value ) = each(%graphconf) ) { - if ( $key eq 'title' ) { - if ($prefix) { - print "graph_$key " . ucfirst($prefix) . " $value\n"; - } - else { - print "graph_$key $value\n"; - } - } - else { - print "graph_$key $value\n"; - } - } - - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key eq 'name' ); - print "$dsrc->{name}.$key $value\n"; - } - } - - return; -} - -## -#### This subroutine returns a socket connection #### -## - -sub get_conn { - my $s = undef; - - # check if we want to use sockets instead of tcp - my ($sock) = ( $host =~ /unix:\/\/(.+)$/ ); - - if ($sock) { - $connection = "unix:\/\/$sock"; - $s = IO::Socket::UNIX->new( Peer => $sock ); - } - else { - $connection = "$host:$port"; - $s = IO::Socket::INET->new( - Proto => "tcp", - PeerAddr => $host, - PeerPort => $port, - Timeout => 10, - ); - } - - return $s; -} - -## -#### This subroutine actually performs the data fetch for us #### -#### These commands do not lock up Memcache at all #### -## - -sub fetch_stats { - my $s = get_conn(); - - die "Error: Unable to Connect to $connection\n" unless $s; - - print $s "stats\r\n"; - - while ( my $line = <$s> ) { - if ( $line =~ /STAT\s(.+?)\s(\d+)/ ) { - my ( $skey, $svalue ) = ( $1, $2 ); - $stats{$skey} = $svalue; - } - last if $line =~ /^END/; - } -} diff --git a/cookbooks/munin/files/default/plugins/memcached_multi_ b/cookbooks/munin/files/default/plugins/memcached_multi_ deleted file mode 100755 index 12027269b..000000000 --- a/cookbooks/munin/files/default/plugins/memcached_multi_ +++ /dev/null @@ -1,1631 +0,0 @@ -#!/usr/bin/perl -# - -=head1 MEMCACHED MULTI - -Memcached Multi - A Plugin to monitor Memcached Servers (Multigraph) - - The common difference between this memcached Munin plugin and others that exists, is that - others don't expose slab information from memcached, so you can better tune your memcached - interaction / stability / etc. With this plugin we leverage multigraph capabilities in - Munin to "hide" the slab information underneath of their parent graphs. - -=head1 MUNIN NODE CONFIGURATION - -The following configuration information can be overridden by placing environment definitions - like shown here, in a file located in /etc/munin/plugin-conf.d - -[memcached_multi_*] - env.host 127.0.0.1 *default* - env.port 11211 *default* - env.timescale 3 *default* - env.cmds get set delete incr decr touch *default* - env.leitime -1 *default* - -=head2 MUNIN NODE ENVIRONMENT CONFIGURATION EXPLANATION - - host = host we are going to monitor, this can be used to specify a unix socket. - port = port we are connecting to, in order to gather stats - timescale = what time frame do we want to format our graphs too - cmds = cmd types to display on cmd graph, remove cmds you don't want displayed from list. - leitime = setting this to 1 will re-enable slab eviction time graphs, see note below. - -=head2 BASIC TROUBLESHOOTING - -Please make sure you can telnet to your memcache servers and issue the - following commands: stats, stats settings, stats items and stats slabs. - -=head2 PLUGIN INFORMATION - -Available Graphs contained in this Plugin - -bytes => This graphs the current network traffic in and out - -commands => I This graphs the current commands being issued to the memcache machine. - B - -conns => This graphs the current, max connections as well as avg conns per sec avg conns per sec - and is derived from total_conns / uptime. - -evictions => I This graphs the current evictions on the node. - B - -items => I This graphs the current items and total items in the memcached node. - B - -memory => I This graphs the current and max memory allocation. - B - -unfetched => I This graphs the number of items that were never touched by a - get/incr/append/etc before being evicted or expiring from the cache. - B - -=head1 ADDITIONAL INFORMATION - -B The slab plugin for LEI has been disabled since I believe the counters to be inaccurate, - or perhaps not being updated as often I thought they would be. They can be re-enabled by - setting an environment variable, see munin configuration section at the top. - -You will find that some of the graphs have LEI on them. This was done in order to save room -on space for text and stands for B. - -The B variable formats certain graphs based on the following guidelines. - 1 => Seconds - 2 => Minutes - 3 => Hours B<*Default*> - 4 => Days - -=head1 ACKNOWLEDGEMENTS - -Thanks to dormando for putting up with me ;) - -=head1 AUTHOR - -Matt West < https://github.com/mhwest13/Memcached-Munin-Plugin > - -=head1 LICENSE - -GPLv2 - -=head1 MAGIC MARKERS - -#%# family=auto -#%# capabilities=autoconf suggest - -=cut - -use strict; -use warnings; -use IO::Socket; -use Munin::Plugin; -use File::Basename; - -if ( basename($0) !~ /(?:([^\/]+)_)?memcached_multi_/ ) { - print -"This script needs to be named (prefix_)?memcached_multi_ to run properly.\n"; - exit 1; -} - -# tell munin about our multigraph capabilities -need_multigraph(); - -=head1 Variable Declarations - - This section of code is to declare the variables used throughout the plugin - Some of them are imported as environment variables from munin plugin conf.d - file, others are hashes used for storing information that comes from the - stats commands issued to memcached. - -=cut - -# lets import environment variables for the plugin or use the default -my $host = $ENV{host} || "127.0.0.1"; -my $port = $ENV{port} || 11211; -my $connection; - -# This gives us the ability to control the timescale our graphs are displaying. -# The default it set to divide by hours, if you want to get seconds set it to 1. -# Options: 1 = seconds, 2 = minutes, 3 = hours, 4 = days -my $timescale = $ENV{timescale} || 3; - -# This gives us the ability to turn the Last Evicted Item time slab graph on. -# It was removed because I believe the counter / response to be broken but -# perhaps this was useful to someone. -my $leitime = $ENV{leitime} || -1; - -# This gives us the ability to specify which commands we want to display on the -# command graph. Allowing finer control since some environments don't leverage -# every command possible in memcached. -# Options: get set delete incr decr cas touch flush -my $commands = $ENV{cmds} || "get set delete incr decr touch"; - -# This hash contains the information contained in two memcache commands -# stats and stats settings. -my %stats; - -# This gives us eviction rates and other hit stats per slab -# We track this so we can see if something was evicted earlier than necessary -my %items; - -# This gives us the memory size and usage per slab -# We track this so we can see what slab is being used the most and has no free chunks -# so we can re-tune memcached to allocate more pages for the specified chunk size -my %chnks; - -# Variable for setting up a quick access map for plugin configurations / version adherence -my $globalmap; - -=head2 Graph Declarations - - This block of code builds up all of the graph info for all root / subgraphs. - - %graphs: is a container for all of the graph definition information. In here is where you'll - find the configuration information for munin's graphing procedure. - Format: - - $graph{graph_name} => { - config => { - You'll find the main graph config stored here - { key => value }, - { ... }, - }, - datasrc => [ - Name: name given to data value - Attr: Attribute and value, attribute must be valid plugin argument - { name => 'Name', info => 'info about graph', ... }, - { ... }, - ], - } - -=cut - -my %graphs; - -# main graph for memcached item count -$graphs{items} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Items in Memcached', - category => 'memcached global items', - title => 'Items', - info => 'Number of items in use by memcached', - }, - datasrc => [ - { name => 'curr_items', label => 'Current Items', min => '0' }, - { - name => 'total_items', - label => 'New Items', - min => '0', - type => 'DERIVE' - }, - ], -}; - -# main graph for memcached memory usage -$graphs{memory} = { - config => { - args => '--base 1024 --lower-limit 0', - vlabel => 'Bytes Used', - category => 'memcached global memory', - title => 'Memory Usage', - info => 'Memory consumption of memcached', - }, - datasrc => [ - { - name => 'limit_maxbytes', - draw => 'AREA', - label => 'Maximum Bytes Allocated', - min => '0' - }, - { - name => 'bytes', - draw => 'AREA', - label => 'Current Bytes Used', - min => '0' - }, - ], -}; - -# main graph for memcached network usage -$graphs{bytes} = { - config => { - args => '--base 1000', - vlabel => 'bits in (-) / out (+)', - title => 'Network Traffic', - category => 'memcached', - info => 'Network traffic in (-) / out (+) of the machine', - order => 'bytes_read bytes_written', - }, - datasrc => [ - { - name => 'bytes_read', - type => 'DERIVE', - label => 'Network Traffic coming in (-)', - graph => 'no', - cdef => 'bytes_read,8,*', - min => '0' - }, - { - name => 'bytes_written', - type => 'DERIVE', - label => 'Traffic in (-) / out (+)', - negative => 'bytes_read', - cdef => 'bytes_written,8,*', - min => '0' - }, - ], -}; - -# graph for memcached connections -$graphs{conns} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Connections per ${graph_period}', - category => 'memcached', - title => 'Connections', - info => 'Number of connections being handled by memcached', - order => 'max_conns curr_conns avg_conns', - }, - datasrc => [ - { name => 'curr_conns', label => 'Current Connections', min => '0' }, - { name => 'max_conns', label => 'Max Connections', min => '0' }, - { name => 'avg_conns', label => 'Avg Connections', min => '0' }, - ], -}; - -# main graph for memcached commands issued -$graphs{commands} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Commands per ${graph_period}', - category => 'memcached global commands', - title => 'Commands', - info => 'Number of commands being handled by memcached', - }, - datasrc => [ - { - name => 'cmd_get', - type => 'DERIVE', - label => 'Gets', - info => 'Cumulative number of retrieval reqs', - min => '0' - }, - { - name => 'cmd_set', - type => 'DERIVE', - label => 'Sets', - info => 'Cumulative number of storage reqs', - min => '0' - }, - { - name => 'cmd_flush', - type => 'DERIVE', - label => 'Flushes', - info => 'Cumulative number of flush reqs', - min => '0' - }, - { - name => 'cmd_touch', - type => 'DERIVE', - label => 'Touches', - info => 'Cumulative number of touch reqs', - min => '0' - }, - { - name => 'get_hits', - type => 'DERIVE', - label => 'Get Hits', - info => 'Number of keys that were requested and found', - min => '0' - }, - { - name => 'get_misses', - type => 'DERIVE', - label => 'Get Misses', - info => 'Number of keys there were requested and not found', - min => '0' - }, - { - name => 'delete_hits', - type => 'DERIVE', - label => 'Delete Hits', - info => - 'Number of delete requests that resulted in a deletion of a key', - min => '0' - }, - { - name => 'delete_misses', - type => 'DERIVE', - label => 'Delete Misses', - info => 'Number of delete requests for missing key', - min => '0' - }, - { - name => 'incr_hits', - type => 'DERIVE', - label => 'Increment Hits', - info => 'Number of successful increment requests', - min => '0' - }, - { - name => 'incr_misses', - type => 'DERIVE', - label => 'Increment Misses', - info => 'Number of unsuccessful increment requests', - min => '0' - }, - { - name => 'decr_hits', - type => 'DERIVE', - label => 'Decrement Hits', - info => 'Number of successful decrement requests', - min => '0' - }, - { - name => 'decr_misses', - type => 'DERIVE', - label => 'Decrement Misses', - info => 'Number of unsuccessful decrement requests', - min => '0' - }, - { - name => 'cas_misses', - type => 'DERIVE', - label => 'CAS Misses', - info => 'Number of Compare and Swap requests against missing keys', - min => '0' - }, - { - name => 'cas_hits', - type => 'DERIVE', - label => 'CAS Hits', - info => 'Number of successful Compare and Swap requests', - min => '0' - }, - { - name => 'cas_badval', - type => 'DERIVE', - label => 'CAS Badval', - info => 'Number of unsuccessful Compare and Swap requests', - min => '0' - }, - { - name => 'touch_hits', - type => 'DERIVE', - label => 'Touch Hits', - info => 'Number of successfully touched keys', - min => '0' - }, - { - name => 'touch_misses', - type => 'DERIVE', - label => 'Touch Misses', - info => 'Number of unsuccessful touch keys', - min => '0' - }, - ], -}; - -# main graph for memcached eviction rates -$graphs{evictions} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Evictions per ${graph_period}', - category => 'memcached global evictions', - title => 'Evictions', - info => 'Number of evictions per second', - }, - datasrc => [ - { - name => 'evictions', - type => 'DERIVE', - label => 'Evictions', - info => 'Cumulative Evictions Across All Slabs', - min => '0' - }, - { - name => 'evicted_nonzero', - type => 'DERIVE', - label => 'Evictions prior to Expire', - info => 'Cumulative Evictions forced to expire prior to expiration', - min => '0' - }, - { - name => 'reclaimed', - type => 'DERIVE', - label => 'Reclaimed Items', - info => 'Cumulative Reclaimed Item Entries Across All Slabs', - min => '0' - }, - ], -}; - -# main graph for memcached eviction rates -$graphs{unfetched} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Unfetched Items per ${graph_period}', - category => 'memcached global unfetched', - title => 'Unfetched Items', - info => -'Number of items that were never touched get/incr/append/etc before X occured', - }, - datasrc => [ - { - name => 'expired_unfetched', - type => 'DERIVE', - label => 'Expired Unfetched', - min => '0', - info => -'Number of items that expired and never had get/incr/append/etc performed' - }, - { - name => 'evicted_unfetched', - type => 'DERIVE', - label => 'Evictioned Unfetched', - min => '0', - info => -'Number of items that evicted and never had get/incr/append/etc performed' - }, - ], -}; - -# subgraph for breaking memory info down by slab ( subgraph of memory ) -$graphs{slabchnks} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Available Chunks for this Slab', - category => 'memcached slab chunk usage', - title => 'Chunk Usage for Slab: ', - info => 'This graph shows you the chunk usage for this memory slab.', - }, - datasrc => [ - { - name => 'total_chunks', - label => 'Total Chunks Available', - min => '0' - }, - { name => 'used_chunks', label => 'Total Chunks in Use', min => '0' }, - { - name => 'free_chunks', - label => 'Total Chunks Not in Use (Free)', - min => '0' - }, - ], -}; - -# subgraph for breaking commands down by slab ( subgraph of commands ) -$graphs{slabhits} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Hits per Slab per ${graph_period}', - category => 'memcached slab commands', - title => 'Hits for Slab: ', - info => - 'This graph shows you the successful hit rate for this memory slab.', - }, - datasrc => [ - { - name => 'get_hits', - label => 'Get Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'cmd_set', - label => 'Set Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'delete_hits', - label => 'Delete Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'incr_hits', - label => 'Increment Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'decr_hits', - label => 'Decrement Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'cas_hits', - label => 'Sucessful CAS Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'cas_badval', - label => 'UnSucessful CAS Requests', - type => 'DERIVE', - min => '0' - }, - { - name => 'touch_hits', - label => 'Touch Requests', - type => 'DERIVE', - min => '0' - }, - ], -}; - -# subgraph for breaking evictions down by slab ( subgraph of evictions ) -$graphs{slabevics} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Evictions per Slab per ${graph_period}', - category => 'memcached slab evictions', - title => 'Evictions for Slab: ', - info => 'This graph shows you the eviction rate for this memory slab.', - }, - datasrc => [ - { - name => 'evicted', - label => 'Total Evictions', - type => 'DERIVE', - min => '0', - info => 'Items evicted from memory slab' - }, - { - name => 'evicted_nonzero', - type => 'DERIVE', - label => 'Evictions from LRU Prior to Expire', - info => 'Items evicted from memory slab before ttl expiration', - min => '0' - }, - { - name => 'reclaimed', - type => 'DERIVE', - label => 'Reclaimed Expired Items', - info => - 'Number of times an item was stored in expired memory slab space', - min => '0' - }, - ], -}; - -# subgraph for showing the time between an item was last evicted and requested ( subgraph of evictions ) -$graphs{slabevictime} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => ' since Request for LEI', - category => 'memcached slab eviction time', - title => 'Eviction Request Time for Slab: ', - info => -'This graph shows you the time since we requested the last evicted item', - }, - datasrc => [ - { - name => 'evicted_time', - label => 'Eviction Time (LEI)', - info => 'Time Since Request for Last Evicted Item', - min => '0' - }, - ], -}; - -# subgraph for breaking items down by slab ( subgraph of items ) -$graphs{slabitems} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Items per Slab', - category => 'memcached slab item count', - title => 'Items in Slab: ', - info => -'This graph shows you the number of items and reclaimed items per slab.', - }, - datasrc => [ - { - name => 'number', - label => 'Items', - draw => 'AREA', - info => 'This is the amount of items stored in this slab', - min => '0' - }, - ], -}; - -# subgraph for showing the age of the eldest item stored in a slab ( subgraph of items ) -$graphs{slabitemtime} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => ' since item was stored', - category => 'memcached slab item age', - title => 'Age of Eldest Item in Slab: ', - info => 'This graph shows you the time of the eldest item in this slab', - }, - datasrc => - [ { name => 'age', label => 'Eldest Item\'s Age', min => '0' }, ], -}; - -# main graph for memcached eviction rates -$graphs{slabunfetched} = { - config => { - args => '--base 1000 --lower-limit 0', - vlabel => 'Unfetched Items per ${graph_period}', - category => 'memcached slab unfetched', - title => 'Unfetched Items in Slab: ', - info => -'Number of items that were never touched get/incr/append/etc before X occured', - }, - datasrc => [ - { - name => 'expired_unfetched', - type => 'DERIVE', - label => 'Expired Unfetched', - min => '0', - info => -'Number of items that expired and never had get/incr/append/etc performed' - }, - { - name => 'evicted_unfetched', - type => 'DERIVE', - label => 'Evictioned Unfetched', - min => '0', - info => -'Number of items that evicted and never had get/incr/append/etc performed' - }, - ], -}; - -=head1 Munin Checks - - These checks look for config / autoconf / suggest params - -=head2 Config Check - - This block of code looks at the argument that is possibly supplied, - should it be config, it then checks to make sure the plugin - specified exists, assuming it does, it will run the do_config - subroutine for the plugin specified, otherwise it dies complaining - about an unknown plugin. - -=cut - -if ( defined $ARGV[0] && $ARGV[0] eq 'config' ) { - -# Lets get our plugin from the symlink being called up, we'll also verify its a valid -# plugin that we have graph information for - $0 =~ /(?:([^\/]+)_)?memcached_multi_(.+)$/; - my $prefix = $1 ? $1 : ''; - my $plugin = $2; - die 'Unknown Plugin Specified: ' . ( $plugin ? $plugin : '' ) - unless $graphs{$plugin}; - -# We need to fetch the stats before we do any config, cause its needed for multigraph -# subgraphs which use slab information for title / info per slab - fetch_stats(); - $globalmap = buildglobalmap(); - - # Now lets go ahead and print out our config. - do_config( $prefix, $plugin ); - exit 0; -} - -=head2 Autoconf Check - - This block of code looks at the argument that is possibly supplied, - should it be autoconf, we will attempt to connect to the memcached - service specified on the host:port, upon successful connection it - prints yes, otherwise it prints no. - -=cut - -if ( defined $ARGV[0] && $ARGV[0] eq 'autoconf' ) { - - # Lets attempt to connect to memcached - my $s = get_conn(); - - # Lets verify that we did connect to memcached - if ( defined($s) ) { - print "yes\n"; - exit 0; - } - else { - print "no (unable to connect to $connection)\n"; - exit 0; - } -} - -=head2 Suggest Check - - This block of code looks at the argument that is possibly supplied, - should it be suggest, we are going to print the possible plugins - which can be specified. Note we only specify the root graphs for the - multigraphs, since the rest of the subgraphs will appear "behind" the - root graphs. It also attempts to connect to the memcached service to - verify it is infact running. - -=cut - -if ( defined $ARGV[0] && $ARGV[0] eq 'suggest' ) { - - # Lets attempt to connect to memcached - my $s = get_conn(); - - # Lets check that we did connect to memcached - if ( defined($s) ) { - fetch_stats(); - my @rootplugins = - ( 'bytes', 'conns', 'commands', 'evictions', 'items', 'memory' ); - if ( $stats{version} !~ /^1\.4\.[0-7]$/ ) { - push( @rootplugins, 'unfetched' ); - } - foreach my $plugin (@rootplugins) { - print "$plugin\n"; - } - exit 0; - } - else { - print "no (unable to connect to $connection)\n"; - exit 0; - } -} - -=head1 Output Subroutines - - Output Subroutine calls to output data values - -=head2 fetch_output - - This subroutine is the main call for printing data for the plugin. - No parameters are taken as this is the default call if no arguments - are supplied from the command line. - -=cut - -# Well, no arguments were supplied that we know about, so lets print some data -$0 =~ /(?:([^\/]+)_)?memcached_multi_(.+)$/; -my $prefix = $1 ? $1 : ''; -my $plugin = $2; -die 'Unknown Plugin Specified: ' . ( $plugin ? $plugin : '' ) - unless $graphs{$plugin}; -fetch_stats(); -$globalmap = buildglobalmap(); -fetch_output( $prefix, $plugin ); - -sub fetch_output { - my ( $prefix, $plugin ) = (@_); - - # Now lets go ahead and print out our output. - my @subgraphs; - if ( $plugin eq 'memory' ) { - @subgraphs = ('slabchnks'); - foreach my $slabid ( sort { $a <=> $b } keys %chnks ) { - print_submulti_output( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_output( $prefix, $plugin ); - print_rootmulti_output( $prefix, $plugin ); - } - elsif ( $plugin eq 'commands' ) { - @subgraphs = ('slabhits'); - foreach my $slabid ( sort { $a <=> $b } keys %chnks ) { - print_submulti_output( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_output( $prefix, $plugin ); - print_rootmulti_output( $prefix, $plugin ); - } - elsif ( $plugin eq 'evictions' ) { - @subgraphs = ('slabevics'); - if ( $leitime == 1 ) { push( @subgraphs, 'slabevictime' ); } - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_output( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_output( $prefix, $plugin ); - print_rootmulti_output( $prefix, $plugin ); - } - elsif ( $plugin eq 'items' ) { - @subgraphs = ( 'slabitems', 'slabitemtime' ); - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_output( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_output( $prefix, $plugin ); - print_rootmulti_output( $prefix, $plugin ); - } - elsif ( $plugin eq 'unfetched' ) { - @subgraphs = ('slabunfetched'); - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_output( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_output( $prefix, $plugin ); - print_rootmulti_output( $prefix, $plugin ); - } - else { - print_root_output($plugin); - } - - return; -} - -=head2 print_root_output - - This subroutine prints out the return values for our non-multigraph root graphs. - It takes one parameter $plugin and returns when completed. - - $plugin; graph we are calling up to print data values for - - Example: print_root_output($plugin); - -=cut - -sub print_root_output { - - # Lets get our plugin, set our graph reference and print out info for Munin - my ($plugin) = (@_); - my $graph = $graphs{$plugin}; - - # The conns plugin has some specific needs, looking for plugin type - if ( $plugin ne 'conns' ) { - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key ne 'name' ); - my $output = $stats{$value}; - print "$dsrc->{name}.value $output\n"; - } - } - } - else { - my $output; - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - if ( $value eq 'max_conns' ) { - $output = $stats{maxconns}; - } - elsif ( $value eq 'curr_conns' ) { - $output = $stats{curr_connections}; - } - elsif ( $value eq 'avg_conns' ) { - $output = sprintf( "%02d", - $stats{total_connections} / $stats{uptime} ); - } - else { - next; - } - print "$dsrc->{name}.value $output\n"; - } - } - } - return; -} - -=head2 print_rootmulti_output - - This subroutine prints out the return values for our multigraph root graphs. - It takes one parameter $plugin and returns when completed. - - $plugin; root graph we are calling up to print data values for - - Example: print_rootmulti_output($plugin); - -=cut - -sub print_rootmulti_output { - - # Lets get our plugin, set our graph reference and print out info for Munin - my ( $prefix, $plugin ) = (@_); - my $graph = $graphs{$plugin}; - if ($prefix) { - print "multigraph $prefix\_memcached_multi_$plugin\n"; - } - else { - print "multigraph memcached_multi_$plugin\n"; - } - - # Lets print our data values with their appropriate name - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my $output = 0; - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key ne 'name' ); - next - if ( ( $plugin eq 'evictions' ) - && ( !exists( $globalmap->{globalevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{globalcmds}->{ $dsrc->{name} } ) ) ); - if ( ( $plugin eq 'evictions' ) && ( $value eq 'evicted_nonzero' ) ) - { - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - $output += $items{$slabid}->{evicted_nonzero}; - } - } - else { - $output = $stats{$value}; - } - print "$dsrc->{name}.value $output\n"; - } - } - return; -} - -=head2 print_subrootmulti_output - - This subroutine prints out the return values for our multigraph root graphs, only this set of - data will display on the subpage made by the multigraph capabilities of munin and the plugin. - It takes one parameter $plugin and returns when completed. - - $plugin; root graph we are calling up to print data values for - - Example: print_rootmulti_output($plugin); - -=cut - -sub print_subrootmulti_output { - - # Lets get our plugin, set our graph reference and print out info for Munin - my ( $prefix, $plugin ) = (@_); - my $graph = $graphs{$plugin}; - if ($prefix) { - if ( $plugin eq 'evictions' ) { - print "multigraph $prefix\_memcached_multi_$plugin.global$plugin\n"; - } - else { - print "multigraph $prefix\_memcached_multi_$plugin.$plugin\n"; - } - } - else { - if ( $plugin eq 'evictions' ) { - print "multigraph memcached_multi_$plugin.global$plugin\n"; - } - else { - print "multigraph memcached_multi_$plugin.$plugin\n"; - } - } - - # Lets print our data values with their appropriate name - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my $output = 0; - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key ne 'name' ); - next - if ( ( $plugin eq 'evictions' ) - && ( !exists( $globalmap->{globalevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{globalcmds}->{ $dsrc->{name} } ) ) ); - if ( ( $plugin eq 'evictions' ) && ( $value eq 'evicted_nonzero' ) ) - { - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - $output += $items{$slabid}->{evicted_nonzero}; - } - } - else { - $output = $stats{$value}; - } - print "$dsrc->{name}.value $output\n"; - } - } - return; -} - -=head2 print_submulti_output - - This subroutine prints out the return values for our multigraph subgraphs. It takes - three parameters $slabid, $plugin, @subgraphs and then rReturns when completed. - - $slabid; slab id that we will use to grab info from and print out - $plugin; root graph being called, used for multigraph output and slab id - @subgraphs; graphs we are actually trying to print data values for - - Example: print_submulti_output($slabid,$plugin,@subgraphs); - -=cut - -sub print_submulti_output { - - # Lets get our slabid, plugin, and subgraphs - my ( $prefix, $slabid, $plugin, @subgraphs ) = (@_); - my $currslab = undef; - - # Time to loop over our subgraphs array - foreach my $sgraph (@subgraphs) { - - # Lets set our graph reference for quick calling, and print some info for munin - my $graph = $graphs{$sgraph}; - if ($prefix) { - print - "multigraph $prefix\_memcached_multi_$plugin.$sgraph\_$slabid\n"; - } - else { - print "multigraph memcached_multi_$plugin.$sgraph\_$slabid\n"; - } - - # Lets figure out what slab info we are trying to call up - if ( ( $plugin eq 'evictions' ) - || ( $plugin eq 'items' ) - || ( $plugin eq 'unfetched' ) ) - { - $currslab = $items{$slabid}; - } - elsif ( ( $plugin eq 'memory' ) || ( $plugin eq 'commands' ) ) { - $currslab = $chnks{$slabid}; - } - else { - return; - } - - # Lets print our data values with their appropriate name - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key ne 'name' ); - next - if ( ( $sgraph eq 'slabevics' ) - && ( !exists( $globalmap->{slabevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{slabcmds}->{ $dsrc->{name} } ) ) - ); - my $output = $currslab->{$value}; - if ( ( $sgraph eq 'slabevictime' ) - || ( $sgraph eq 'slabitemtime' ) ) - { - $output = time_scale( 'data', $output ); - } - print "$dsrc->{name}.value $output\n"; - } - } - } - return; -} - -=head1 Config Subroutines - - These subroutines handle the config portion of munin calls. - -=head2 do_config - - This is the main call issued assuming we call up config and plugin specified exists - The subroutine takes one parameter $plugin, and returns when completed. - - $plugin; root graph being called - - Example: do_config($prefix, $plugin); - -=cut - -sub do_config { - my ( $prefix, $plugin ) = (@_); - my @subgraphs; - if ( $plugin eq 'memory' ) { - @subgraphs = ('slabchnks'); - foreach my $slabid ( sort { $a <=> $b } keys %chnks ) { - print_submulti_config( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_config( $prefix, $plugin ); - print_rootmulti_config( $prefix, $plugin ); - } - elsif ( $plugin eq 'commands' ) { - @subgraphs = ('slabhits'); - foreach my $slabid ( sort { $a <=> $b } keys %chnks ) { - print_submulti_config( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_config( $prefix, $plugin ); - print_rootmulti_config( $prefix, $plugin ); - } - elsif ( $plugin eq 'evictions' ) { - @subgraphs = ('slabevics'); - if ( $leitime == 1 ) { push( @subgraphs, 'slabevictime' ); } - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_config( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_config( $prefix, $plugin ); - print_rootmulti_config( $prefix, $plugin ); - } - elsif ( $plugin eq 'items' ) { - @subgraphs = ( 'slabitems', 'slabitemtime' ); - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_config( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_config( $prefix, $plugin ); - print_rootmulti_config( $prefix, $plugin ); - } - elsif ( $plugin eq 'unfetched' ) { - @subgraphs = ('slabunfetched'); - foreach my $slabid ( sort { $a <=> $b } keys %items ) { - print_submulti_config( $prefix, $slabid, $plugin, @subgraphs ); - } - print_subrootmulti_config( $prefix, $plugin ); - print_rootmulti_config( $prefix, $plugin ); - } - else { - print_root_config( $prefix, $plugin ); - } - - return; -} - -=head2 print_root_config - - This subroutine prints out the config information for all of the non-multigraph root graphs. - It takes one parameter, $plugin, returns when completed. - - $prefix; possible prefix used to allow multiple plugins per machine - $plugin; root graph used for multigraph call - - Example: print_root_config($prefix,$plugin); - -=cut - -sub print_root_config { - - # Lets get our plugin, set our graph reference and our graph config info - my ( $prefix, $plugin ) = (@_); - my $graph = $graphs{$plugin}; - my %graphconf = %{ $graph->{config} }; - - # Lets tell munin about the graph we are referencing and print the main config - while ( my ( $key, $value ) = each(%graphconf) ) { - if ( $key eq 'title' ) { - if ($prefix) { - print "graph_$key " . ucfirst($prefix) . " $value\n"; - } - else { - print "graph_$key $value\n"; - } - } - else { - print "graph_$key $value\n"; - } - } - - # Lets tell munin about our data values and how to treat them - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key eq 'name' ); - print "$dsrc->{name}.$key $value\n"; - } - } - return; -} - -=head2 print_rootmulti_config - - This subroutine prints out the config information for all of the multigraph root graphs. - It takes one parameter, $plugin, returns when completed. - - $prefix; possible prefix used to allow multiple plugins per machine - $plugin; root graph used for multigraph call - - Example: print_rootmulti_config($prefix,$plugin); - -=cut - -sub print_rootmulti_config { - - # Lets get out plugin, set our graph reference and our graph config info - my ( $prefix, $plugin ) = (@_); - my $graph = $graphs{$plugin}; - my %graphconf = %{ $graph->{config} }; - - # Lets tell munin about the graph we are referencing and print the main config - if ($prefix) { - print "multigraph $prefix\_memcached_multi_$plugin\n"; - } - else { - print "multigraph memcached_multi_$plugin\n"; - } - while ( my ( $key, $value ) = each(%graphconf) ) { - if ( $key eq 'category' ) { - print "graph_$key memcached\n"; - } - elsif ( $key eq 'title' ) { - if ($prefix) { - print "graph_$key " . ucfirst($prefix) . " $value\n"; - } - else { - print "graph_$key $value\n"; - } - } - else { - print "graph_$key $value\n"; - } - } - - # Lets tell munin about our data values and how to treat them - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key eq 'name' ); - next - if ( ( $plugin eq 'evictions' ) - && ( !exists( $globalmap->{globalevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{globalcmds}->{ $dsrc->{name} } ) ) ); - print "$dsrc->{name}.$key $value\n"; - } - } - return; -} - -=head2 print_subrootmulti_config - - This subroutine prints out the config information for all of the multigraph root graph, only this - graph of the data will display on the subpage made by the multigraph capabilities of munin and - the plugin. It takes one parameter, $plugin, returns when completed. - - $prefix; possible prefix used to allow multiple plugins per machine - $plugin; root graph used for multigraph call - - Example: print_rootmulti_config($prefix,$plugin); - -=cut - -sub print_subrootmulti_config { - - # Lets get out plugin, set our graph reference and our graph config info - my ( $prefix, $plugin ) = (@_); - my $graph = $graphs{$plugin}; - my %graphconf = %{ $graph->{config} }; - if ($prefix) { - if ( $plugin eq 'evictions' ) { - print "multigraph $prefix\_memcached_multi_$plugin.global$plugin\n"; - } - else { - print "multigraph $prefix\_memcached_multi_$plugin.$plugin\n"; - } - } - else { - if ( $plugin eq 'evictions' ) { - print "multigraph memcached_multi_$plugin.global$plugin\n"; - } - else { - print "multigraph memcached_multi_$plugin.$plugin\n"; - } - } - - while ( my ( $key, $value ) = each(%graphconf) ) { - if ( $key eq 'title' ) { - if ($prefix) { - print "graph_$key " . ucfirst($prefix) . " $value\n"; - } - else { - print "graph_$key $value\n"; - } - } - else { - print "graph_$key $value\n"; - } - } - - # Lets tell munin about our data values and how to treat them - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key eq 'name' ); - next - if ( ( $plugin eq 'evictions' ) - && ( !exists( $globalmap->{globalevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{globalcmds}->{ $dsrc->{name} } ) ) ); - print "$dsrc->{name}.$key $value\n"; - } - } - return; -} - -=head2 print_submulti_config - - This subroutine prints out the config information for all of the multigraph subgraphs. - It takes three parameters, $slabid, $plugin and @subgraphs, returns when completed. - - $prefix; possible prefix used to allow multiple plugins per machine - $slabid; slab id that we will use to grab info from and print out - $plugin; root graph being called, used for multigraph output and slab id - @subgraphs; graphs we are actually trying to print data values for - - Example: print_submulti_config($prefix,$slabid,$plugin,@subgraphs); - -=cut - -sub print_submulti_config { - - # Lets get our slabid, plugin, and subgraphs - my ( $prefix, $slabid, $plugin, @subgraphs ) = (@_); - my ( $slabitems, $slabchnks ) = undef; - - # Time to loop over our subgraphs array - foreach my $sgraph (@subgraphs) { - - # Lets set our graph reference, and main graph config for easy handling - my $graph = $graphs{$sgraph}; - my %graphconf = %{ $graph->{config} }; - -# Lets tell munin which graph we are graphing, and what our main graph config info is - if ($prefix) { - print - "multigraph $prefix\_memcached_multi_$plugin.$sgraph\_$slabid\n"; - } - else { - print "multigraph memcached_multi_$plugin.$sgraph\_$slabid\n"; - } - while ( my ( $key, $value ) = each(%graphconf) ) { - if ( $key eq 'title' ) { - if ($prefix) { - print "graph_$key " - . ucfirst($prefix) - . " $value" - . "$slabid" - . " ($chnks{$slabid}->{chunk_size} Bytes)\n"; - } - else { - print "graph_$key $value" - . "$slabid" - . " ($chnks{$slabid}->{chunk_size} Bytes)\n"; - } - } - elsif ( - ( $key eq 'vlabel' ) - && ( ( $sgraph eq 'slabevictime' ) - || ( $sgraph eq 'slabitemtime' ) ) - ) - { - $value = time_scale( 'config', $value ); - print "graph_$key $value\n"; - } - else { - print "graph_$key $value\n"; - } - } - - # Lets tell munin about our data values and how to treat them - foreach my $dsrc ( @{ $graph->{datasrc} } ) { - my %datasrc = %$dsrc; - while ( my ( $key, $value ) = each(%datasrc) ) { - next if ( $key eq 'name' ); - next - if ( ( $sgraph eq 'slabevics' ) - && ( !exists( $globalmap->{slabevics}->{ $dsrc->{name} } ) ) - ); - next - if ( ( $plugin eq 'commands' ) - && ( !exists( $globalmap->{slabcmds}->{ $dsrc->{name} } ) ) - ); - print "$dsrc->{name}.$key $value\n"; - } - } - } - return; -} - -=head1 Misc Subroutines - - These subroutines are misc ones, and are referenced inside of the code. They - should never be called up by Munin. - -=head2 get_conn - - This subroutine returns a socket connection - -=cut - -sub get_conn { - my $s = undef; - - # check if we want to use sockets instead of tcp - my ($sock) = ( $host =~ /unix:\/\/(.+)*$/ ); - - if ($sock) { - $connection = "unix:\/\/$sock"; - $s = IO::Socket::UNIX->new( Peer => $sock ); - } - else { - $connection = "$host:$port"; - $s = IO::Socket::INET->new( - Proto => "tcp", - PeerAddr => $host, - PeerPort => $port, - Timeout => 10, - ); - } - return $s; -} - -=head2 fetch_stats - - This subroutine fetches the information from memcached and stores it into our - hashes for later referencing throughout the graph. Returns when completed - -=cut - -sub fetch_stats { - - # Lets try and connect to memcached - my $s = get_conn(); - - # Die if we can't establish a connection to memcached - die "Error: Unable to Connect to $connection\n" unless $s; - - # Lets print the stats command and store the info from the output - print $s "stats\r\n"; - while ( my $line = <$s> ) { - if ( $line =~ /STAT\s(.+?)\s((\w|\d|\S)+)/ ) { - my ( $skey, $svalue ) = ( $1, $2 ); - $stats{$skey} = $svalue; - } - last if $line =~ /^END/; - } - - # Lets print the stats settings command and store the info from the output - print $s "stats settings\r\n"; - while ( my $line = <$s> ) { - if ( $line =~ /STAT\s(.+?)\s((\w|\d|\S)+)/ ) { - my ( $skey, $svalue ) = ( $1, $2 ); - if ( $skey eq 'evictions' ) { - $skey = 'evictions_active'; - } - $stats{$skey} = $svalue; - } - last if $line =~ /^END/; - } - - # Lets print the stats slabs command and store the info from the output - print $s "stats slabs\r\n"; - while ( my $line = <$s> ) { - if ( $line =~ /STAT\s(\d+):(.+)\s(\d+)/ ) { - my ( $slabid, $slabkey, $slabvalue ) = ( $1, $2, $3 ); - $chnks{$slabid}->{$slabkey} = $slabvalue; - } - last if $line =~ /^END/; - } - - # Lets print the stats items command and store the info from the output - print $s "stats items\r\n"; - while ( my $line = <$s> ) { - if ( $line =~ /STAT\sitems:(\d+):(.+?)\s(\d+)/ ) { - my ( $itemid, $itemkey, $itemvalue ) = ( $1, $2, $3 ); - $items{$itemid}->{$itemkey} = $itemvalue; - } - last if $line =~ /^END/; - } -} - -=head2 time_scale - - This subroutine is here for me to adjust the timescale of the time graphs - for last evicted item and age of eldest item in cache. - - Please note, after long usage I have noticed these counters may not - be accurate, I believe the developers are aware and have submitted - a patch upstream. - -=cut - -sub time_scale { - - # Lets get our config option and value to adjust - my ( $configopt, $origvalue ) = (@_); - my $value; - - # If config is defined, it returns the config info for time scale - # If data is defined, it returns the original value after its been adjusted - if ( $configopt eq 'config' ) { - if ( $timescale == 1 ) { - $value = "Seconds" . $origvalue; - } - elsif ( $timescale == 2 ) { - $value = "Minutes" . $origvalue; - } - elsif (( $timescale == 3 ) - || ( $timescale > 4 ) - || ( !defined($timescale) ) ) - { - $value = "Hours" . $origvalue; - } - elsif ( $timescale == 4 ) { - $value = "Days" . $origvalue; - } - } - elsif ( $configopt eq 'data' ) { - if ( $timescale == 1 ) { - $value = sprintf( "%02.2f", $origvalue / 1 ); - } - elsif ( $timescale == 2 ) { - $value = sprintf( "%02.2f", $origvalue / 60 ); - } - elsif (( $timescale == 3 ) - || ( $timescale > 4 ) - || ( !defined($timescale) ) ) - { - $value = sprintf( "%02.2f", $origvalue / 3600 ); - } - elsif ( $timescale == 4 ) { - $value = sprintf( "%02.2f", $origvalue / 86400 ); - } - } - else { - die "Unknown time_scale option given: either [config/data]\n"; - } - return $value; -} - -=head2 buildglobalmap - - This subroutine looks at the specified commands inputted, and generates - a hashref containing two arrays, one for global command keys and one for - slab command keys. - -=cut - -sub buildglobalmap { - my $results; - my @cmds = split( ' ', $commands ); - foreach my $cmd (@cmds) { - if ( $cmd eq "get" ) { - $results->{globalcmds}->{cmd_get} = 1; - $results->{globalcmds}->{get_hits} = 1; - $results->{globalcmds}->{get_misses} = 1; - $results->{slabcmds}->{get_hits} = 1; - } - elsif ( $cmd eq "set" ) { - $results->{globalcmds}->{cmd_set} = 1; - $results->{slabcmds}->{cmd_set} = 1; - } - elsif ( $cmd eq "delete" ) { - $results->{globalcmds}->{delete_hits} = 1; - $results->{globalcmds}->{delete_misses} = 1; - $results->{slabcmds}->{delete_hits} = 1; - } - elsif ( $cmd eq "incr" ) { - $results->{globalcmds}->{incr_hits} = 1; - $results->{globalcmds}->{incr_misses} = 1; - $results->{slabcmds}->{incr_hits} = 1; - } - elsif ( $cmd eq "decr" ) { - $results->{globalcmds}->{decr_hits} = 1; - $results->{globalcmds}->{decr_misses} = 1; - $results->{slabcmds}->{decr_hits} = 1; - } - elsif ( $cmd eq "cas" ) { - $results->{globalcmds}->{cas_hits} = 1; - $results->{globalcmds}->{cas_misses} = 1; - $results->{globalcmds}->{cas_badval} = 1; - $results->{slabcmds}->{cas_hits} = 1; - $results->{slabcmds}->{cas_badval} = 1; - } - elsif ( $cmd eq "touch" ) { - if ( $stats{version} !~ /^1\.4\.[0-7]$/ ) { - $results->{globalcmds}->{cmd_touch} = 1; - $results->{globalcmds}->{touch_hits} = 1; - $results->{globalcmds}->{touch_misses} = 1; - $results->{slabcmds}->{touch_hits} = 1; - } - } - elsif ( $cmd eq "flush" ) { - if ( $stats{version} !~ /^1\.4\.[0-7]$/ ) { - $results->{globalcmds}->{cmd_flush} = 1; - } - } - else { - - # Do absolutely nothing... - } - } - $results->{globalevics}->{evictions} = 1; - $results->{globalevics}->{evicted_nonzero} = 1; - $results->{slabevics}->{evicted} = 1; - $results->{slabevics}->{evicted_nonzero} = 1; - if ( $stats{version} !~ /^1\.4\.[0-2]$/ ) { - $results->{globalevics}->{reclaimed} = 1; - $results->{slabevics}->{reclaimed} = 1; - } - return $results; -} diff --git a/cookbooks/munin/files/default/plugins/munin_rrdcached b/cookbooks/munin/files/default/plugins/munin_rrdcached deleted file mode 100644 index 9f9cb6db9..000000000 --- a/cookbooks/munin/files/default/plugins/munin_rrdcached +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -w -# -*- cperl -*- - -use strict; -use warnings; - -use IO::Socket::UNIX; - -$| = 1; - -my $arg = shift; -if ($arg && $arg eq "config") { - print "graph_title Munin rrdcached statistics\n"; - print "graph_category munin\n"; - print "QueueLength.label Queue length\n"; - print "UpdatesReceived.label UpdatesReceived\n"; - print "UpdatesReceived.type DERIVE\n"; - print "FlushesReceived.label FlushesReceived\n"; - print "FlushesReceived.type DERIVE\n"; - print "UpdatesWritten.label UpdatesWritten\n"; - print "UpdatesWritten.type DERIVE\n"; - print "DataSetsWritten.label DataSetsWritten\n"; - print "DataSetsWritten.type DERIVE\n"; - print "TreeNodesNumber.label TreeNodesNumber\n"; - print "TreeDepth.label TreeDepth\n"; - print "JournalBytes.label JournalBytes\n"; - print "JournalBytes.type DERIVE\n"; - print "JournalRotate.label JournalRotate\n"; - print "JournalRotate.type DERIVE\n"; - exit 0; -} - -my $sock = new IO::Socket::UNIX( - Type => SOCK_STREAM, - Peer => "/var/run/rrdcached.sock", -) or die "Cannot open socket : $!"; - -print $sock "STATS\n"; -print $sock "QUIT\n"; - -# skip first line -<$sock>; -print map { s/: /.value /; $_; } <$sock>; - -exit 0; diff --git a/cookbooks/munin/files/default/plugins/mysql_ b/cookbooks/munin/files/default/plugins/mysql_ deleted file mode 100644 index 80c561e2e..000000000 --- a/cookbooks/munin/files/default/plugins/mysql_ +++ /dev/null @@ -1,2514 +0,0 @@ -#!/usr/bin/perl - -=encoding utf8 - -=head1 NAME - -mysql_ - Munin plugin to display misc MySQL server status - -=head1 APPLICABLE SYSTEMS - -Any MySQL platform, tested by the authors on: -* MySQL 5.6.12 -* MySQL 5.5.32, 5.5.37 -* MySQL 5.1.29, -* MySQL 5.0.51 -* MariaDB 5.5.39 -* MariaDB-5.5.39(galera). - -Plugins: -* MariaDB-10 Query Response Time: https://mariadb.com/kb/en/mariadb/query_response_time-plugin/ - -Information Schema tables: -* User statistics - MariaDB-5.2+, OurDelta, Percona Server - https://mariadb.com/kb/en/mariadb/user-statistics - -=head1 CONFIGURATION - -This script is used to generate data for several graphs. To generate -data for one specific graph, you need to create a symbolic link with a -name like mysql_ to this script. - -If you need to run against multiple MySQL instances on the same host, -create your symlinks with names like mysql_ where N is any -non-negative integer. You must also set the env.cachenamespace variable -to a unique value for each group of symlinks. - -To get a list of symlinks that can be created, run: - - ./mysql_ suggest - -In addition you might need to specify connection parameters in the -plugin configuration to override the defaults. These are the defaults: - - [mysql_*] - env.mysqlconnection DBI:mysql:information_schema - env.mysqluser root - -Non-default example: - - [mysql_*] - env.mysqlconnection DBI:mysql:information_schema;host=127.0.0.1;port=3306 - env.mysqluser munin - env.mysqlpassword geheim - env.cachenamespace munin_mysql_pri - [mysql2_*] - env.mysqlconnection DBI:mysql:information_schema;host=127.0.0.1;port=13306 - env.mysqluser munin; - env.mysqlpassword ryuWyawEv - env.cachenamespace munin_mysql_alt - [mysql10_*] - user munin - env.mysqluser munin - env.mysqlconnection DBI:mysql:information_schema;mysql_read_default_file=/etc/munin/.my-10.cnf - env.cachenamespace munin_mysql_10 - # here the [client] section of /etc/munin/.my-10.cnf is read. socket= can - # be specified here. - -Creating a munin user: - - CREATE USER 'munin'@'localhost' IDENTIFIED BY 'ryuWyawEv'; - -or with a unix_socket plugin (INSTALL PLUGIN unix_socket SONAME 'auth_socket') - - CREATE USER 'munin'@'localhost' IDENTIFIED WITH unix_socket; - -Note: requires 'user munin' in the configuration. - -The minimum required priviledges of the munin database user is: - - GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'munin'@'localhost'; - - -Warning and critical values can be set via the environment in the usual way. -For example: - - [mysql_replication] - env.slave_io_running_warning 0.5 - env.slave_sql_running_warning 0.5 - env.seconds_behind_master_warning 300 - env.seconds_behind_master_critical 600 - -=head1 DEPENDENCIES - -=over - -=item Cache::Cache - -The plugin uses shared memory to cache the statistics gathered from -MySQL. This ensures minimal inpact on the MySQL server. - -=item DBD::mysql - -=back - -=head1 INTERPRETATION - -=head2 InnoDB - -The statistics from innodb are mainly collected from the command - - SHOW ENGINE INNODB STATUS - -A nice walk through is found at -L - -Undo logs: -L - -=head2 The graphs - -FIX point to relevant sections in the MySQL manual and other www -resources for each graph - -=over - -=item mysql_replication - -slave_io_running and slave_sql_running both translate the "Yes" values to 0 and -anything else to 1 for their respective fields in the "SHOW SLAVE STATUS" output. -This can be used to warn on slave failure if the warning and critical values -are set as seen in a previous section. - -=item wsrep_cluster_status - -"Primary" is translated 0 and "non-Primary" to 1. - -=back - -=head1 LICENSE - -Copyright (C) 2008,2009 Kjell-Magne Øierud, 2014 Open Query - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 dated June, 1991. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -=head1 VERSION - -git-master + a few munin modifications - -This plugin was downloaded from L - -=head1 MAGICK MARKERS - - #%# family=auto - #%# capabilities=suggest autoconf - -=cut - -use warnings; -use strict; -use utf8; - -use DBI; -use File::Basename; -use Math::BigInt; # Used to append "=> lib 'GMP'" here, but GMP caused - # segfault on some occasions. Removed as I don't - # think the tiny performance boost is worth the - # debugging effort. -use Storable qw(nfreeze thaw); - -use Munin::Plugin; - -my $has_cache; - -BEGIN { - eval 'require Cache::SharedMemoryCache'; - $has_cache = $@ ? 0 : 1; -} - - -#--------------------------------------------------------------------- -# C O N F I G -#--------------------------------------------------------------------- - -my %config = ( - 'dsn' => $ENV{'mysqlconnection'} || 'DBI:mysql:information_schema', - 'user' => $ENV{'mysqluser'} || 'root', - 'password' => $ENV{'mysqlpassword'} || '', - 'cache_namespace' => $ENV{'cachenamespace'} || 'munin_mysql', -); - - -#--------------------------------------------------------------------- -# C A C H E -#--------------------------------------------------------------------- - -my %cache_options = ( - 'namespace' => $config{cache_namespace}, - 'default_expires_in' => 60, -); - -my $shared_memory_cache ; -if ($has_cache) -{ - $shared_memory_cache = Cache::SharedMemoryCache->new(\%cache_options) - or die("Couldn't instantiate SharedMemoryCache"); -} - -#--------------------------------------------------------------------- -# G R A P H D E F I N I T I O N S -#--------------------------------------------------------------------- - -# These are defaults to save typing in the graph definitions -my %defaults = ( - global_attrs => { - args => '--base 1000', - }, - data_source_attrs => { - min => '0', - type => 'DERIVE', - draw => 'AREASTACK', - }, -); - -# %graphs contains the graph definitions, it is indexed on the graph -# name. The information stored for each graph is used for both showing -# data source values and for printing the graph configuration. Each -# graph follows the followingformat: -# -# $graph{NAME} => { -# config => { -# # The global attributes for this graph -# global_attrs => {} -# # Attributes common to all data sources in this graph -# data_source_attrs => {} -# }, -# data_sources => [ -# # NAME - The name of the data source (e.g. variable names -# # from SHOW STATUS) -# # DATA_SOURCE_ATTRS - key-value pairs with data source -# # attributes -# {name => 'NAME', (DATA_SOURCE_ATTRS)}, -# {...}, -# ], -my %graphs = (); - -#--------------------------------------------------------------------- - - -$graphs{wsrep_cluster_status} = { - config => { - global_attrs => { - title => 'Galera Status', - vlabel => 'PRIMARY', - }, - data_source_attrs => { - draw => 'LINE1', - min => '0', - max => '1', - }, - }, - data_sources => [ - {name => 'wsrep_cluster_status', label => '0-Primary, 1-Non-Primary', - info => 'If the host is primary', - type => 'GAUGE', - critical => '1'}, - ], -}; - -$graphs{wsrep_cluster_size} = { - config => { - global_attrs => { - title => 'Galera cluster size', - vlabel => 'Hosts', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_cluster_size', label => 'Cluster size', - info => 'The number of hosts in the cluster.', - type => 'GAUGE'}, - ], -}; - - -# http://www.codership.com/wiki/doku.php?id=galera_node_fsm -$graphs{wsrep_local_state} = { - config => { - global_attrs => { - title => 'Galera node state', - vlabel => 'State (galera_node_fsm)', - args => '--lower-limit 0 --upper-limit 6', - }, - data_source_attrs => { - draw => 'LINE1', - min => '0', - max => '6', - }, - }, - data_sources => [ - {name => 'wsrep_local_state', label => '1-Joining, 2-Donor, 3-Joined, 4-Synced, 5-Donor, 6-Join after Donor ', - info => 'The state of the node in the cluster.', - type => 'GAUGE', - warning => '3.5:4.5'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{wsrep_transactions} = { - config => { - global_attrs => { - title => 'Galera transactions', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_last_committed', label => 'Committed transactions', - info => '# of committed transactions.', - type => 'COUNTER', - min => 0}, - {name => 'wsrep_local_commits', label => 'Locally Committed transactions', - info => '# of locally committed transactions.', - type => 'COUNTER', - min => 0}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{wsrep_writesets} = { - config => { - global_attrs => { - title => 'Galera writesets', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_replicated', label => 'Writesets sent', - info => '# of writesets sent to other nodes', - type => 'COUNTER', - min => '0', - graph => 'no'}, - {name => 'wsrep_received', label => 'Writesets received', - info => '# of writesets received from other nodes', - type => 'COUNTER', - min => '0', - negative => 'wsrep_replicated'}, - ], -}; - -#------------------------- - - -$graphs{wsrep_writesetbytes} = { - config => { - global_attrs => { - title => 'Galera writesets bytes/sec', - }, - data_source_attrs => { - }, - }, - data_sources => [ - {name => 'wsrep_received_bytes', label => 'Writesets bytes received', - info => '# of bytes in writesets received from other nodes', - type => 'DERIVE', - min => 0, - graph => 'no'}, - {name => 'wsrep_replicated_bytes', label => 'Writesets bytes sent', - info => '# of bytes in writesets sent to other nodes', - type => 'DERIVE', - draw => 'LINE1', - min => 0, - negative => 'wsrep_received_bytes'}, - {name => 'wsrep_repl_keys_bytes', label => 'Writeset key size sent', - info => '# of bytes in writesets of keys sent to other nodes', - type => 'DERIVE', - min => 0}, - {name => 'wsrep_repl_data_bytes', label => 'Writeset data size sent', - info => '# of bytes in writesets of data sent to other nodes', - type => 'DERIVE', - min => 0}, - {name => 'wsrep_repl_other_bytes', label => 'Writeset other size sent', - info => '# of bytes in writesets of other data sent to other nodes', - type => 'DERIVE', - min => 0}, - ], -}; - - -#------------------------- - -$graphs{wsrep_errors} = { - config => { - global_attrs => { - title => 'Galera transaction problems' - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_local_cert_failures', label => 'Certification failures', - type => 'DERIVE', - min => 0}, - {name => 'wsrep_local_bf_aborts', label => 'Aborted local transactions', - type => 'DERIVE', - min => 0}, - {name => 'wsrep_local_replays', label => 'Replays', - type => 'DERIVE', - min => 0}, - ], -}; - -#------------------------- - -$graphs{wsrep_queue} = { - config => { - global_attrs => { - title => 'Galera queues', - vlabel => 'queue length received (-) / sent (+) per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_local_recv_queue', label => 'Receive queue length', - type => 'GAUGE', - graph => 'no'}, - {name => 'wsrep_local_recv_queue_min', label => 'Receive queue length min', - type => 'GAUGE', - graph => 'no'}, - {name => 'wsrep_local_recv_queue_avg', label => 'Average receive queue length', - type => 'GAUGE', - graph => 'no'}, - {name => 'wsrep_local_recv_queue_max', label => 'Receive queue length max', - type => 'GAUGE', - graph => 'no'}, - {name => 'wsrep_local_send_queue', label => 'Send queue length', - type => 'GAUGE', - negative => 'wsrep_local_recv_queue'}, - {name => 'wsrep_local_send_queue_min', label => 'Send queue length min', - type => 'GAUGE', - negative => 'wsrep_local_recv_queue_min'}, - {name => 'wsrep_local_send_queue_avg', label => 'Average send queue length', - type => 'GAUGE', - negative => 'wsrep_local_recv_queue_avg'}, - {name => 'wsrep_local_send_queue_max', label => 'Send queue length max', - type => 'GAUGE', - negative => 'wsrep_local_recv_queue_max'}, - ], -}; - -#------------------------- - -$graphs{wsrep_concurrency} = { - config => { - global_attrs => { - title => 'Galera Performance - Apply to Commit', - vlabel => 'commit + / apply - ' - }, - data_source_attrs => { - draw => 'LINE1', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'wsrep_apply_window', label => 'apply window', - graph => 'no'}, - {name => 'wsrep_apply_oooe', label => 'apply out of order', - graph => 'no'}, - {name => 'wsrep_apply_oool', label => 'apply out of order (slowness)', - graph => 'no'}, - {name => 'wsrep_commit_window', label => 'commit window', - negative => 'wsrep_apply_window'}, - {name => 'wsrep_commit_oooe', label => 'commit out of order', - negative => 'wsrep_apply_oooe'}, - {name => 'wsrep_commit_oool', label => 'commit out of order (slowness)', - negative => 'wsrep_apply_oool'}, - ], -}; - -#------------------------- - -$graphs{wsrep_flow} = { - config => { - global_attrs => { - title => 'Galera flow control', - vlabel => 'events received (-) / sent (+) per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_flow_control_recv', label => 'Pause events received', - type => 'DERIVE', - min => 0, - graph => 'no'}, - {name => 'wsrep_flow_control_sent', label => 'Pause events sent', - type => 'DERIVE', - min => 0, - negative => 'wsrep_flow_control_recv'}, - ], - }; - - - -#------------------------- - -$graphs{wsrep_flow_paused} = { - config => { - global_attrs => { - title => 'Galera flow control paused ratio', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_flow_control_paused', label => 'Ratio flow control was paused', - type => 'GAUGE', - min => '0', - max => '1', - warning => 0.1, - critical => 0.9}, - ], - }; - -#------------------------- - -$graphs{wsrep_flow_paused_ns} = { - config => { - global_attrs => { - title => 'Galera flow control paused time', - vlabel => 'nanoseconds', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_flow_control_paused_ns', label => 'Time flow control was paused (ns)', - min => '0', - warning => 20000, - critical => 1000000}, - ], - }; - -#------------------------- - -$graphs{wsrep_distance} = { - config => { - global_attrs => { - title => 'Galera distance', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'wsrep_cert_deps_distance', label => 'cert_deps_distance', - type => 'GAUGE'}, - {name => 'wsrep_cert_index_size', label => 'wsrep_cert_index_size', - type => 'GAUGE'}, - {name => 'wsrep_slave_threads', label => 'wsrep_slave_threads', - type => 'GAUGE'}, - {name => 'wsrep_commit_window', label => 'commit_window', - type => 'GAUGE'}, - ], -}; - -#------------------------- -$graphs{bin_relay_log} = { - config => { - global_attrs => { - title => 'Binary/Relay Logs', - vlabel => 'Log activity', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'Binlog_cache_disk_use', label => 'Binlog Cache Disk Use'}, - {name => 'Binlog_cache_use', label => 'Binlog Cache Use'}, - {name => 'Binlog_stmt_cache_disk_use', label => 'Binlog Statement Cache Disk Use'}, - {name => 'Binlog_stmt_cache_use', label => 'Binlog Statement Cache Use'}, - {name => 'ma_binlog_size', label => 'Binary Log Space'}, - {name => 'relay_log_space', label => 'Relay Log Space'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{commands} = { - config => { - global_attrs => { - title => 'Command Counters', - vlabel => 'Commands per ${graph_period}', - total => 'Questions', - }, - data_source_attrs => {}, - }, - data_sources => [ - {name => 'Com_delete', label => 'Delete'}, - {name => 'Com_insert', label => 'Insert'}, - {name => 'Com_insert_select', label => 'Insert select'}, - {name => 'Com_load', label => 'Load Data'}, - {name => 'Com_replace', label => 'Replace'}, - {name => 'Com_replace_select', label => 'Replace select'}, - {name => 'Com_select', label => 'Select'}, - {name => 'Com_update', label => 'Update'}, - {name => 'Com_update_multi', label => 'Update multi'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{connections} = { - config => { - global_attrs => { - title => 'Connections', - vlabel => 'Connections per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'max_connections', label => 'Max connections', - type => 'GAUGE', - draw => 'AREA', - colour => 'cdcfc4'}, - {name => 'Max_used_connections', label => 'Max used', - type => 'GAUGE', - draw => 'AREA', - colour => 'ffd660'}, - {name => 'Aborted_clients', label => 'Aborted clients'}, - {name => 'Aborted_connects', label => 'Aborted connects'}, - {name => 'Threads_connected', label => 'Threads connected', - type => 'GAUGE'}, - {name => 'Threads_running', label => 'Threads running', - type => 'GAUGE'}, - {name => 'Connections', label => 'New connections'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{files} = { - config => { - global_attrs => { - title => 'Files', - }, - data_source_attrs => { - type => 'GAUGE', - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'open_files_limit', label => 'File Limit', - draw => 'AREA', - colour => 'cdcfc4'}, - {name => 'Open_files', label => 'Open files', - type => 'DERIVE', - min => 0}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{tables} = { - config => { - global_attrs => { - title => 'Tables', - }, - data_source_attrs => { - type => 'GAUGE', - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'table_open_cache', label => 'Table cache', - draw => 'AREA', - colour => 'cdcfc4'}, - {name => 'innodb_open_files', label => 'Innodb Table Cache Limit', - draw => 'AREA', - colour => 'ffd660'}, - {name => 'Open_tables', label => 'Open tables'}, - {name => 'Slave_open_temp_tables', label => 'Open Slave Temp Tables'}, - {name => 'Opened_tables', label => 'Opened tables', - type => 'DERIVE', - min => 0}, - {name => 'Opened_views', label => 'Opened Views', - type => 'DERIVE', - min => 0}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{table_definitions} = { - config => { - global_attrs => { - title => 'Tables Definitions', - }, - data_source_attrs => { - type => 'GAUGE', - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'table_definition_cache', label => 'Cache Limit', - draw => 'AREA', - colour => 'cdcfc4'}, - {name => 'Open_table_definitions', label => 'Open'}, - {name => 'Opened_table_definitions', label => 'Opened', - type => 'DERIVE', - min => 0}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_bpool} = { - config => { - global_attrs => { - title => 'InnoDB Buffer Pool', - vlabel => 'Pages', - args => '--base 1024', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_bpool_size', label => 'Buffer pool size', - draw => 'AREA', - colour => 'ffd660'}, - {name => 'ib_bpool_dbpages', label => 'Database pages', - draw => 'AREA', - colour => 'cdcfc4'}, - {name => 'ib_bpool_free', label => 'Free pages'}, - {name => 'ib_bpool_modpages', label => 'Modified pages'}, - {name => 'ib_bpool_oldpages', label => 'Old pages'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_bpool_act} = { - config => { - global_attrs => { - title => 'InnoDB Buffer Pool Activity', - vlabel => 'Pages per ${graph_period}', - total => 'Total', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'ib_bpool_read', label => 'Read'}, - {name => 'ib_bpool_created', label => 'Created'}, - {name => 'ib_bpool_written', label => 'Written'}, - {name => 'ib_bpool_made_young', label => 'Made young'}, - {name => 'ib_bpool_made_not_young', label => 'Made not young'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_bpool_internal_breakdown} = { - config => { - global_attrs => { - title => 'InnoDB Buffer Pool Internal breakdown', - args => '--base 1024 --lower-limit 0', - vlabel => 'bytes', - }, - data_source_attrs => { - min => '0', - draw => 'AREASTACK', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_bpool_internal_adaptive_hash_size_const', label => 'Adaptive Hash const'}, - {name => 'ib_bpool_internal_adaptive_hash_size_var', label => 'Adaptive Hash var'}, - {name => 'ib_bpool_internal_page_hash_size_total', label => 'Page Hash'}, - {name => 'ib_bpool_internal_dictionary_cache_size_const', label => 'Dictionary const'}, - {name => 'ib_bpool_internal_dictionary_cache_size_var', label => 'Dictionary var'}, - {name => 'ib_bpool_internal_file_system_size_const', label => 'Filesystem const'}, - {name => 'ib_bpool_internal_file_system_size_var', label => 'Filesystem var'}, - {name => 'ib_bpool_internal_lock_system_size_const', label => 'Lock system const'}, - {name => 'ib_bpool_internal_lock_system_size_var', label => 'Lock system var'}, - {name => 'ib_bpool_internal_recovery_system_size_const', label => 'Recovery system const'}, - {name => 'ib_bpool_internal_recovery_system_size_var', label => 'Recovery system var'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_insert_buf} = { - config => { - global_attrs => { - title => 'InnoDB Insert Buffer', - vlabel => 'Activity per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'ib_ibuf_inserts', label => 'Merge Inserts'}, - {name => 'ib_ibuf_delete', label => 'Merge Deletes'}, - {name => 'ib_ibuf_merged_rec', label => 'Merged Records'}, - {name => 'ib_ibuf_merges', label => 'Merges'}, - {name => 'ib_ibuf_discard_inserts', label => 'Discard Inserts'}, - {name => 'ib_ibuf_discard_delete', label => 'Discard Deletes'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_adaptive_hash} = { - config => { - global_attrs => { - title => 'InnoDB Adaptive Hash Optimiser', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'Innodb_adaptive_hash_hash_searches', label => 'Hash Searches'}, - {name => 'Innodb_adaptive_hash_non_hash_searches', label => 'Nonhash Searches'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_io} = { - config => { - global_attrs => { - title => 'InnoDB IO', - vlabel => 'IO operations per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'ib_io_read', label => 'File reads'}, - {name => 'ib_io_write', label => 'File writes'}, - {name => 'ib_io_log', label => 'Log writes'}, - {name => 'ib_io_fsync', label => 'File syncs'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_io_pend} = { - config => { - global_attrs => { - title => 'InnoDB IO Pending', - vlabel => 'Pending operations', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'ib_iop_log', label => 'AIO Log'}, - {name => 'ib_iop_sync', label => 'AIO Sync'}, - {name => 'ib_iop_flush_bpool', label => 'Buf Pool Flush'}, - {name => 'ib_iop_flush_log', label => 'Log Flushes'}, - {name => 'ib_iop_ibuf_aio', label => 'Insert Buf AIO Read'}, - {name => 'ib_iop_aioread', label => 'Normal AIO Reads'}, - {name => 'ib_iop_aiowrite', label => 'Normal AIO Writes'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_log} = { - config => { - global_attrs => { - title => 'InnoDB Log', - vlabel => 'Log activity per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'innodb_log_buffer_size', label => 'Buffer Size', - type => 'GAUGE', - draw => 'AREA', - colour => 'fafd9e'}, - {name => 'ib_log_flush', label => 'KB Flushed'}, - {name => 'ib_log_written', label => 'KB Written'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_rows} = { - config => { - global_attrs => { - title => 'InnoDB Row Operations', - vlabel => 'Operations per ${graph_period}', - total => 'Total', - }, - data_source_attrs => {}, - }, - data_sources => [ - {name => 'Innodb_rows_deleted', label => 'Deletes'}, - {name => 'Innodb_rows_inserted', label => 'Inserts'}, - {name => 'Innodb_rows_read', label => 'Reads'}, - {name => 'Innodb_rows_updated', label => 'Updates'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_semaphores} = { - config => { - global_attrs => { - title => 'InnoDB Semaphores', - vlabel => 'Semaphores per ${graph_period}', - }, - data_source_attrs => { - draw => 'AREASTACK', - }, - }, - data_sources => [ - {name => 'ib_spin_rounds', label => 'Spin Rounds'}, - {name => 'ib_spin_waits', label => 'Spin Waits'}, - {name => 'ib_os_waits', label => 'OS Waits'}, - {name => 'ib_rw_shared_rounds', label => 'RW/S Rounds'}, - {name => 'ib_rw_shared_waits', label => 'RW/S Waits'}, - {name => 'ib_rw_shared_os_waits', label => 'RW/S OS Waits'}, - {name => 'ib_rw_excl_rounds', label => 'RW/X Rounds'}, - {name => 'ib_rw_excl_waits', label => 'RW/X Waits'}, - {name => 'ib_rw_excl_os_waits', label => 'RW/X OS Waits'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_tnx} = { - config => { - global_attrs => { - title => 'InnoDB Transactions', - vlabel => 'Transactions per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'ib_tnx', label => 'Transactions created'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_history_list_length} = { - config => { - global_attrs => { - title => 'InnoDB History List Length', - vlabel => 'Undo log units', - }, - data_source_attrs => { - draw => 'LINE1', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_tnx_hist', label => 'History List Length'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_srv_master_thread} = { - config => { - global_attrs => { - title => 'InnoDB Master Thread', - }, - data_source_attrs => { - type => 'DERIVE', - draw => 'AREASTACK', - }, - }, - data_sources => [ - {name => 'ib_srv_main_flush_loops', label => 'Flush Loop'}, - {name => 'ib_srv_main_background_loops', label => 'Background Loop'}, - {name => 'ib_srv_main_flushs_writes', label => 'Flushes/Writes', draw => 'LINE1'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_queries} = { - config => { - global_attrs => { - title => 'InnoDB Engine Queries and Transactions', - args => '--lower-limit 0', - }, - data_source_attrs => { - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_innodb_queries', label => 'Active'}, - {name => 'ib_innodb_transactions_active', label => 'Transactions'}, - {name => 'ib_innodb_query_queue_len', label => 'Queued'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_read_views} = { - config => { - global_attrs => { - title => 'InnoDB Read Views', - args => '--lower-limit 0', - }, - data_source_attrs => { - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_innodb_read_views', label => 'Views'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{innodb_descriptors} = { - config => { - global_attrs => { - title => 'InnoDB Descriptors', - args => '--lower-limit 0', - }, - data_source_attrs => { - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'ib_innodb_descriptors', label => 'Descriptors'}, - {name => 'ib_innodb_descriptors_max', label => 'Max', draw => 'AREA', colour => 'ffd660'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{performance} = { - config => { - global_attrs => { - title => 'Performance Schema Losses', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'Performance_schema_cond_classes_lost', label => 'Condition classes'}, - {name => 'Performance_schema_cond_instances_lost', label => 'Condition instances'}, - {name => 'Performance_schema_file_classes_lost', label => 'File classes'}, - {name => 'Performance_schema_file_handles_lost', label => 'File handles'}, - {name => 'Performance_schema_file_instances_lost', label => 'File instances'}, - {name => 'Performance_schema_locker_lost', label => 'Locker'}, - {name => 'Performance_schema_mutex_classes_lost', label => 'Mutex classes'}, - {name => 'Performance_schema_mutex_instances_lost', label => 'Mutex instances'}, - {name => 'Performance_schema_rwlock_classes_lost', label => 'Read/Write lock classes'}, - {name => 'Performance_schema_rwlock_instances_lost', label => 'Read/Write lock instances'}, - {name => 'Performance_schema_table_handles_lost', label => 'Table handles'}, - {name => 'Performance_schema_table_instances_lost', label => 'Table instances'}, - {name => 'Performance_schema_thread_classes_lost', label => 'Thread classes'}, - {name => 'Performance_schema_thread_instances_lost', label => 'Thread instances'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{myisam_indexes} = { - config => { - global_attrs => { - title => 'MyISAM Indexes', - vlabel => 'Requests per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Key_read_requests', label => 'Key read requests'}, - {name => 'Key_reads', label => 'Key reads'}, - {name => 'Key_write_requests', label => 'Key write requests'}, - {name => 'Key_writes', label => 'Key writes'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{network_traffic} = { - config => { - global_attrs => { - title => 'Network Traffic', - args => '--base 1024', - vlabel => 'Bytes received (-) / sent (+) per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Bytes_received', label => 'Bytes transferred', - graph => 'no'}, - {name => 'Bytes_sent', label => 'Bytes transferred', - negative => 'Bytes_received'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{qcache} = { - config => { - global_attrs => { - title => 'Query Cache', - vlabel => 'Commands per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'Qcache_queries_in_cache', label => 'Queries in cache', type => 'GAUGE'}, - {name => 'Qcache_hits', label => 'Cache hits'}, - {name => 'Subquery_cache_hit', label => 'Subquery Cache hits'}, - {name => 'Subquery_cache_miss', label => 'Subquery Cache misses'}, - {name => 'Qcache_inserts', label => 'Inserts'}, - {name => 'Qcache_not_cached', label => 'Not cached'}, - {name => 'Qcache_lowmem_prunes', label => 'Low-memory prunes'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{qcache_mem} = { - config => { - global_attrs => { - title => 'Query Cache Memory', - vlabel => 'Bytes', - args => '--base 1024 --lower-limit 0', - }, - data_source_attrs => { - draw => 'AREA', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'query_cache_size', label => 'Cache size'}, - {name => 'Qcache_free_memory', label => 'Free mem'}, - ], -}; - - -#--------------------------------------------------------------------- - -$graphs{max_mem} = { - config => { - global_attrs => { - title => 'Maximum memory that Mysql could use', - vlabel => 'Bytes', - args => '--base 1024 --lower-limit 0', - }, - data_source_attrs => { - draw => 'AREASTACK', - type => 'GAUGE', - }, - }, - data_sources => [ - {name => 'mysql_connection_memory', label => 'Connection Memory'}, - {name => 'mysql_base_memory', label => 'Base MYSQL Memory'}, - ], -}; - - -#--------------------------------------------------------------------- - -$graphs{replication} = { - config => { - global_attrs => { - title => 'Replication', - vlabel => 'Activity', - }, - data_source_attrs => { - draw => 'LINE1', - }, - }, - data_sources => [ - {name => 'slave_io_running', label => 'Slave IO Running', - type => 'GAUGE', - draw => 'AREA'}, - {name => 'slave_sql_running', label => 'Slave SQL Running', - type => 'GAUGE', - draw => 'AREA'}, - {name => 'Slave_retried_transactions', label => 'Retried Transactions'}, - {name => 'Slave_open_temp_tables', label => 'Open Temp Tables'}, - {name => 'seconds_behind_master', label => 'Secs Behind Master', - type => 'GAUGE'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{select_types} = { - config => { - global_attrs => { - title => 'Select types', - vlabel => 'Commands per ${graph_period}', - total => 'Total', - }, - data_source_attrs => {}, - }, - data_sources => [ - {name => 'Select_full_join', label => 'Full join'}, - {name => 'Select_full_range_join', label => 'Full range'}, - {name => 'Select_range', label => 'Range'}, - {name => 'Select_range_check', label => 'Range check'}, - {name => 'Select_scan', label => 'Scan'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{slow} = { - config => { - global_attrs => { - title => 'Slow Queries', - vlabel => 'Slow queries per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Slow_queries', label => 'Slow queries'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{sorts} = { - config => { - global_attrs => { - title => 'Sorts', - vlabel => 'Sorts / ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Sort_rows', label => 'Rows sorted'}, - {name => 'Sort_range', label => 'Range'}, - {name => 'Sort_merge_passes', label => 'Merge passes'}, - {name => 'Sort_scan', label => 'Scan'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{table_locks} = { - config => { - global_attrs => { - title => 'Table locks', - vlabel => 'locks per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Table_locks_immediate', label => 'Table locks immed'}, - {name => 'Table_locks_waited', label => 'Table locks waited'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{tmp_tables} = { - config => { - global_attrs => { - title => 'Temporary objects', - vlabel => 'Objects per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - }, - }, - data_sources => [ - {name => 'Created_tmp_disk_tables', label => 'Temp disk tables'}, - {name => 'Created_tmp_tables', label => 'Temp tables'}, - {name => 'Created_tmp_files', label => 'Temp files'}, - ], -}; - - -#--------------------------------------------------------------------- - -$graphs{rows} = { - config => { - global_attrs => { - title => 'Rows', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Rows_read', label => 'Read'}, - {name => 'Rows_sent', label => 'Sent'}, - {name => 'Rows_tmp_read', label => 'Temp Read'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{handler_read} = { - config => { - global_attrs => { - title => 'Read Handler', - }, - data_source_attrs => { - draw => 'AREASTACK', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_read_first', label => 'Key First'}, - {name => 'Handler_read_key', label => 'Key Read'}, - {name => 'Handler_read_last', label => 'Key Last'}, - {name => 'Handler_read_prev', label => 'Key Prev'}, - {name => 'Handler_read_rnd', label => 'Row position'}, - {name => 'Handler_read_rnd_deleted', label => 'Row position delete'}, - {name => 'Handler_read_rnd_next', label => 'Row position next'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{handler_transaction} = { - config => { - global_attrs => { - title => 'Transactions Handler', - }, - data_source_attrs => { - draw => 'AREASTACK', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_commit', label => 'Commit'}, - {name => 'Handler_rollback', label => 'Rollback'}, - {name => 'Handler_savepoint', label => 'Savepoint'}, - {name => 'Handler_savepoint_rollback', label => 'Savepoint Rollback'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{handler_write} = { - config => { - global_attrs => { - title => 'Write/Update Handler', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_write', label => 'Writes'}, - {name => 'Handler_update', label => 'Updates'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{handler_tmp} = { - config => { - global_attrs => { - title => 'Temporary Write/Update Handler', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_tmp_write', label => 'Writes'}, - {name => 'Handler_tmp_update', label => 'Updates'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{execution} = { - config => { - global_attrs => { - title => 'Execution Events', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Executed_events', label => 'Events'}, - {name => 'Executed_triggers', label => 'Triggers'}, - ], - }; - -#--------------------------------------------------------------------- - -$graphs{icp} = { - config => { - global_attrs => { - title => 'Index Condition Pushdown', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_icp_attempts', label => 'Attempts'}, - {name => 'Handler_icp_match', label => 'Matches'}, - ], -}; - -#--------------------------------------------------------------------- - -$graphs{mrr} = { - config => { - global_attrs => { - title => 'Multi Range Read optimizations', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - data_sources => [ - {name => 'Handler_mrr_init', label => 'Uses'}, - {name => 'Handler_mrr_key_refills', label => 'Key refills'}, - {name => 'Handler_mrr_rowid_refills', label => 'Row refills'}, - ], -}; - -#--------------------------------------------------------------------- -# Plugin Graphs -# These are mysql plugins of type INFORMATION SCHEMA -# -# These will be added to $graphs if available -#--------------------------------------------------------------------- - -my %graph_plugins = (); - -$graph_plugins{query_response_time} = { - count => { - config => { - global_attrs => { - title => 'Query Response Time Count', - vlabel => 'queries per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - # data_sources are populated by sub plugin_query_response_time - data_sources => [ - ], - }, - total => { - config => { - global_attrs => { - title => 'Query Response Time Total', - vlabel => 'query time (microseconds) per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - # data_sources are populated by sub plugin_query_response_time - data_sources => [ - ], - } -}; - -$graph_plugins{user_statistics} = { - connections => { - config => { - global_attrs => { - title => 'User Connections', - vlabel => 'connections per ${graph_period}', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - cols => { 'total_connections' => {}, 'concurrent_connections' => {}, 'denied_connections' => {}, 'lost_connections' => {}}, - data_sources => [ - ], - }, - usertime => { - config => { - global_attrs => { - title => 'User Time', - vlabel => 'seconds', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - cols => { 'connected_time' => {}, 'busy_time' => {}, 'cpu_time' => {} }, - data_sources => [ - ], - }, - bytes => { - config => { - global_attrs => { - title => 'User Bytes', - vlabel => 'bytes', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - cols => { 'bytes_received' => {}, 'bytes_sent' => {}, 'binlog_bytes_written' => {} }, - data_sources => [ - ], - }, - rows => { - config => { - global_attrs => { - title => 'User Rows', - vlabel => 'rows', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - cols => { 'rows_read' => {}, 'rows_sent' => {}, 'rows_deleted' => {}, 'rows_inserted' => {}, 'rows_updated' => {} }, - data_sources => [ - ], - }, - commands => { - config => { - global_attrs => { - title => 'Command breakdown by user', - vlabel => 'commands', - }, - data_source_attrs => { - draw => 'LINE2', - type => 'DERIVE', - }, - }, - cols => { 'select_commands' => {}, 'update_commands' => {}, 'other_commands' => {}, 'commit_transactions' => {}, 'rollback_transactions' => {} }, - data_sources => [ - ], - } - -}; -#--------------------------------------------------------------------- -# M A I N -#--------------------------------------------------------------------- - - -# -# Global hash holding the data collected from mysql. -# -our $data; # Was 'my'. Changed to 'our' to facilitate testing. - - -sub main { - my $graph = basename($0); - $graph =~ s/^mysql[0-9]*_//g; # allow multiple instances - my $command = $ARGV[0] || 'show'; - - my %command_map = ( - 'autoconf' => \&autoconf, - 'config' => \&config, - 'show' => \&show, - 'suggest' => \&suggest, - ); - - die "Unknown command: $command" - unless exists $command_map{$command}; - - die "Missing dependency Cache::Cache" - unless $has_cache || $command eq 'autoconf'; - - return $command_map{$command}->($graph); -} - - -#--------------------------------------------------------------------- -# C O M M A N D H A N D L E R S -#--------------------------------------------------------------------- - -# Each command handler should return an appropriate exit code - - -# http://munin-monitoring.org/wiki/ConcisePlugins#autoconf -sub autoconf { - unless ($has_cache) { - print "no (Missing dependency Cache::Cache)\n"; - return 0; - } - - eval { - db_connect(); - }; - if ($@) { - my $err = $@; - $err =~ s{\s at \s \S+ \s line .*}{}xms; - print "no ($err)\n"; - return 0; - } - print "yes\n"; - return 0; -} - - -# http://munin-monitoring.org/wiki/ConcisePlugins#suggest -sub suggest { - - # What is the best way to decide which graphs is applicable to a - # given system? - # Answer: - # Use lack of variables to indicate that the capability doesn't exist - # Use variable values to indicate some graph isn't currently used. - # update_data() now does this. - - update_data(); - - - foreach my $graph (sort keys(%graphs)) { - next if $graph =~ /innodb_/ && $data->{_innodb_disabled}; - next if $graph =~ /wsrep_/ && $data->{_galera_disabled}; - print "$graph\n"; - } - - return 0; -} - - -sub config { - my $graph_name = shift; - - # In MySQL 5.1 (and probably erlier versions as well) status - # variables are unique when looking at the last 19 characters. - # - # SELECT RIGHT(variable_name, 19), COUNT(*) - # FROM information_schema.global_status - # GROUP BY RIGHT(variable_name, 19) - # HAVING COUNT(*) > 1; - # - # Empty set (0.06 sec) - # - # There is one duplicate when looking at server variables - # - # SELECT RIGHT(variable_name, 19), COUNT(*) - # FROM information_schema.global_variables - # GROUP BY RIGHT(variable_name, 19) - # HAVING COUNT(*) > 1; - # - # +--------------------------+----------+ - # | RIGHT(variable_name, 19) | COUNT(*) | - # +--------------------------+----------+ - # | OW_PRIORITY_UPDATES | 2 | - # +--------------------------+----------+ - # 1 row in set (0.05 sec) - # - # show global variables like '%OW_PRIORITY_UPDATES'; - # - # +--------------------------+-------+ - # | Variable_name | Value | - # +--------------------------+-------+ - # | low_priority_updates | OFF | - # | sql_low_priority_updates | OFF | - # +--------------------------+-------+ - # 2 rows in set (0.00 sec) - # - # Not a problem since we don't graph these - - update_data(); - - die 'Unknown graph ' . ($graph_name ? $graph_name : '') - unless $graphs{$graph_name}; - - my $graph = $graphs{$graph_name}; - - my %conf = (%{$defaults{global_attrs}}, %{$graph->{config}{global_attrs}}); - while (my ($k, $v) = each %conf) { - print "graph_$k $v\n"; - } - if ($graph_name =~ /wsrep_/) { - print "graph_category galera\n"; - } else { - print "graph_category mysql\n"; - } - - my $i = 0; - for my $ds (@{$graph->{data_sources}}) { - my %ds_spec = ( - %{$defaults{data_source_attrs}}, - %{$graph->{config}{data_source_attrs}}, - %$ds, - ); - while (my ($k, $v) = each %ds_spec) { - # 'name' is only used internally in this script, not - # understood by munin. - next if ($k eq 'name'); - - # AREASTACK is part of munin as of version 1.3.3 (not - # released yet). Until then ... - if ($k eq 'draw' && $v eq 'AREASTACK') { - printf("%s.%s %s\n", - clean_fieldname($ds->{name}), $k, ($i ? 'STACK' : 'AREA')); - } - else { - printf("%s.%s %s\n", clean_fieldname($ds->{name}), $k, $v); - } - $i++; - } - print_thresholds(clean_fieldname($ds->{name})); - } - - return 0; -} - -sub show { - my $graph_name = shift; - - update_data(); - - die 'Unknown graph ' . ($graph_name ? $graph_name : '') - unless $graphs{$graph_name}; - - my $graph = $graphs{$graph_name}; - - die "Can't show data for '$graph_name' because InnoDB is disabled." - if $graph_name =~ /innodb_/ && $data->{_innodb_disabled}; - - die "Can't show data for '$graph_name' because not a Galera mysql version." - if $graph_name =~ /wsrep_/ && $data->{_galera_disabled}; - - for my $ds (@{$graph->{data_sources}}) { - printf "%s.value %s\n", - clean_fieldname($ds->{name}), - defined $data->{$ds->{name}} ? $data->{$ds->{name}} : 'U'; - } - - return 0; -} - - - -#--------------------------------------------------------------------- -# U T I L I T Y S U B S -#--------------------------------------------------------------------- - - -sub db_connect { - my $dsn = "$config{dsn};mysql_connect_timeout=5"; - - return DBI->connect($dsn, $config{user}, $config{password}, { - RaiseError => 1, - PrintError => 0, - FetchHashKeyName => 'NAME_lc', - }); -} - - -sub update_data { - $data = $shared_memory_cache->get('data'); - my $graphs_stored = $shared_memory_cache->get('graphs'); - %graphs = %{thaw($graphs_stored)} if $graphs_stored; - return if $data; - - $data = {}; - - my $dbh = db_connect(); - - update_variables($dbh); - update_plugins($dbh); - update_innodb($dbh); - update_master($dbh); - delete $graphs{replication} if update_slave($dbh)==1; - - delete $graphs{bin_relay_log} if not defined $data->{relay_log_space} - && not defined $data->{ma_binlog_size}; - - delete $graphs{execution} if not defined $data->{Executed_events} - && not defined $data->{Executed_triggers}; - - delete $graphs{icp} if not defined $data->{Handler_icp_attempts} - && not defined $data->{Handler_icp_matches}; - - delete $graphs{innodb_adaptive_hash} - if not defined $data->{Innodb_adaptive_hash_hash_searches} - && not defined $data->{Innodb_adaptive_hash_non_hash_searches}; - - delete $graphs{innodb_bpool_internal_breakdown} - if not defined $data->{ib_bpool_internal_adaptive_hash_size_const}; - - delete $graphs{innodb_descriptors} - if not defined $data->{ib_innodb_descriptors}; - - delete $graphs{mrr} if not defined $data->{Handler_mrr_init}; - - delete $graphs{rows} if not defined $data->{Rows_sent}; - - delete $graphs{handler_temp} if not defined $data->{Handler_tmp_write}; - - $shared_memory_cache->set('data', $data); - $shared_memory_cache->set('graphs', nfreeze(\%graphs)); -} - - -sub update_plugins { - my ($dbh) = @_; - - my %plugin_map = ( - 'query_response_time' => \&plugin_query_response_time, - ); - - sub add_graphs { - my ($f, $sec, $dbh, %g) = @_; - if ($f->($dbh) == 0) { - while (my ($k, $v) = each %g) { - $graphs{$sec . '_' . $k} = $v; - } - } - } - - my $sth = $dbh->prepare("SHOW PLUGINS"); - $sth->execute(); - while (my $row = $sth->fetchrow_hashref()) { - next if $row->{'type'} ne 'INFORMATION SCHEMA'; - my $sec = lc $row->{'name'}; - next if not exists $plugin_map{$sec}; - add_graphs($plugin_map{$sec}, $sec, $dbh, %{$graph_plugins{$sec}}); - } - $sth->finish(); - - my %is_map = ( - 'user_statistics' => \&is_user_statistics, - ); - - $sth = $dbh->prepare("SHOW TABLES IN INFORMATION_SCHEMA"); - $sth->execute(); - while (my $row = $sth->fetchrow_hashref()) { - my $sec = lc $row->{'tables_in_information_schema'}; - next if not exists $is_map{$sec}; - add_graphs($is_map{$sec}, $sec, $dbh, %{$graph_plugins{$sec}}); - } - $sth->finish(); -} - -sub update_variables { - my ($dbh) = @_; - my @queries = ( - 'SHOW GLOBAL STATUS', - 'SHOW GLOBAL VARIABLES', - ); - - my %variable_name_map = ( - table_cache => 'table_open_cache', # table_open_cache was - # previously known as - # table_cache in MySQL - # 5.1.2 and earlier. - ); - my %wsrep_cluster_status_map = ( - 'Primary' => 0, - 'non-Primary' => 1, - ); - - for my $query (@queries) { - $data->{$query} = {}; - - my $sth = $dbh->prepare($query); - $sth->execute(); - while (my $row = $sth->fetch) { - my $var = $variable_name_map{$row->[0]} || $row->[0]; - $data->{$var} = $row->[1]; - } - $sth->finish(); - } - - $data->{'mysql_base_memory'} = $data->{'key_buffer_size'} - + $data->{'query_cache_size'} - + $data->{'innodb_buffer_pool_size'} - + ( $data->{'innodb_additional_mem_pool_size'} || 0 ) - + $data->{'innodb_log_buffer_size'} - + ( $data->{'tokudb_cache_size'} || 0 ); - - my $tmp_table_size = $data->{'tmp_table_size'}; - my $max_heap_table_size = $data->{'max_heap_table_size'}; - $data->{'mysql_connection_memory'} = $data->{'read_buffer_size'} - + $data->{'read_rnd_buffer_size'} - + $data->{'sort_buffer_size'} - + $data->{'join_buffer_size'} - + $data->{'binlog_cache_size'} - + $data->{'thread_stack'} - + ( $tmp_table_size >= $max_heap_table_size ? $tmp_table_size : $max_heap_table_size ) - + ( $data->{'tokudb_read_buf_size'} || 0 ); - - # wsrep_thread_count was separated from max_connections for mariadb-5.5.38 https://mariadb.atlassian.net/browse/MDEV-6206 - $data->{'mysql_connection_memory'} *= $data->{'max_connections'} + ( $data->{'wsrep_thread_count'} || 0 ); - - if ($data->{wsrep_cluster_status}) { - my $var = $wsrep_cluster_status_map{$data->{wsrep_cluster_status}}; - $data->{wsrep_cluster_status} = $var; - } - $data->{_galera_disabled} = 1 unless ($data->{wsrep_provider_name}); -} - - -sub update_innodb { - my ($dbh) = @_; - - my $sth = $dbh->prepare('SHOW /*!50000 ENGINE*/ INNODB STATUS'); - eval { - $sth->execute(); - }; - if ($@) { - if ($@ =~ /Unknown (storage|table) engine 'INNODB'|Cannot call SHOW INNODB STATUS because skip-innodb is defined/i) { - $data->{_innodb_disabled} = 1; - return; - } - die $@; - } - my $row = $sth->fetchrow_hashref(); - my $status = $row->{'status'}; - $sth->finish(); - - parse_innodb_status($status); -} - - -sub update_master { - my ($dbh) = @_; - - my $sth = $dbh->prepare('SHOW MASTER LOGS'); - eval { - $sth->execute(); - }; - if ($@) { - # SHOW MASTER LOGS failed because binlog is not enabled - return if $@ =~ /You are not using binary logging/; - die $@; - } - - while (my $row = $sth->fetch) { - $data->{ma_binlog_size} += $row->[1]; - } - - $sth->finish(); -} - - -sub update_slave { - my ($dbh) = @_; - - my $sth = $dbh->prepare('SHOW SLAVE STATUS'); - $sth->execute(); - my $row = $sth->fetchrow_hashref(); - return 1 unless $row; - while (my ($k, $v) = each %$row) { - $data->{$k} = $v; - } - $sth->finish(); - - # We choose master_host here as a stopped slave - # may not indicate that we have reset all slave capability - # however the minimium requirement is a master_host - return 1 if not defined $data->{master_host}; - - # undef when slave is stopped, or when MySQL fails to calculate - # the lag (which happens depresingly often). (mk-heartbeat fixes - # this problem.) - $data->{seconds_behind_master} ||= 0; - - # Track these two fields so we can trigger warnings if the slave stops - # running - $data->{slave_sql_running} = ($data->{slave_sql_running} eq 'Yes') - ? 0 : 1; - $data->{slave_io_running} = ($data->{slave_io_running} eq 'Yes') - ? 0 : 1; - return 0; -} - - -#--------------------------------------------------------------------- -# Information SCHEMA tables represent data to be processed -#--------------------------------------------------------------------- - - -sub plugin_query_response_time { - my ($dbh) = @_; - - return 1 if not defined $data->{query_response_time_stats}; - return 1 if $data->{query_response_time_stats} eq 'OFF'; - - my $sth = $dbh->prepare("SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME"); - $sth->execute(); - while (my $row = $sth->fetchrow_hashref()) { - my $time = $row->{'time'}; - $data->{'query_response_time_count_' . $time} = $row->{'count'}; - push @{$graph_plugins{query_response_time}->{count}->{data_sources}}, {name => 'query_response_time_count_' . $time, label => $time }; - next if $row->{'total'} eq 'TOO LONG'; - $data->{'query_response_time_total_' . $time} = $row->{'total'} * 1e6; - push @{$graph_plugins{query_response_time}->{total}->{data_sources}}, {name => 'query_response_time_total_' . $time, label => $time }; - } - $sth->finish(); - - return 0; -} - -sub is_user_statistics { - my ($dbh) = @_; - - return 1 if not defined $data->{userstat}; - return 1 if $data->{userstat} eq 'OFF'; - - my $sth = $dbh->prepare("SELECT * FROM INFORMATION_SCHEMA.USER_STATISTICS"); - $sth->execute(); - while (my $row = $sth->fetchrow_hashref()) { - my $user = $row->{'user'}; - my $var; - while (my ($g, $v) = each %{$graph_plugins{user_statistics}}) { - while (my ($userstat,$conf) = each %{$v->{cols}}) { - $var = 'user_stats_' . $user . '_' . $userstat; - $data->{$var} = int $row->{$userstat}; - my $ds = { %$conf }; - $ds->{name} = $var; - $ds->{label} = $user . ' ' . $userstat; - push @{$graph_plugins{user_statistics}->{$g}->{data_sources}}, $ds; - } - } - } - $sth->finish(); - return 0; -} - -# -# In 'SHOW ENGINE INNODB STATUS' 64 bit integers are not formated as -# plain integers. They are either: -# -# - split in two and needs to be shifted together, -# - or hexadecimal -# -sub innodb_bigint { - my ($x, $y) = @_; - - return defined $y - ? Math::BigInt->new($x)->blsft(32) + $y - : Math::BigInt->new("0x$x"); -} - -#--------------------------------------------------------------------- -# P A R S E 'SHOW ENGINE INNODB STATUS' O U T P U T -#--------------------------------------------------------------------- - - -# A nice walk through -# http://www.mysqlperformanceblog.com/2006/07/17/show-innodb-status-walk-through/ - -# The parsing is split in one subrutine per section. Each subroutine -# should parse a block with the following structure -# -# block body ... -# more lines .... -# ---------- - -sub parse_innodb_status { - local $_ = shift; - - # Add a dummy section to the end in case the innodb status output - # has been truncated (Happens for status > 64K characters) - $_ .= "\n----------\nDUMMY\n----------\n"; - - my %section_map = ( - - 'BUFFER POOL AND MEMORY' => \&parse_buffer_pool_and_memory, - 'INDIVIDUAL BUFFER POOL INFO' => \&parse_individual_buffer_pool, - 'FILE I/O' => \&parse_file_io, - 'INSERT BUFFER AND ADAPTIVE HASH INDEX' - => \&parse_insert_buffer_and_adaptive_hash_index, - 'LATEST DETECTED DEADLOCK' => \&skip, - 'LATEST FOREIGN KEY ERROR' => \&skip, - 'LOG' => \&parse_log, - 'ROW OPERATIONS' => \&parse_row_operations, - 'SEMAPHORES' => \&parse_semaphores, - 'TRANSACTIONS' => \&parse_transactions, - 'BACKGROUND THREAD' => \&parse_background_thread, - ); - - skip_heading(); - parse_header_seconds(); - for (;;) { - m/\G(.*)\n/gc; - my $sec = $1; - - last if $sec eq 'END OF INNODB MONITOR OUTPUT'; - if ($sec eq 'DUMMY') { - handle_incomplete_innodb_status(); - last; - } - - if (exists $section_map{$sec}) { - $section_map{$sec}->(); - } else { - #warn "Unknown section: $1"; - skip(); - } - } -} - - -# This regular expression handles the different formating of 64-bit -# integers in different versions of the innodb engine. Either two -# decimal 32-bit integers separated by a space, or a single -# hexadecimal 64-bit integer. -my $innodb_bigint_rx = qr{([[a-fA-F\d]+)(?: (\d+))?}; - - -sub match_new_section { - return m/\G - -+\n # --------------------------- - (?= [A-Z\/ ]+\n # SECTION NAME - [=-]+\n)/gcx; # --------------------------- ('=' on end of output) -} - - -sub skip_line { return m/\G.*\n/gc; } - - -sub skip_heading { - # Heading is 3 lines - for my $foo (1...3) { - skip_line or die('Parse error'); - } -} - - -sub parse_section { - my ($parser) = @_; - - #warn substr($_, pos(), 10); - for (;;) { - return if match_new_section; - next if $parser->(); - skip_line(); - } -} - - -sub skip { parse_section(sub {}); } - - -sub parse_header_seconds { - parse_section( - sub { - m/\GPer second averages calculated from the last (\d+) seconds\n/gc && do { - $data->{innodb_engine_status_seconds} = $1; - return 1; - }; - } - ); -} - - -sub parse_background_thread { - parse_section( - sub { - m/\Gsrv_master_thread loops: \d+ 1_second, \d+ sleeps, \d+ 10_second, (\d+) background, (\d+) flush\n/gc && do { - $data->{ib_srv_main_flush_loops} = $1; - $data->{ib_srv_main_background_loops} = $2; - return 1; - }; - m/\Gsrv_master_thread log flush and writes: (\d+)\n/gc && do { - $data->{ib_srv_main_flushs_writes} = $1; - return 1; - }; - } - ); -} - -sub parse_row_operations { - parse_section( - sub { - m/\G(\d+) queries inside InnoDB, (\d+) queries in queue\n/gc && do { - $data->{ib_innodb_queries} = $1; - $data->{ib_innodb_query_queue_len} = $2; - return 1; - }; - m/\G(\d+) read views open inside InnoDB\n/gc && do { - $data->{ib_innodb_read_views} = $1; - return 1; - }; - m/\G(\d+) transactions active inside InnoDB\n/gc && do { - $data->{ib_innodb_transactions_active} = $1; - return 1; - }; - m/\G(\d+) out of (\d+) descriptors used\n/gc && do { - $data->{ib_innodb_descriptors} = $1; - $data->{ib_innodb_descriptors_max} = $2; - return 1; - }; - # no need for this - its exposed as status variables - # m/\GNumber of rows inserted (\d+), updated (\d+), deleted (\d+), read (\d+)\n/gc && do { - # $data->{ib_innodb_rows_inserted} = $1; - # $data->{ib_innodb_rows_updated} = $2; - # $data->{ib_innodb_rows_deleted} = $3; - # $data->{ib_innodb_rows_read} = $4; - # return 1; - # }; - } - ); -} - -sub parse_semaphores { - parse_section( - sub { - m/\GMutex spin waits (\d+), rounds (\d+), OS waits (\d+)\n/gc && do { - $data->{ib_spin_waits} = $1; - $data->{ib_spin_rounds} = $2; - $data->{ib_os_waits} = $3; - return 1; - }; - m/\GRW-shared spins (\d+), rounds (\d+), OS waits (\d+)\n/gc && do { - $data->{ib_rw_shared_waits} = $1; - $data->{ib_rw_shared_rounds} = $2; - $data->{ib_rw_shared_os_waits} = $3; - return 1; - }; - m/\GRW-excl spins (\d+), rounds (\d+), OS waits (\d+)\n/gc && do { - $data->{ib_rw_excl_waits} = $1; - $data->{ib_rw_excl_rounds} = $2; - $data->{ib_rw_excl_os_waits} = $3; - return 1; - }; - } - ); -} - - -sub parse_transactions { - parse_section( - sub { - m/\GTrx id counter $innodb_bigint_rx\n/gc && do { - $data->{ib_tnx} = innodb_bigint($1, $2); - return 1; - }; - m/\GPurge done for trx's n:o < $innodb_bigint_rx undo n:o < $innodb_bigint_rx\n/gc && do { - if (defined $3) { - # old format - $data->{ib_tnx_prg} = innodb_bigint($1, $2); - # FIX add to data? innodb_bigint($3, $4); - } - else { - # new format - $data->{ib_tnx_prg} = innodb_bigint($1); - # FIX add to data? innodb_bigint($2); - } - return 1; - }; - m/\GHistory list length (\d+)\n/gc && do { - $data->{ib_tnx_hist} = $1; - return 1; - }; - } - ); - -} - - -sub parse_file_io { - parse_section( - sub { - m/\GPending normal aio reads: (\d+)(?: \[(?:\d+, )*\d+\] )?, aio writes: (\d+)(?: \[(?:\d+, )*\d+\] )?,\n\s*ibuf aio reads: (\d+), log i\/o's: (\d+), sync i\/o's: (\d+)\n/gc && do { - $data->{ib_iop_aioread} = $1; - $data->{ib_iop_aiowrite} = $2; - $data->{ib_iop_ibuf_aio} = $3; - $data->{ib_iop_log} = $4; - $data->{ib_iop_sync} = $5; - return 1; - }; - m/\GPending flushes \(fsync\) log: (\d+); buffer pool: (\d+)\n/gc && do { - $data->{ib_iop_flush_log} = $1; - $data->{ib_iop_flush_bpool} = $2; - return 1; - }; - m/\G(\d+) OS file reads, (\d+) OS file writes, (\d+) OS fsyncs\n/gc && do { - $data->{ib_io_read} = $1; - $data->{ib_io_write} = $2; - $data->{ib_io_fsync} = $3; - return 1; - }; - } - ); -} - - -sub parse_insert_buffer_and_adaptive_hash_index { - parse_section( - sub { - # MySQL < 5.5 - m/\G(\d+) inserts, (\d+) merged recs, (\d+) merges\n/gc && do { - $data->{ib_ibuf_inserts} = $1; - $data->{ib_ibuf_merged_rec} = $2; - $data->{ib_ibuf_merges} = $3; - return 1; - }; - # MySQL >= 5.5 - m/\Gmerged operations:\n insert (\d+), delete mark (\d+), delete (\d+)\ndiscarded operations:\n insert (\d+), delete mark (\d+), delete (\d+)\n/gc && do { - $data->{ib_ibuf_inserts} = $1; - $data->{ib_ibuf_delete_mark} = $2; - $data->{ib_ibuf_delete} = $3; - $data->{ib_ibuf_discard_inserts} = $4; - $data->{ib_ibuf_discard_delete_mark} = $5; - $data->{ib_ibuf_discard_delete} = $6; - $data->{ib_ibuf_merged_rec} = $data->{ib_ibuf_inserts} + $data->{ib_ibuf_discard_inserts}; - return 1; - }; - - m/\GIbuf: size (\d+), free list len (\d+), seg size (\d+),(?: (\d+) merges)?\n/gc && do { - $data->{ib_ibuf_size} = $1; - $data->{ib_ibuf_free_len} = $2; - $data->{ib_ibuf_seg_size} = $3; - $data->{ib_ibuf_merges} = $4 if defined $4; # MySQL >= 5.5 - return 1; - }; - } - ); -} - - -sub parse_log { - parse_section( - sub { - m/\GLog sequence number $innodb_bigint_rx\n/gc && do { - $data->{ib_log_written} = innodb_bigint($1, $2); - return 1; - }; - m/\GLog flushed up to\s+$innodb_bigint_rx\n/gc && do { - $data->{ib_log_flush} = innodb_bigint($1, $2); - return 1; - }; - m/\G(\d+) log i\/o's done.*\n/gc && do { - $data->{ib_io_log} = $1; - return 1; - }; - } - ); -} - - -sub parse_buffer_pool_and_memory { - parse_section( - sub { - m/\GBuffer pool size\s+(\d+)\n/gc && do { - $data->{ib_bpool_size} = $1; - return 1; - }; - m/\GBuffer pool size, bytes\s+(\d+)\n/gc && do { - $data->{ib_bpool_size_bytes} = $1; - return 1; - }; - m/\GFree buffers\s+(\d+)\n/gc && do { - $data->{ib_bpool_free} = $1; - return 1; - }; - m/\GDatabase pages\s+(\d+)\n/gc && do { - $data->{ib_bpool_dbpages} = $1; - return 1; - }; - m/\GModified db pages\s+(\d+)\n/gc && do { - $data->{ib_bpool_modpages} = $1; - return 1; - }; - m/\GOld database pages\s+(\d+)\n/gc && do { - $data->{ib_bpool_oldpages} = $1; - return 1; - }; - m/\GPages made young (\d+), not young (\d+)\n/gc && do { - $data->{ib_bpool_made_young} = $1; - $data->{ib_bpool_made_not_young} = $2; - return 1; - }; - m/\GPages read (\d+), created (\d+), written (\d+)\n/gc && do { - $data->{ib_bpool_read} = $1; - $data->{ib_bpool_created} = $2; - $data->{ib_bpool_written} = $3; - return 1; - }; - # mariadb-5.5 - m/\GInternal hash tables \(constant factor \+ variable factor\)\n\s*Adaptive hash index\s*(\d+)\s*\((\d+) \+ (\d+)\) *\n\s+Page hash +(\d+) +\(buffer pool \d+ only\) *\n\s+Dictionary cache\s*(\d+)\s+\((\d+) \+ (\d+)\) *\n\s+File system\s+(\d+)\s+\((\d+) \+ (\d+)\) *\n\s+Lock system\s+(\d+)\s+\((\d+) \+ (\d+)\) *\n\s+Recovery system\s*(\d+)\s+\((\d+) \+ (\d+)\) *\n/gc - && do { - $data->{ib_bpool_internal_adaptive_hash_size_total} = $1; - $data->{ib_bpool_internal_adaptive_hash_size_const} = $2; - $data->{ib_bpool_internal_adaptive_hash_size_var} = $3; - $data->{ib_bpool_internal_page_hash_size_total} = $4; - $data->{ib_bpool_internal_dictionary_cache_size_total} = $5; - $data->{ib_bpool_internal_dictionary_cache_size_const} = $6; - $data->{ib_bpool_internal_dictionary_cache_size_var} = $7; - $data->{ib_bpool_internal_file_system_size_total} = $8; - $data->{ib_bpool_internal_file_system_size_const} = $9; - $data->{ib_bpool_internal_file_system_size_var} = $10; - $data->{ib_bpool_internal_lock_system_size_total} = $11; - $data->{ib_bpool_internal_lock_system_size_const} = $12; - $data->{ib_bpool_internal_lock_system_size_var} = $13; - $data->{ib_bpool_internal_recovery_system_size_total} = $14; - $data->{ib_bpool_internal_recovery_system_size_const} = $15; - $data->{ib_bpool_internal_recovery_system_size_var} = $16; - return 1; - }; - - } - ); -} - -sub parse_individual_buffer_pool { - parse_section( - sub { - m/\G---BUFFER POOL (\d+)\n/gc && do { - my $pool = $1; - $data->{ib_bpool_individual_pool_count} = $pool + 1; - m/\GBuffer pool size\s+(\d+)\n/gc && do { - $data->{"ib_bpool_individual_pool_${pool}_size"} = $1; - }; - m/\GBuffer pool size, bytes\s+(\d+)\n/gc && do { - $data->{"ib_bpool_individual_pool_${pool}_size_bytes"} = $1; - }; - m/\GFree buffers\s+(\d+)\nDatabase pages\s+(\d+)\nOld database pages\s+(\d+)\nModified db pages\s+(\d+)\nPending reads\s+(\d+)\nPending writes: LRU\s+(\d+), flush list\s+(\d+), single page\s+(\d+)\n/gc && do { - $data->{"ib_bpool_individual_pool_${pool}_free"} = $1; - $data->{"ib_bpool_individual_pool_${pool}_dbpages"} = $2; - $data->{"ib_bpool_individual_pool_${pool}_oldpages"} = $3; - $data->{"ib_bpool_individual_pool_${pool}_modpages"} = $4; - $data->{"ib_bpool_individual_pool_${pool}_pending_reads"} = $5; - $data->{"ib_bpool_individual_pool_${pool}_pending_writes_lru"} = $6; - $data->{"ib_bpool_individual_pool_${pool}_pending_writes_flush"} = $7; - $data->{"ib_bpool_individual_pool_${pool}_pending_writes_single"} = $8; - }; - skip_line(); - m/\GPages read (\d+), created (\d+), written (\d+)\n/gc && do { - $data->{"ib_bpool_individual_pool_${pool}_read"} = $1; - $data->{"ib_bpool_individual_pool_${pool}_created"} = $2; - $data->{"ib_bpool_individual_pool_${pool}_written"} = $3; - }; - return 1; - }; - } - ); -} - -sub handle_incomplete_innodb_status { - - warn "Output from SHOW ENGINE INNODB STATUS was truncated. " - . "This happens if the output of STATUS exceeds 64KB. " - . "Several of the InnoDB graphs might be affected by this."; - - # FIX Is it possible to find some of the missing values from SHOW - # STATUS? -} - - -exit main() unless caller; - - -1; diff --git a/cookbooks/munin/files/default/plugins/passenger_memory b/cookbooks/munin/files/default/plugins/passenger_memory deleted file mode 100755 index dd0f66381..000000000 --- a/cookbooks/munin/files/default/plugins/passenger_memory +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby -# put in /etc/munin/plugins and restart munin-node -# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin -# NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats - -require "English" - -def output_config - puts <<~CONFIG - graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit 4056231936 - graph_category passenger - graph_title Passenger memory - - memory.label memory - CONFIG - exit 0 -end - -def output_values - status = `/usr/sbin/passenger-memory-stats | tail -1` - unless $CHILD_STATUS.success? - warn "failed executing passenger-memory-stats" - exit 1 - end - status =~ /(\d+\.\d+)/ - puts "memory.value #{(Regexp.last_match[1].to_f * 1024 * 1024).round}" -end - -if ARGV[0] == "config" - output_config -else - output_values -end diff --git a/cookbooks/munin/files/default/plugins/passenger_processes b/cookbooks/munin/files/default/plugins/passenger_processes deleted file mode 100755 index 863ff8610..000000000 --- a/cookbooks/munin/files/default/plugins/passenger_processes +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env ruby - -require "English" -require "rexml/document" - -def passenger_status - @passenger_status ||= REXML::Document.new(`/usr/sbin/passenger-status --show=xml`) -end - -def output_config - puts <<~CONFIG - graph_args --lower-limit 0 - graph_category passenger - graph_title Passenger processes - graph_order active inactive - graph_vlabel processes - graph_total total - - active.label busy servers - active.draw AREA - inactive.label idle servers - inactive.draw STACK - CONFIG - exit 0 -end - -def output_values - active = 0 - inactive = 0 - - passenger_status.get_elements("//process").each do |process| - if process.text("sessions").to_i.positive? - active += 1 - else - inactive += 1 - end - end - - puts "active.value #{active}" - puts "inactive.value #{inactive}" -end - -if ARGV[0] == "config" - output_config -else - output_values -end diff --git a/cookbooks/munin/files/default/plugins/passenger_queues b/cookbooks/munin/files/default/plugins/passenger_queues deleted file mode 100755 index a5467660c..000000000 --- a/cookbooks/munin/files/default/plugins/passenger_queues +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env ruby - -require "English" -require "rexml/document" - -def passenger_status - @passenger_status ||= REXML::Document.new(`/usr/sbin/passenger-status --show=xml`) -end - -def output_config - puts <<~CONFIG - graph_args --lower-limit 0 - graph_category passenger - graph_title Passenger queues - graph_vlabel count - - global.label global - global.draw AREA - CONFIG - - groups = passenger_status.get_elements("//supergroup").map do |supergroup| - supergroup.text("name") - end - - groups.sort.each do |name| - puts "#{name}.label #{name}" - puts "#{name}.draw STACK" - end -end - -def output_values - global = passenger_status.text("/item/get_wait_list").to_i - - puts "global.value #{global}" - - passenger_status.get_elements("//supergroup").each do |supergroup| - name = supergroup.text("name") - queue = supergroup.text("get_wait_list").to_i - - puts "#{name}.value #{queue}" - end -end - -if ARGV[0] == "config" - output_config -else - output_values -end diff --git a/cookbooks/munin/files/default/plugins/passenger_requests b/cookbooks/munin/files/default/plugins/passenger_requests deleted file mode 100755 index 67dc34367..000000000 --- a/cookbooks/munin/files/default/plugins/passenger_requests +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env ruby - -require "English" -require "rexml/document" - -def passenger_status - @passenger_status ||= REXML::Document.new(`/usr/sbin/passenger-status --show=xml`) -end - -def output_config - puts <<~CONFIG - graph_args --base 1000 --lower-limit 0 - graph_category passenger - graph_title Passenger requests - graph_vlabel requests / ${graph_period} - - total.label total - total.type DERIVE - total.max 1000000 - total.min 0 - CONFIG - - groups = passenger_status.get_elements("//supergroup").map do |supergroup| - supergroup.text("name") - end - - groups.sort.each do |name| - puts "#{name}.label #{name}" - puts "#{name}.type DERIVE" - puts "#{name}.max 1000000" - puts "#{name}.min 0" - end -end - -def output_values - total_requests = 0 - - passenger_status.get_elements("//supergroup").map do |supergroup| - name = supergroup.text("name") - requests = 0 - - supergroup.get_elements("group/processes/process").each do |process| - requests += process.text("processed").to_i - end - - total_requests += requests - - puts "#{name}.value #{requests}" - end - - puts "total.value #{total_requests}" -end - -if ARGV[0] == "config" - output_config -else - output_values -end diff --git a/cookbooks/munin/files/default/plugins/planet_age b/cookbooks/munin/files/default/plugins/planet_age deleted file mode 100755 index 220c7c536..000000000 --- a/cookbooks/munin/files/default/plugins/planet_age +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/ruby - -files = [ - { - :label => "planet", - :name => "/store/planet/planet/planet-latest.osm.bz2", - :title => "Planet Dump", - :frequency => 7 * 24 * 60 * 60, - :warning => 1.05, - :critical => 1.1 - }, - { - :label => "day", - :name => "/store/planet/replication/day/state.txt", - :title => "Daily Replication", - :frequency => 24 * 60 * 60, - :warning => 1.05, - :critical => 1.1 - }, - { - :label => "hour", - :name => "/store/planet/replication/hour/state.txt", - :title => "Hourly Replication", - :frequency => 60 * 60, - :warning => 1.05, - :critical => 1.1 - }, - { - :label => "minute", - :name => "/store/planet/replication/minute/state.txt", - :title => "Minutely Replication", - :frequency => 60, - :warning => 5, - :critical => 10 - } -] - -if ARGV[0] == "config" - puts "graph_title Planet Age" - puts "graph_args --base 1000 --lower-limit 0" - puts "graph_scale no" - puts "graph_vlabel fraction of expected max age" - puts "graph_category planet" - - files.each do |file| - puts "#{file[:label]}.label #{file[:title]}" - puts "#{file[:label]}.type GAUGE" - puts "#{file[:label]}.warning 0:#{file[:warning]}" - puts "#{file[:label]}.critical 0:#{file[:critical]}" - end -else - - files.each do |file| - value = (Time.now - File.mtime(file[:name])) / file[:frequency] - - puts "#{file[:label]}.value #{value}" - end -end diff --git a/cookbooks/munin/files/default/plugins/postgres_replication b/cookbooks/munin/files/default/plugins/postgres_replication deleted file mode 100755 index 56ee16371..000000000 --- a/cookbooks/munin/files/default/plugins/postgres_replication +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Munin::Plugin::Pgsql; - -my $pg = Munin::Plugin::Pgsql->new( - title => 'PostgreSQL replication delay', - info => 'Replication delay', - vlabel => 'Seconds', - basequery => "SELECT (extract(epoch FROM now()) - extract(epoch FROM pg_last_xact_replay_timestamp()))::int AS delay", - pivotquery => 1, - configquery => "VALUES ('delay','Replication delay')", - extraconfig => "delay.warning 300\ndelay.critical 3600", - graphmin => 0 -); - -$pg->Process(); diff --git a/cookbooks/munin/files/default/plugins/replication_delay b/cookbooks/munin/files/default/plugins/replication_delay deleted file mode 100755 index 27dd10809..000000000 --- a/cookbooks/munin/files/default/plugins/replication_delay +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# Plugin to monitor the age of the imported data in the rendering db -# -# Parameters: -# -# config (required) -# autoconf (optional - used by munin-config) -# - -if [ "$1" = "config" ]; then - - echo 'graph_title Data import lag' - echo 'graph_args --base 1000 -l 0' - echo 'graph_vlabel minutes' - echo 'graph_category renderd' - echo 'age.label DB import age' - echo 'age.type GAUGE' - echo 'age.cdef age,60,/' - echo 'age.warning :600' - echo 'age.critical :3600' - exit 0 -fi - -tstamp=$(osmium fileinfo --extended --get=data.timestamp.last /var/lib/replicate/changes-latest.osc.gz) -tstampsec=$(date --date=${tstamp} +%s) -nowsec=$(date +%s) - -echo "age.value " `expr $nowsec - $tstampsec` diff --git a/cookbooks/munin/files/default/plugins/rrdcached b/cookbooks/munin/files/default/plugins/rrdcached deleted file mode 100644 index ff18a9a7b..000000000 --- a/cookbooks/munin/files/default/plugins/rrdcached +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl -# -*- cperl -*- - -use strict; -use warnings; - -use IO::Socket::UNIX; - -$| = 1; - -my $arg = shift; -if ($arg && $arg eq "config") { - print "graph_title rrdcached stats\n"; - print "QueueLength.label Queue length\n"; - print "UpdatesReceived.label UpdatesReceived\n"; - print "UpdatesReceived.type DERIVE\n"; - print "FlushesReceived.label FlushesReceived\n"; - print "FlushesReceived.type DERIVE\n"; - print "UpdatesWritten.label UpdatesWritten\n"; - print "UpdatesWritten.type DERIVE\n"; - print "DataSetsWritten.label DataSetsWritten\n"; - print "DataSetsWritten.type DERIVE\n"; - print "TreeNodesNumber.label TreeNodesNumber\n"; - print "TreeDepth.label TreeDepth\n"; - print "JournalBytes.label JournalBytes\n"; - print "JournalBytes.type DERIVE\n"; - print "JournalRotate.label JournalRotate\n"; - print "JournalRotate.type DERIVE\n"; - exit 0; -} - -my $sock = new IO::Socket::UNIX( - Type => SOCK_STREAM, - Peer => "/var/run/rrdcached.sock", -) or die "Cannot open socket : $!"; - -print $sock "STATS\n"; -print $sock "QUIT\n"; - -# skip first line -<$sock>; -print map { s/: /.value /; $_; } <$sock>; - -exit 0; diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_current b/cookbooks/munin/files/default/plugins/snmp__apcpdu_current deleted file mode 100755 index d2f8b2641..000000000 --- a/cookbooks/munin/files/default/plugins/snmp__apcpdu_current +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -=head1 MAGIC MARKERS - - #%# family=snmpauto - #%# capabilities=snmpconf - -=cut - -use strict; -use warnings; -use Munin::Plugin::SNMP; - -my $session = Munin::Plugin::SNMP->session; - -if (defined $ARGV[0] and $ARGV[0] eq "config") { - my $host = $session->hostname; - my $warning = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.1.1.6.1"); - my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.1.1.7.1"); - - print "host_name $host\n" unless $host eq "localhost"; - print "graph_title Load\n"; - print "graph_args --base 1000 -l 0\n"; - print "graph_vlabel Amps\n"; - print "graph_category power\n"; - print "graph_info This graph shows the total throughput the PDU.\n"; - - print "current.label Current\n"; - print "current.type GAUGE\n"; - print "current.info Current load in amps.\n"; - print "current.draw LINE2\n"; - print "current.warning ${warning}\n"; - print "current.critical ${critical}\n"; -} else { - my $current = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.5.1"); - - $current = $current / 10 unless $current eq "U"; - - print "current.value ${current}\n"; -} diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity b/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity deleted file mode 100755 index 590068955..000000000 --- a/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -=head1 MAGIC MARKERS - - #%# family=snmpauto - #%# capabilities=snmpconf - -=cut - -use strict; -use warnings; -use Munin::Plugin::SNMP; - -my $session = Munin::Plugin::SNMP->session; - -if (defined $ARGV[0] and $ARGV[0] eq "config") { - my $host = $session->hostname; - my $warning = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.13.1"); - my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.14.1"); - - print "host_name $host\n" unless $host eq "localhost"; - print "graph_title Humidity\n"; - print "graph_args -l 0\n"; - print "graph_vlabel %\n"; - print "graph_category sensors\n"; - print "graph_info This graph shows the humidity from the PDUs environmental sensor.\n"; - - print "humidity.label Humidity\n"; - print "humidity.type GAUGE\n"; - print "humidity.info Relative humidity.\n"; - print "humidity.draw LINE2\n"; - print "humidity.warning ${warning}:\n"; - print "humidity.critical ${critical}:\n"; -} else { - my $humidity = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.2.1.10.1"); - - print "humidity.value ${humidity}\n"; -} diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_power b/cookbooks/munin/files/default/plugins/snmp__apcpdu_power deleted file mode 100755 index cfb6a8123..000000000 --- a/cookbooks/munin/files/default/plugins/snmp__apcpdu_power +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -=head1 MAGIC MARKERS - - #%# family=snmpauto - #%# capabilities=snmpconf - -=cut - -use strict; -use warnings; -use Munin::Plugin::SNMP; - -my $session = Munin::Plugin::SNMP->session; - -if (defined $ARGV[0] and $ARGV[0] eq "config") { - my $host = $session->hostname; - - print "host_name $host\n" unless $host eq "localhost"; - print "graph_title Power\n"; - print "graph_args --base 1000 -l 0\n"; - print "graph_vlabel Watts\n"; - print "graph_category power\n"; - print "graph_info This graph shows the power being supplied by the PDU.\n"; - - print "power.label Power\n"; - print "power.type GAUGE\n"; - print "power.info Current power draw in watts.\n"; - print "power.draw LINE2\n"; -} else { - my $power = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.7.1"); - - $power = $power * 10 unless $power eq "U"; - - print "power.value ${power}\n"; -} diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature b/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature deleted file mode 100755 index 309f47326..000000000 --- a/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl - -=head1 MAGIC MARKERS - - #%# family=snmpauto - #%# capabilities=snmpconf - -=cut - -use strict; -use warnings; -use Munin::Plugin::SNMP; - -my $session = Munin::Plugin::SNMP->session; - -if (defined $ARGV[0] and $ARGV[0] eq "config") { - my $host = $session->hostname; - my $warning = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.11.1"); - my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.10.1"); - - print "host_name $host\n" unless $host eq "localhost"; - print "graph_title Temperature\n"; - print "graph_args -l 0\n"; - print "graph_vlabel Degrees Celsius\n"; - print "graph_category sensors\n"; - print "graph_info This graph shows the temperature from the PDUs environmental sensor.\n"; - - print "temperature.label Temperature\n"; - print "temperature.type GAUGE\n"; - print "temperature.info Temperature in degrees celsius.\n"; - print "temperature.draw LINE2\n"; - print "temperature.warning :${warning}\n"; - print "temperature.critical :${critical}\n"; -} else { - my $temperature = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.2.1.8.1"); - - $temperature = $temperature / 10 unless $temperature eq "U"; - - print "temperature.value ${temperature}\n"; -} diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage b/cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage deleted file mode 100755 index 362d44cef..000000000 --- a/cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/perl - -=head1 MAGIC MARKERS - - #%# family=snmpauto - #%# capabilities=snmpconf - -=cut - -use strict; -use warnings; -use Munin::Plugin::SNMP; - -my $session = Munin::Plugin::SNMP->session; - -if (defined $ARGV[0] and $ARGV[0] eq "config") { - my $host = $session->hostname; - - print "host_name $host\n" unless $host eq "localhost"; - print "graph_title Voltage\n"; - print "graph_args --base 1000 -l 0\n"; - print "graph_vlabel Volts\n"; - print "graph_category power\n"; - print "graph_info This graph shows the voltage being supplied by the PDU.\n"; - - print "voltage.label Voltage\n"; - print "voltage.type GAUGE\n"; - print "voltage.info Current voltage.\n"; - print "voltage.draw LINE2\n"; -} else { - my $voltage = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.6.1"); - - print "voltage.value ${voltage}\n"; -} diff --git a/cookbooks/munin/files/default/www/favicon.ico b/cookbooks/munin/files/default/www/favicon.ico deleted file mode 100644 index 975e1cb0d9a56a11d5843a5bc851bd8ed2f6b0ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmd6O2XLF$u`WG+FP>yFac;>Z&LnYillUfaY{`-(%d(1P$#xva&o4dkbsXDq;@GL~ zPF&QB)w|e9kRaH51HlFoBtej91VD6xs3ZUaBuJ{zvi9x!&QHRZ;Z^c7Z|1)HG_yKC z{!KNi>1_xx8L3!YYz;OFYqt2bW0 zeEB0+E?>TBVPWCF7H$xXUrsY`v zj=y!BzF&Mt=u*5x9H-Bx<^EgmxZbt&^WvSMVDJlFogI&zzHt7%pSHW=tIjnptY5b# z`r501R2)Bcc)y}V{#Adu3JS_vO{)FITr#$%-{i)v~6_!(}y<&o(qR zJlfUOwMDPj-zDV3bDtK^i+82@7IS~SV<9(qxV@pF;oAy@;zwB>+R8%>-E{Ze_t2_4 zR?|1Xemni^ZC|B3SKWT~&u8~tEwOfxY`lkZM_Oa&+sk|M8_G_WR+K%ZR4R7}KB1eh z8;!E8l(38vb+EK|VWN$3+1R7y5g-095SPT)EKLW{}sF9Vsj< z{8?^6{`0xDiqi$!re1|llPaGaqKfDcS4M}q-`>GZp+T;k9Oj~6A0M|?^L}eSs31*r zXt*GDx=YsF+^>2Lw)IcxdB5H$${x!Bu6$J%rFhrjp{uf6L|x_ixCyl%}p zzWc6qwEE6f{LOEC9WvZSzd!j7pB}8{B7YAR`gbMLf zco%$Ef!fD4WHu|gHf8`BsVJ!7J;prVYtEx(GSC5AAukbm1HP|`HE})r5$A-BS;ifY z$;Xsb43ayQl-*fLPyFghTDNvJt-t$j+OTc|-2;1CyZSD=^PArwA;WKv{+UkpRYp)ZRe2@oP*8O$Bo<&H*sU!%=zPOyl*6rcN=qgmoaC_j{d@yxNTJPnpmUPvz;{m zVhvOWyF=ig%0eC79Mf~#q?w9_TKJhiKF1q3+)ejw*ub0a-Nc(VY=SP<^P1In^7;*H z>6g1-;@z?mF7S3yj&6_(or5g%^-{01iyI<3@U5hNx0*5M;N3)N-kYXIs6J}oqxMoE z1MM8n<~`e5~NTzS0 zU%dJ}ZQ6JbZNBe5+PY~gZP~b$?p?nD>ti+DbMIPu^2I;Up|(QGhwYr}ShSr=e?N`) z*OJ<*qROz2YA5wn>o-%W&O((Y3)PQVs3m40d8nU`J1S_ekU^gfIkKct$Rup)gsEf< z{`pp6=V^YIk7>R5r$WCO2^d%jeJjLT4k)>1asWCva-p%6pL^p4-m+-}-@kb?Z`-mB z<2LAGBd@=E4Xs^LS+X^#>11KMlO z6}n)|z3``$J=V&a-qr(%)3=CND|k)wy<87-^Yb6;Pq@w9NjsT+h%u8UYDrkBDFHj3 zGEw#9Fy&d5^s9G%PuuU`Ob>3`Mh|U&2;)O^|E4Xpal?AreE+?)D{DXX^psOqS1&30 zEmY^Xkl?#Mq9=v7m$J;wbZVfIj;R%Nq*G4sIfn5$+ETvDT|$jYrK5VJ(-% zhFAgLlxJ+XoW74W@fAua32 zM_-6ePTn#+oxh=4x z9wQZ)dg#Ts-yk8w!#j4+OW9@g%fd$5vUwx@;OQUI?+(97zXAPv-z)S+?m^mDpG}7= z&e4(V_b8{}ILTxusZ?iJ4%Po?xVeVM<{=&QSeOV4f%ATK9|n*R8Wbto6KSN z??R!V$P@ob#Ixn=K;*Z`6aPhN)Vy1Qxi5vSq)85&$%hWkSvvS=otg)&D%gdd%;Dp(b`k zhS?6gvf>>UkQK+lX%B~^W9;@0b7|RmKC<^UZfPvw5?uoyR~GZ>j#Bc3$F~app@Yu| z9W3Wx*Wn3EO3FPFd%l}2@}i0J5C+c0OlI=N)5mvqixR zrf6bjj5GuF^!mX+QHQZ>FqNA5L?jaWypUmfI(c(?4G7y2@vUDwu&FexO(|eMi!>;W z7y6JBICLy@ArJJk!r#yJQ)V9U^|Qy+#yW2w8{EC@)6{Wu;Yr^4@~?Qyee3wCpFYlh zlafPDH4jhdc_>Yob20DI@10$EG8!H>&vPsrMQM|AKeW zt*{rtzZ477{Hx7_&w+2u{UWd6SF)c|%6`P+#bfz6;!#LP4T%x%L=5T(^ike;BNroH zk7(+s{MwP`x~h^pdwv&73Cd$mo}_lP0H#VirG47a-@xnkXN!5$zEVX z7$w45fJ`(D-Ua`Hj8UVIgT`jO6q*at#C(LNE=DPd@!XjM@sSbJIx+t%?EePg`>Vr4 zUIlC-&8g+%qQyxxnR6k#09R5>qRcfosl8@Zh=j;v!+4DiVN>?-i3oa zLkHDtfel6RBx_`e9=Y&1k6AtKNoFj8#p1L^6{(zaz zoH}-PVj}X{OUvT0@I&F$)H>lK^L?0azXtZu&!yO>Rw0&EO&K`fs-?_ctrXX=UnJp^ z1U2LS^WzPi<7{AM>3KT7|4oiKdwI&Gp(yhGu)T{7$U`v45>I-pd%-v6S@2CUT%Q{4 z;`nG6`LIretUBZw&=(6bBR_RbyRk0DIhqQB|NU_h!&dr#ODgzQRa{Rs2@};WkvJAq z0XxlB8A%b+66T!*|5<(|W%^r5iP$Ea(9oIDIyzHzjxhH$e_e@C@ET-MGJ-qLy}YdElGDe^0Q7+I&iC$NsDr$HJz32@iF5*HWLR z=UZvtpUxkGSCT)jPmXYX61gF$ZW)z@v7U_@g!Cw+Q$C7tX@xk7av+CpcQup2(a!mK=Vj@6 zPv<{k>`u8H&C|%2|AH)34g0BqZxFJT4%?{IYoHU(8p8b30Y@S7VHve4^Xd5UcW3~) zOTeQ6?6Il1cX9b`?O{niL>__Qs=9ZCK9tJLulX zEBLnw{)HYSd4xV@g-p11X(~X_0Y*RWu~E`H2tTA|hg(hRK=+dUz(>G#TAYpCG+aq$ z_^Z5}vxRBC(|Qp6&o5m5Y{!g!p?$_qX;R_1DQYIww4EB4#u}4@DiL=|B3e4_Xb@|G z_Ly?$&Dw*cC^|u7Uig-{ho+{yluCsu7I)FbnFvkCy)+*ilk8|wKF9)jQUO6DSQkce zdeo#6HnU_mZN3�#j=ksUfAVnr!e>MY6m%(|o7p5d4cgLN_zk-I;Rmhcx5BUd+NB z7?lYdE2nH+XL16+F*Ep=@V`@z20rGj;CIw#`S6K%cm(?{|BR1C4iLW-<*^wz&s>>i z_q3CzF2#9jHq4i2qkLsH#&fW%OVeSV#M*Wv|Is6UrhSg^Kd^glcGPq2U>U0o&D;e2 z>h(jL1iylo^Dl5j@65yt-Lp=XDCHzEw&A^EF zh5oSb6}Gs#*_Uura5ez`W8mLI68}jDPhUwQH*oX(`*WOHm?2jJKIw9TgR|qvpTq2d zj~xj2Nj^u|jndsr4TfrN8K`E1qnl11+Z_>k+sgSDxv1D1CsNa&2i|Z+4UutP`;y|&T4w3oVqj$Tyx4GVzfj>z&6ixmr-8+5pssiWS_K=BW5RGa*RT= zK^jYXD0z8`ywfh4T}V;lavbOV6uUSnk&wZibkYd&sy=+L&)-KK);8q-71V8PA%j^( z#YOq=F6TWx|00JI{7=p%ZWp16*EY7*v4SkHK#@GeB@=Uu#-pQ8u z2=X2q@**>KcsDEx%~*8h@8SbJMk3uFN?e{$suGY z#$GJbpypEzT9!xpsS3DIZ31yRVI~o`MVu2cLXI5juqKc99DJRElTIFsxp)F=cmg>X zbimPz6XZ#Nckl~7$(FFPb;`mPV2OhF5%@TB*g!+x0j}#S6TH))3z%$uF4rpS52fdO zxek`gGng97MqWmW=%BO*6S~M$>*zw4j`9qHguIRlkyBSr3{e&KP1W#2b%@OZAIfqy zQnt4qw$(_xYmU=}tV0xvxyT>$kU!xgPuwl-v0Mo!#V^IB92skboXC${Aj^cAjQ%0g zy9a2<0oyS(kj~RV>fTD)b#^}`-k;mCobUAUhx`-W(2y{Dq<#BRekp9|LKpV(OSU9* zQ575JrfI~oX)9u#6?ruBQ}~I3K(mxf%L1*O?`h&U%J%cAvwL|wVr3t6;hAu-Ytqi6 z_&qk|W$%=mUGO`O$x*fhOl(99Gk6BsjB&)TVmli0V+z?Xs=ru3*mD8YXd>M^Y(54Ld; z{2uUAI^vY`5p@Z_weK}DnmgDZb+9L5CokmiBK~?JE^>wJZ1bDhGHxJiz{su%D|@3> zvimfA{`>(xTyl=OrXAcjkRQpyy;Lx!rkBp_qNAsF(XhUqq6shd z=zfZT!pU(8;CsYt{!x1Ey;rFWb+)b%ypx=jc?5QLfcKx?%lisXaJH$EF%PW7epm$@ zrF+K7lMAUQ({sOkOwWI0Vdmj-!TZ!ONuwl#qzhq7RI0bSofjv6Klj0vuSegX{l4dN z?4WTz*sV!Cs}rb>=-3-XlKsF{V`bc+}|+KV@4d~f;p(>%<7aOKOs`Phrbxj=_{#<`$Qxmb{C zKB!uGe_94{{?fJgKQlBxo~@tvpG6M6+j}|oY~ua-wczb0asBTl!PoTrbGK`gwydU5 zf0kx)wiT!*pM3Hs>htGLzoSwqzk~Y0SN>Mdh~Qn+5JhhZ`ZE5-@ArRhsb}S*;#!)o z>&>6IChkRV$k$rC)lVPnu}rVsvV(8?%9rVZ2ex=#-}_eI*{Z_&;+nEI+uPe85cfr+ z(SH{FVEmNbZof_RgH$!vJ+0_!$g0sc_ZRdvwv=`?9II(-cvf6XKO^+Jk_Yj9liT`e zaZh#4p^_}!{SSW&{UK|3)g7zQ7jhf_^o6JRJZeg!CnV3=nJOG;=_#$P+gVXj@jZD> z`Adaeb!El2&an#gQYf*%YexTv=>0fh7rh?^e85mJeOz78EAOb<8w>|;72jLVgZOO^ zc^**&+BtK$od4~`rx>+sUcYvo)T1K$I==ghAM**+=wzZN1$95UTEiuN&1F$bLobBX zOVEh@g5K6HdN+_$^-FyNOLfx4-V<8^cY3w2Uhn&pQ_)*X{HTQo)LdchLSMiy(c7>V zJq`DQkM)>~Z}Q_$|A3FE6nwt7k1q@W=Xau)z~3i*TLrld_;zDdFZD0TLu#qcyvva8 zTUhLWsT^&~5o>C>{Nh;buWLg+A<>`Eh`g{GILmXdy}$4abiZll~?k3g^s{gpM)-3ozed|kYG0Q?v#K66QL2eIfxe|QH zu>XG%`_3KPwxX8&uvFW>@7@i3;KUwQkD!ksXkgU7r8R;+3*L{p*{#UuJr#NUO65L& zt>z%Vt2)K!tqt4^EVIecUlotXJ_Wz{mU+Q#*xy)3i# z^Y0J50Uqv`YT7?IlE*)J{Y^etlf^qL&+@C;`*~;eIX;1!@PU#XK2V&+hjHyd+j%}? zsNgf2O3YV2muYL!AEAq)PWSocbw=SAgpZJUdLpt=KNn&B2p%#~KbEz3aXo5Wg@Z%< z+R@$oR-TN1_VSzPb=bm>{p2xz8oe9OzVad$R%WuYtDMbPpHAS4o=NPRMtZp#wTtZH zQ(V_3=Tq$p^l7N9;`^djE9OARE_|m>KeQ3DlMMKvAUSL?TRX%#sIzyVHl;#6qyacU zOGM8_S%>*s4?f7-&};G7cfQS~vQumYmYl9%iaLl9`{mGVh@;6EPXcqQs?Fn^sw`HU zdW%u#xMitUAo*rdqwF$if3sNITdeVA4Prl!+KC)BJ?w?q3JhG-^BkxZ_t)g|uYdj{ z)K9mw5i;9=O{}cL2p+7!mjcNkPb5&Yo1WxuO+B~uw!baDA3@J-I=+gy(c;z>rt5P; z_6vOjEQc>GgB{kQm#8NMTf}~_!K>oN{1g1pwvF7^EaQl+1K&m+2;W;tCd|PoaJj&& zpC{)gcq$d+=BCoP)jG09)M}x3sa7s(%vGVGF;SlqwM^0XhZ+y|r#krZel7`AI}$Y}J!;#7u$_MRm65nb!XI0d<(GvH(taqqklG>DRTgm@ zf!(mejXnUIL8`|cgD*YiD&;!t`_Jm@xIliIr+{fE-CCXqnWg%PsG)cxM*jD@NjK^y zU6>y=qvrD=cB#R!)ze4)eZ7yS>1Csp5)5vERF#apG7S|)B)xv zoQt?W>Hq@&pN}}D`V8tYQr%@3_LTm9D|~Pt@V5?C^PiS~-*sv70I&lI-){r9-vrD{ zkihv%EJoC}y6}A&ztew)i{vLb;T-}tKPuH7mau$*)q@|qMDvp#sTLHpcXE$^5wjP# zYm>E>b?DdX>`*?J{=Tq-*u|Mm0^1h*e}M8-O{g(KlhUS=TK8zVLzl zDUV0s4!}>aXE#gzWhEv93tJHDK;%232D`iD6dO^~0&dIbZIG~YKQKMqti3 z4m0puc3}N?p=Q_NQ*pDYp1br-Twb0%mbQJtgII?mCbq||sx%fQ^1Wijft+FBvN#t0 zK;&8#=+i6@4Dk7aW9$WH=3c^Gy-7EFfxm|5f)e)X0S+6S3oK%oh|TSm7Ow9vW9>*Q zceJ-YpO$^;`!`%!Shxuo(zN)#AUSH+7qoqxHH^L}_`^EXHwBg|dM%4!3;UYSaHqPK z1HkLTsUU~p>wVCHzT=}TnTJO!UVA<<>7WN9B<(gV1aUf z8=v)5^3g6i=PJ&kW^Uy1s2g~uN5TLdAq(5XBRm$hvAVyO&&bbkYZ$flxyjutzb$Zu zmZWubIX0GWMz1D(aU*=8ut%{rS`w)FM|$9!J6I7=@o|@evoQ*r++TfxbKsY%8syxf ztl;`4#QJ&}pRdZ~(;69SEvOYGMj7+`@XGH`zMtAI@S)}SmNGs%;F_9x^5O>z{}OwD z_J0D`I%J#=^a8h8C=YgWDe~047Ub2oLe9cmRK*N2{ha@JVqyOF2zV%XgH*m6M-JCB6e&~0zz`s`Bll~1~{qgaO6HhmV`#UQA zU6tynagRF{d>H5dgH4HN#P`7e4=nScYUicN%=CMfjW}HVH;W;)HNfhdGHz7^Edkw} zCO?irH?1IX{U*?j*CX6};}YG3@k3JMT|Meg+qGPjo+fLcpcxn>0b1EW^t~rkE{HeYc=q1-RK9cME)c7YGd!3 zYp?4SIjWFHjH-w>SQYH$-|l`D`?5{EdFv*AyYMWRVLzsJskwR#K4N@?kJ~DxcN{Pk zq-Ihx0%4P6v`mfVw=xRac6fWKmO>$tSCOihNV2xikJ~WEx$w4 z$Rke64~0%de5efSe8q@^`8MRG=sl?mYq-9>nB|!Vc@#ZwBL5Wmp9%XgTO98|J$FFc zRgeC(o9C}y{=A4C)$rfN_F*mz^>8up+?<9Sjw6?Hqb_Gf9v4QxTnxFJ0sVC7kKtjL z<{Gf5Tdtu7)Rr8bZbF|z4f3o)XFs2`m$0lkhZCsFOe0RG(1UaH=R^=C-= z4~y7_o+8LQ_k9csygEvz*n-yB9CEB1PInAgq6Gv7jA z&gbBlzHgrOWfl2aTs5KIdhey!Qy+mr~m)} diff --git a/cookbooks/munin/files/default/www/robots.txt b/cookbooks/munin/files/default/www/robots.txt deleted file mode 100644 index 1f53798bb..000000000 --- a/cookbooks/munin/files/default/www/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/cookbooks/munin/recipes/default.rb b/cookbooks/munin/recipes/default.rb index 9b2c6f294..1501c2c90 100644 --- a/cookbooks/munin/recipes/default.rb +++ b/cookbooks/munin/recipes/default.rb @@ -17,30 +17,14 @@ # limitations under the License. # -package "munin-node" - service "munin-node" do - action [:enable, :start] - supports :status => true, :restart => true, :reload => true + action [:stop, :disable] end -servers = search(:node, "recipes:munin\\:\\:server").map(&:ipaddresses).flatten - -firewall_rule "accept-munin" do - action :accept - context :incoming - protocol :tcp - source servers - dest_ports "munin" - source_ports "1024-65535" - not_if { servers.empty? } +file "/etc/munin/munin-node.conf" do + action :delete end -template "/etc/munin/munin-node.conf" do - source "munin-node.conf.erb" - owner "root" - group "root" - mode "644" - variables :servers => servers - notifies :restart, "service[munin-node]" +package "munin-node" do + action :purge end diff --git a/cookbooks/munin/recipes/plugins.rb b/cookbooks/munin/recipes/plugins.rb index dde0a55dd..3a4e7ebdc 100644 --- a/cookbooks/munin/recipes/plugins.rb +++ b/cookbooks/munin/recipes/plugins.rb @@ -19,258 +19,17 @@ include_recipe "munin" -remote_directory "/usr/local/share/munin/plugins" do - source "plugins" - owner "root" - group "root" - mode "755" - files_owner "root" - files_group "root" - files_mode "755" - purge true -end - -remote_directory "/etc/munin/plugin-conf.d" do - source "plugin-conf.d" - owner "root" - group "munin" - mode "750" - files_owner "root" - files_group "root" - files_mode "644" - purge false - notifies :restart, "service[munin-node]" -end - -if Dir.glob("/proc/acpi/thermal_zone/*/temperature").empty? - munin_plugin "acpi" do - action :delete - end -else - munin_plugin "acpi" -end - -# apcpdu_ -munin_plugin "cpu" - -if File.exist?("/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state") - munin_plugin "cpuspeed" -else - munin_plugin "cpuspeed" do - action :delete - end -end - -munin_plugin_conf "df" do - template "df.erb" -end - -munin_plugin "df" -munin_plugin "df_inode" - -munin_plugin_conf "diskstats" do - template "diskstats.erb" -end - -munin_plugin "diskstats" -munin_plugin "entropy" -munin_plugin "forks" - -if node[:kernel][:modules].include?("nf_conntrack") - package "conntrack" - - munin_plugin "fw_conntrack" - munin_plugin "fw_forwarded_local" -else - munin_plugin "fw_conntrack" do - action :delete - end - - munin_plugin "fw_forwarded_local" do - action :delete - end -end - -if File.read("/proc/sys/net/ipv4/ip_forward").chomp == "1" - munin_plugin "fw_packets" -else - munin_plugin "fw_packets" do - action :delete - end -end - -if File.exist?("/sbin/hpasmcli") - munin_plugin "hpasmcli2_temp" do - target "hpasmcli2_" - end - - munin_plugin "hpasmcli2_fans" do - target "hpasmcli2_" - end -else - munin_plugin "hpasmcli2_temp" do - action :delete - end - - munin_plugin "hpasmcli2_fans" do - action :delete - end -end - -node[:network][:interfaces].each do |ifname, ifattr| - if ifattr[:flags]&.include?("UP") && !ifattr[:flags].include?("LOOPBACK") - if node[:hardware] && - node[:hardware][:network] && - node[:hardware][:network][ifname][:device] =~ /^virtio/ - munin_plugin_conf "if_#{ifname}" do - template "if.erb" - variables :ifname => ifname - end - else - munin_plugin_conf "if_#{ifname}" do - action :delete - end - end - - munin_plugin "if_err_#{ifname}" do - target "if_err_" - end - - munin_plugin "if_#{ifname}" do - target "if_" - end - else - munin_plugin "if_err_#{ifname}" do - action :delete - end - - munin_plugin "if_#{ifname}" do - action :delete - end - end -end - -munin_plugin "interrupts" -munin_plugin "iostat" -munin_plugin "iostat_ios" - -if Dir.glob("/dev/ipmi*").empty? - munin_plugin_conf "ipmi" do - action :delete - end - - munin_plugin "ipmi_fans" do - action :delete - end - - munin_plugin "ipmi_temp" do - action :delete - end - - munin_plugin "ipmi_power" do - action :delete - end -else - munin_plugin_conf "ipmi" do - template "ipmi.erb" - end - - munin_plugin "ipmi_fans" do - target "ipmi_" - end - - munin_plugin "ipmi_temp" do - target "ipmi_" - end - - munin_plugin "ipmi_power" do - target "ipmi_" - end -end - -munin_plugin "irqstats" -munin_plugin "load" -munin_plugin "memory" -munin_plugin "netstat" - -munin_plugin "nfs_client" do +directory "/etc/munin/plugins" do action :delete + recursive true end -munin_plugin "nfs4_client" do +directory "/usr/local/share/munin/plugins" do action :delete + recursive true end -munin_plugin "nfsd" do +directory "/etc/munin/plugin-conf.d" do action :delete + recursive true end - -munin_plugin "nfsd4" do - action :delete -end - -munin_plugin "open_files" -munin_plugin "open_inodes" - -munin_plugin "postfix_mailqueue" do - action :delete -end - -munin_plugin "postfix_mailvolume" do - action :delete -end - -munin_plugin "processes" -munin_plugin "proc_pri" - -sensors_fan = false -sensors_temp = false -sensors_volt = false - -Dir.glob("/sys/class/hwmon/hwmon*").each do |hwmon| - hwmon = "#{hwmon}/device" unless File.exist?("#{hwmon}/name") - - sensors_fan = true unless Dir.glob("#{hwmon}/fan*_input").empty? - sensors_temp = true unless Dir.glob("#{hwmon}/temp*_input").empty? - sensors_volt = true unless Dir.glob("#{hwmon}/in*_input").empty? -end - -package "lm-sensors" if sensors_fan || sensors_temp || sensors_volt - -if sensors_fan - munin_plugin "sensors_fan" do - target "sensors_" - end -else - munin_plugin "sensors_fan" do - action :delete - end -end - -if sensors_temp - munin_plugin "sensors_temp" do - target "sensors_" - end -else - munin_plugin "sensors_temp" do - action :delete - end -end - -if sensors_volt - munin_plugin "sensors_volt" do - target "sensors_" - conf "sensors_volt.erb" - end -else - munin_plugin "sensors_volt" do - action :delete - end -end - -munin_plugin "swap" -munin_plugin "tcp" -munin_plugin "threads" -munin_plugin "uptime" -munin_plugin "users" -munin_plugin "vmstat" diff --git a/cookbooks/munin/recipes/server.rb b/cookbooks/munin/recipes/server.rb index bda824f44..fda514948 100644 --- a/cookbooks/munin/recipes/server.rb +++ b/cookbooks/munin/recipes/server.rb @@ -19,90 +19,48 @@ include_recipe "apache" -package "munin" -package "rrdcached" -package "libcgi-fast-perl" - -template "/etc/default/rrdcached" do - source "rrdcached.erb" - owner "root" - group "root" - mode "644" +file "/etc/default/rrdcached" do + action :delete end directory "/var/lib/munin/rrdcached" do - owner "munin" - group "munin" - mode "755" + action :delete + recursive true end service "rrdcached" do - action [:enable, :start] - subscribes :restart, "template[/etc/default/rrdcached]" + action [:stop, :disable] end -munin_plugin "rrdcached" - -expiry_time = 14 * 86400 - -clients = search(:node, "recipes:munin\\:\\:default").sort_by(&:name) -frontends = search(:node, "recipes:web\\:\\:frontend").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n| - { :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") } -end -renderers = search(:node, "roles:tile").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n| - { :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") } -end -geocoders = search(:node, "roles:nominatim").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n| - { :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") } +file "/etc/munin/munin.conf" do + action :delete end -template "/etc/munin/munin.conf" do - source "munin.conf.erb" - owner "root" - group "root" - mode "644" - variables :expiry_time => expiry_time, :clients => clients, - :frontends => frontends, :geocoders => geocoders, - :renderers => renderers +directory "/srv/munin.openstreetmap.org" do + action :delete + recursive true end -apache_module "fcgid" -apache_module "rewrite" -apache_module "headers" - -remote_directory "/srv/munin.openstreetmap.org" do - source "www" - owner "root" - group "root" - mode "755" - files_owner "root" - files_group "root" - files_mode "644" +ssl_certificate "munin.openstreetmap.org" do + action :delete end -# directory to put dumped files in -directory "/srv/munin.openstreetmap.org/dumps" do - owner "www-data" - group "www-data" - mode "755" +apache_site "munin.openstreetmap.org" do + action :delete end -ssl_certificate "munin.openstreetmap.org" do - domains ["munin.openstreetmap.org", "munin.osm.org"] - notifies :reload, "service[apache2]" +file "/etc/cron.daily/munin-backup" do + action :delete end -apache_site "munin.openstreetmap.org" do - template "apache.erb" +package "munin" do + action :purge end -template "/etc/cron.daily/munin-backup" do - source "backup.cron.erb" - owner "root" - group "root" - mode "755" +package "rrdcached" do + action :purge end -munin_plugin "munin_stats" -munin_plugin "munin_update" -munin_plugin "munin_rrdcached" +package "libcgi-fast-perl" do + action :purge +end diff --git a/cookbooks/munin/resources/plugin.rb b/cookbooks/munin/resources/plugin.rb deleted file mode 100644 index 10c149436..000000000 --- a/cookbooks/munin/resources/plugin.rb +++ /dev/null @@ -1,87 +0,0 @@ -# -# Cookbook:: munin -# Provider:: munin_plugin -# -# Copyright:: 2013, OpenStreetMap Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -unified_mode true - -default_action :create - -property :plugin, :kind_of => String, :name_property => true -property :target, :kind_of => String -property :conf, :kind_of => String -property :conf_cookbook, :kind_of => String -property :conf_variables, :kind_of => Hash, :default => {} -property :restart_munin, :kind_of => [TrueClass, FalseClass], :default => true - -action :create do - link_action = case target_path - when nil then :delete - else :create - end - - link plugin_path do - action link_action - to target_path - end - - if new_resource.conf - munin_plugin_conf new_resource.plugin do - cookbook new_resource.conf_cookbook - template new_resource.conf - variables new_resource.conf_variables - restart_munin false - end - end -end - -action :delete do - link plugin_path do - action :delete - end - - if new_resource.conf - munin_plugin_conf new_resource.plugin do - action :delete - restart_munin false - end - end -end - -action_class do - def plugin_path - "/etc/munin/plugins/#{new_resource.plugin}" - end - - def target_path - if ::File.exist?(target) - target - elsif ::File.exist?("/usr/local/share/munin/plugins/#{target}") - "/usr/local/share/munin/plugins/#{target}" - elsif ::File.exist?("/usr/share/munin/plugins/#{target}") - "/usr/share/munin/plugins/#{target}" - end - end - - def target - new_resource.target || new_resource.plugin - end -end - -def after_created - notifies :restart, "service[munin-node]" if restart_munin -end diff --git a/cookbooks/munin/resources/plugin_conf.rb b/cookbooks/munin/resources/plugin_conf.rb deleted file mode 100644 index 8306b046b..000000000 --- a/cookbooks/munin/resources/plugin_conf.rb +++ /dev/null @@ -1,55 +0,0 @@ -# -# Cookbook:: munin -# Resource:: munin_plugin_conf -# -# Copyright:: 2013, OpenStreetMap Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -unified_mode true - -default_action :create - -property :plugin_conf, :kind_of => String, :name_property => true -property :cookbook, :kind_of => [String, nil] -property :template, :kind_of => String, :required => [:create] -property :variables, :kind_of => Hash, :default => {} -property :restart_munin, :kind_of => [TrueClass, FalseClass], :default => true - -action :create do - declare_resource :template, config_file do - cookbook new_resource.cookbook - source new_resource.template - owner "root" - group "root" - mode "644" - variables new_resource.variables.merge(:name => new_resource.plugin_conf) - end -end - -action :delete do - file config_file do - action :delete - end -end - -action_class do - def config_file - "/etc/munin/plugin-conf.d/#{new_resource.plugin_conf}" - end -end - -def after_created - notifies :restart, "service[munin-node]" if restart_munin -end diff --git a/cookbooks/munin/templates/default/apache.erb b/cookbooks/munin/templates/default/apache.erb deleted file mode 100644 index ed922b34a..000000000 --- a/cookbooks/munin/templates/default/apache.erb +++ /dev/null @@ -1,59 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - - - ServerName munin.openstreetmap.org - ServerAlias munin.osm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/munin.openstreetmap.org-access.log combined - ErrorLog /var/log/apache2/munin.openstreetmap.org-error.log - - SSLEngine on - SSLCertificateFile /etc/ssl/certs/munin.openstreetmap.org.pem - SSLCertificateKeyFile /etc/ssl/private/munin.openstreetmap.org.key - - SetEnv RRDCACHED_ADDRESS /var/run/rrdcached.sock - - DocumentRoot /srv/munin.openstreetmap.org - Alias /static/favicon.ico /srv/munin.openstreetmap.org/favicon.ico - Alias /static/ /etc/munin/static/ - ScriptAlias /munin-cgi/ /usr/lib/munin/cgi/ - - # Remove Proxy request header to mitigate https://httpoxy.org/ - RequestHeader unset Proxy early - - RewriteEngine on - RewriteCond %{REQUEST_URI} !^/static/ - RewriteCond %{REQUEST_URI} !^/dumps/ - RewriteRule ^(/.*\.html)?$ /munin-cgi/munin-cgi-html/$1 [PT] - - - - ServerName munin.openstreetmap.org - ServerAlias munin.osm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/munin.openstreetmap.org-access.log combined - ErrorLog /var/log/apache2/munin.openstreetmap.org-error.log - - RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/ - RedirectPermanent / https://munin.openstreetmap.org/ - - - - Require all granted - - - - Options +Indexes - - - - Require all granted - - - - Options +ExecCGI - SetHandler fcgid-script - Require all granted - diff --git a/cookbooks/munin/templates/default/backup.cron.erb b/cookbooks/munin/templates/default/backup.cron.erb deleted file mode 100644 index 13d4228ce..000000000 --- a/cookbooks/munin/templates/default/backup.cron.erb +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# DO NOT EDIT - This file is being maintained by Chef - -T=$(mktemp -d -t -p /var/tmp munin.XXXXXXXXXX) -D=$(date +%Y-%m-%d) -B=munin-$D.tar.gz - -mkdir $T/munin-$D -ln -s /var/lib/munin/openstreetmap $T/munin-$D -ln -s /var/lib/munin/*.storable $T/munin-$D - -export RSYNC_RSH="ssh -ax" - -nice tar --create --dereference --directory=$T --warning=no-file-removed munin-$D | nice gzip --rsyncable -9 > $T/$B -nice rsync --preallocate --fuzzy $T/$B backup::backup - -rm -rf $T diff --git a/cookbooks/munin/templates/default/df.erb b/cookbooks/munin/templates/default/df.erb deleted file mode 100644 index 6db42e638..000000000 --- a/cookbooks/munin/templates/default/df.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[df*] -env.exclude_re ^/run/user/ diff --git a/cookbooks/munin/templates/default/diskstats.erb b/cookbooks/munin/templates/default/diskstats.erb deleted file mode 100644 index aa9f65e2d..000000000 --- a/cookbooks/munin/templates/default/diskstats.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[diskstats] -env.exclude fd0 diff --git a/cookbooks/munin/templates/default/if.erb b/cookbooks/munin/templates/default/if.erb deleted file mode 100644 index 1f36d5042..000000000 --- a/cookbooks/munin/templates/default/if.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[if_<%= @ifname %>] -env.speed 1000 diff --git a/cookbooks/munin/templates/default/ipmi.erb b/cookbooks/munin/templates/default/ipmi.erb deleted file mode 100644 index a52fa50a0..000000000 --- a/cookbooks/munin/templates/default/ipmi.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[ipmi_*] -timeout 10 diff --git a/cookbooks/munin/templates/default/munin-node.conf.erb b/cookbooks/munin/templates/default/munin-node.conf.erb deleted file mode 100644 index 6bd38df19..000000000 --- a/cookbooks/munin/templates/default/munin-node.conf.erb +++ /dev/null @@ -1,39 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -# Configure logging -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid - -# Run in the background -background 1 -setsid 1 - -# Run as root -user root -group root - -# Regexps for files to ignore -ignore_file ~$ -ignore_file DEADJOE$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ -ignore_file \.pod$ - -# Set the hostname -host_name <%= node.name %> - -# List on port 4949 on all interfaces -host * -port 4949 - -# List the addresses that are allowed to connect -allow ^127\.0\.0\.1$ -<% @servers.sort.each do |server| -%> -allow ^<%= Regexp.quote(server) %>$ -<% end -%> -<% node[:munin][:allow].each do |address| -%> -allow ^<%= Regexp.quote(address) %>$ -<% end -%> diff --git a/cookbooks/munin/templates/default/munin.conf.erb b/cookbooks/munin/templates/default/munin.conf.erb deleted file mode 100644 index 44afaa5b1..000000000 --- a/cookbooks/munin/templates/default/munin.conf.erb +++ /dev/null @@ -1,655 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -# Set maximum number of update processes to run at once -max_processes 64 - -# Maximum number of graphs to generate at once -max_graph_jobs 24 -max_cgi_graph_jobs 24 - -# Render pages and graphs on demand -html_strategy cgi -graph_strategy cgi - -# Use rrdcached -rrdcached_socket /var/run/rrdcached.sock - -# Ignore uncontactable hosts for twelve hours -unknown_limit 144 -<% @clients.sort { |a,b| a.name <=> b.name }.each do |client| -%> - -# Configure monitoring for <%= client.name %> -[<%= client.name %>] -<% if Time.now - Time.at(client[:ohai_time]) > @expiry_time -%> - update no -<% end -%> -<% if client[:networking][:roles][:external][:zone] == "ucl" -%> - address <%= client.internal_ipaddress || client.external_ipaddress %> -<% elsif client[:networking][:roles][:external][:zone] == "ams" -%> - address <%= client.internal_ipaddress || client.external_ipaddress %> -<% elsif client[:networking][:roles][:external][:zone] == "dub" -%> - address <%= client.internal_ipaddress || client.external_ipaddress %> -<% elsif client.external_ipaddress -%> - address <%= client.external_ipaddress %> -<% end -%> - use_node_name yes -<% if client[:munin][:plugins] -%> -<% client[:munin][:plugins].keys.sort.each do |plugin| -%> -<% client[:munin][:plugins][plugin].keys.sort.each do |value| -%> -<% if client[:munin][:plugins][plugin][value].kind_of?(Hash) -%> -<% if client[:munin][:plugins][plugin][value][:graph] -%> - <%= plugin %>.<%= value %>.graph <%= client[:munin][:plugins][plugin][value][:graph] %> -<% end -%> -<% if client[:munin][:plugins][plugin][value][:draw] -%> - <%= plugin %>.<%= value %>.draw <%= client[:munin][:plugins][plugin][value][:draw] %> -<% end -%> -<% if client[:munin][:plugins][plugin][value][:label] -%> - <%= plugin %>.<%= value %>.label <%= client[:munin][:plugins][plugin][value][:label] %> -<% end -%> -<% if client[:munin][:plugins][plugin][value][:warning] -%> - <%= plugin %>.<%= value %>.warning <%= client[:munin][:plugins][plugin][value][:warning] %> -<% end -%> -<% if client[:munin][:plugins][plugin][value][:critical] -%> - <%= plugin %>.<%= value %>.critical <%= client[:munin][:plugins][plugin][value][:critical] %> -<% end -%> -<% else -%> - <%= plugin %>.<%= value %> <%= client[:munin][:plugins][plugin][value] %> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -<% if client[:munin][:graphs] -%> -<% client[:munin][:graphs].keys.sort.each do |graph| -%> -<% if client[:munin][:graphs][graph][:title] -%> - <%= graph %>.graph_title <%= client[:munin][:graphs][graph][:title] %> -<% end -%> -<% if client[:munin][:graphs][graph][:vlabel] -%> - <%= graph %>.graph_vlabel <%= client[:munin][:graphs][graph][:vlabel] %> -<% end -%> -<% if client[:munin][:graphs][graph][:category] -%> - <%= graph %>.graph_category <%= client[:munin][:graphs][graph][:category] %> -<% end -%> -<% client[:munin][:graphs][graph][:values].keys.sort.each do |value| -%> -<% if client[:munin][:graphs][graph][:values][value][:sum] -%> - <%= graph %>.<%= value %>.sum <%= client[:munin][:graphs][graph][:values][value][:sum].join(" ") %> -<% end -%> -<% if client[:munin][:graphs][graph][:values][value][:label] -%> - <%= graph %>.<%= value %>.label <%= client[:munin][:graphs][graph][:values][value][:label] %> -<% end -%> -<% end -%> -<% end -%> -<% end -%> -<% end -%> - -# Configure monitoring for switch1.openstreetmap.org -[openstreetmap.org;switch1.openstreetmap.org] - address 10.0.48.10 - use_node_name no - -# Configure monitoring for pdu1.ams.openstreetmap.org -[openstreetmap.org;pdu1.ams.openstreetmap.org] - address 10.0.48.10 - use_node_name no - -# Configure monitoring for pdu1.ams.openstreetmap.org -[openstreetmap.org;pdu2.ams.openstreetmap.org] - address 10.0.48.10 - use_node_name no - -# Configure compound graphs for ams.openstreetmap.org -[ams.openstreetmap.org] - update no - apcpdu_current.graph_title Load - apcpdu_current.graph_args --lower-limit 0 - apcpdu_current.graph_vlabel Amps - apcpdu_current.graph_category power - apcpdu_current.graph_order pdu1=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_current.current pdu2=pdu2.ams.openstreetmap.org:snmp_pdu2_ams_openstreetmap_org_apcpdu_current.current - apcpdu_current.graph_total total - apcpdu_current.pdu1.label PDU A - apcpdu_current.pdu1.draw AREASTACK - apcpdu_current.pdu1.min 0 - apcpdu_current.pdu2.label PDU B - apcpdu_current.pdu2.draw AREASTACK - apcpdu_current.pdu2.min 0 - apcpdu_power.graph_title Power - apcpdu_power.graph_args --base 1000 --lower-limit 0 - apcpdu_power.graph_vlabel Watts - apcpdu_power.graph_category power - apcpdu_power.graph_order pdu1=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_power.power pdu2=pdu2.ams.openstreetmap.org:snmp_pdu2_ams_openstreetmap_org_apcpdu_power.power - apcpdu_power.graph_total total - apcpdu_power.pdu1.label PDU A - apcpdu_power.pdu1.draw AREASTACK - apcpdu_power.pdu1.min 0 - apcpdu_power.pdu2.label PDU B - apcpdu_power.pdu2.draw AREASTACK - apcpdu_power.pdu2.min 0 - apcpdu_temperature.graph_title Temperature - apcpdu_temperature.graph_args --lower-limit 0 - apcpdu_temperature.graph_vlabel Degrees Celsius - apcpdu_temperature.graph_category sensors - apcpdu_temperature.graph_order temperature=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_temperature.temperature - apcpdu_temperature.temperature.label Temperature - apcpdu_temperature.temperature.draw LINE2 - apcpdu_temperature.temperature.min 0 - apcpdu_humidity.graph_title Humidity - apcpdu_humidity.graph_args --lower-limit 0 - apcpdu_humidity.graph_vlabel % - apcpdu_humidity.graph_category sensors - apcpdu_humidity.graph_order humidity=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_humidity.humidity - apcpdu_humidity.humidity.label Humidity - apcpdu_humidity.humidity.draw LINE2 - apcpdu_humidity.humidity.min 0 -<% unless @frontends.empty? -%> - -# Configure compound graphs for www.openstreetmap.org -[www.openstreetmap.org] - update no - apache_accesses.graph_title Apache accesses - apache_accesses.graph_vlabel accesses / ${graph_period} - apache_accesses.graph_category apache - apache_accesses.graph_args --lower-limit 0 - apache_accesses.accesses80.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:apache_accesses.accesses80", @frontends %> - apache_accesses.accesses80.label port 80 - apache_accesses.accesses80.min 0 - apache_volume.graph_title Apache volume - apache_volume.graph_vlabel bytes per ${graph_period} - apache_volume.graph_category apache - apache_volume.graph_args --lower-limit 0 - apache_volume.volume80.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:apache_volume.volume80", @frontends %> - apache_volume.volume80.label port 80 - apache_volume.volume80.min 0 - network_in.graph_title Inbound network traffic - network_in.graph_vlabel bits in per ${graph_period} - network_in.graph_category network - network_in.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.down", @frontends %> - network_in.graph_total total - network_in.graph_args --lower-limit 0 -<% @frontends.each do |fe| -%> - network_in.<%= fe[:name].tr("-", "_") %>.label <%= fe[:name] %> - network_in.<%= fe[:name].tr("-", "_") %>.cdef <%= fe[:name].tr("-", "_") %>,8,* - network_in.<%= fe[:name].tr("-", "_") %>.draw AREASTACK - network_in.<%= fe[:name].tr("-", "_") %>.min 0 -<% end -%> - network_out.graph_title Outbound network traffic - network_out.graph_vlabel bits out per ${graph_period} - network_out.graph_category network - network_out.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.up", @frontends %> - network_out.graph_total total - network_out.graph_args --lower-limit 0 -<% @frontends.each do |fe| -%> - network_out.<%= fe[:name].tr("-", "_") %>.label <%= fe[:name] %> - network_out.<%= fe[:name].tr("-", "_") %>.cdef <%= fe[:name].tr("-", "_") %>,8,* - network_out.<%= fe[:name].tr("-", "_") %>.draw AREASTACK - network_out.<%= fe[:name].tr("-", "_") %>.min 0 -<% end -%> - api_calls_www.graph_title Active requests - api_calls_www.graph_vlabel Number of requests - api_calls_www.graph_category api - api_calls_www.graph_order map upload amf history full trkpts web other - api_calls_www.web.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.web", @frontends %> - api_calls_www.web.label Web site traffic - api_calls_www.upload.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.upload", @frontends %> - api_calls_www.upload.label Changeset diff uploads - api_calls_www.other.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.other", @frontends %> - api_calls_www.other.label Other API calls - api_calls_www.amf.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.amf", @frontends %> - api_calls_www.amf.label AMF API calls - api_calls_www.history.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.history", @frontends %> - api_calls_www.history.label Element history fetches - api_calls_www.full.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.full", @frontends %> - api_calls_www.full.label Full element fetches - api_calls_www.map.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.map", @frontends %> - api_calls_www.map.label Map API calls - api_calls_www.trkpts.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_%%%name%%%.trkpts", @frontends %> - api_calls_www.trkpts.label GPX trackpoints calls - api_calls_error.graph_title HTTP errors - api_calls_error.graph_vlabel Number of errors per ${graph_period} - api_calls_error.graph_category api - api_calls_error.graph_order http401 http422 http500 http502 http503 http509 - api_calls_error.http401.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http401", @frontends %> - api_calls_error.http401.label 401 Unauthorized - api_calls_error.http401.warning :0.5 - api_calls_error.http422.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http422", @frontends %> - api_calls_error.http422.label 422 Unprocessable Entity - api_calls_error.http422.warning :0.5 - api_calls_error.http500.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http500", @frontends %> - api_calls_error.http500.label 500 Internal Server Error - api_calls_error.http500.warning :0.5 - api_calls_error.http502.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http502", @frontends %> - api_calls_error.http502.label 502 Bad Gateway - api_calls_error.http502.warning :0.5 - api_calls_error.http503.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http503", @frontends %> - api_calls_error.http503.label 503 Service Unavailable - api_calls_error.http503.warning :0.5 - api_calls_error.http509.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_status.http509", @frontends %> - api_calls_error.http509.label 509 Bandwidth Limit Exceeded - api_calls_error.http509.warning :5 - api_calls_num.graph_title Requests processed - api_calls_num.graph_vlabel Number of requests per ${graph_period} - api_calls_num.graph_category api - api_calls_num.graph_order map upload amf history full trkpts web other - api_calls_num.web.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.web", @frontends %> - api_calls_num.web.label Web site traffic - api_calls_num.upload.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.upload", @frontends %> - api_calls_num.upload.label Changeset diff uploads - api_calls_num.other.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.other", @frontends %> - api_calls_num.other.label Other API calls - api_calls_num.amf.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.amf", @frontends %> - api_calls_num.amf.label AMF API calls - api_calls_num.history.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.history", @frontends %> - api_calls_num.history.label Element history fetches - api_calls_num.full.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.full", @frontends %> - api_calls_num.full.label Full element fetches - api_calls_num.map.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.map", @frontends %> - api_calls_num.map.label Map API calls - api_calls_num.trkpts.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_calls_num.trkpts", @frontends %> - api_calls_num.trkpts.label GPX trackpoints calls - api_waits_www.graph_title Wait times for active requests - api_waits_www.graph_vlabel Average time of requests - api_waits_www.graph_category api - api_waits_www.graph_order map upload amf history full trkpts web other - api_waits_www.web.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.web", @frontends %> - api_waits_www.web.label Web site traffic - api_waits_www.web.cdef web,2,/ - api_waits_www.upload.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.upload", @frontends %> - api_waits_www.upload.label Changeset diff uploads - api_waits_www.upload.cdef upload,2,/ - api_waits_www.other.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.other", @frontends %> - api_waits_www.other.label Other API calls - api_waits_www.other.cdef other,2,/ - api_waits_www.amf.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.amf", @frontends %> - api_waits_www.amf.label AMF API calls - api_waits_www.amf.cdef amf,2,/ - api_waits_www.history.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.history", @frontends %> - api_waits_www.history.label Element history fetches - api_waits_www.history.cdef history,2,/ - api_waits_www.full.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.full", @frontends %> - api_waits_www.full.label Full element fetches - api_waits_www.full.cdef full,2,/ - api_waits_www.map.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.map", @frontends %> - api_waits_www.map.label Map API calls - api_waits_www.map.cdef map,2,/ - api_waits_www.trkpts.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:api_waits_%%%name%%%.trkpts", @frontends %> - api_waits_www.trkpts.label GPX trackpoints calls - api_waits_www.trkpts.cdef trkpts,2,/ - memcached_multi_commands.graph_title Commands - memcached_multi_commands.graph_vlabel Commands per ${graph_period} - memcached_multi_commands.graph_category memcached - memcached_multi_commands.graph_order cmd_get cmd_set cmd_touch get_hits get_misses delete_hits delete_misses incr_hits incr_misses decr_hits decr_misses touch_hits touch_misses - memcached_multi_commands.cmd_get.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.cmd_get", @frontends %> - memcached_multi_commands.cmd_get.label Gets - memcached_multi_commands.cmd_set.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.cmd_set", @frontends %> - memcached_multi_commands.cmd_set.label Sets - memcached_multi_commands.cmd_touch.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.cmd_touch", @frontends %> - memcached_multi_commands.cmd_touch.label Touches - memcached_multi_commands.get_hits.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.get_hits", @frontends %> - memcached_multi_commands.get_hits.label Get Hits - memcached_multi_commands.get_misses.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.get_misses", @frontends %> - memcached_multi_commands.get_misses.label Get Misses - memcached_multi_commands.delete_hits.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.delete_hits", @frontends %> - memcached_multi_commands.delete_hits.label Delete Hits - memcached_multi_commands.delete_misses.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.delete_misses", @frontends %> - memcached_multi_commands.delete_misses.label Delete Misses - memcached_multi_commands.incr_hits.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.incr_hits", @frontends %> - memcached_multi_commands.incr_hits.label Increment Hits - memcached_multi_commands.incr_misses.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.incr_misses", @frontends %> - memcached_multi_commands.incr_misses.label Increment Misses - memcached_multi_commands.decr_hits.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.decr_hits", @frontends %> - memcached_multi_commands.decr_hits.label Decrement Hits - memcached_multi_commands.decr_misses.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.decr_misses", @frontends %> - memcached_multi_commands.decr_misses.label Decrement Misses - memcached_multi_commands.touch_hits.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.touch_hits", @frontends %> - memcached_multi_commands.touch_hits.label Touch Hits - memcached_multi_commands.touch_misses.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_commands.touch_misses", @frontends %> - memcached_multi_commands.touch_misses.label Touch Misses - memcached_multi_conns.graph_title Connections - memcached_multi_conns.graph_vlabel Connections per ${graph_period} - memcached_multi_conns.graph_category memcached - memcached_multi_conns.graph_order max_conns curr_conns avg_conns - memcached_multi_conns.curr_conns.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_conns.curr_conns", @frontends %> - memcached_multi_conns.curr_conns.label Current Connections - memcached_multi_conns.max_conns.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_conns.max_conns", @frontends %> - memcached_multi_conns.max_conns.label Max Connections - memcached_multi_conns.avg_conns.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_conns.avg_conns", @frontends %> - memcached_multi_conns.avg_conns.label Avg Connections - memcached_multi_evictions.graph_title Evictions - memcached_multi_evictions.graph_vlabel Evictions per ${graph_period} - memcached_multi_evictions.graph_category memcached - memcached_multi_evictions.evictions.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_evictions.evictions", @frontends %> - memcached_multi_evictions.evictions.label Evictions - memcached_multi_evictions.evicted_nonzero.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_evictions.evicted_nonzero", @frontends %> - memcached_multi_evictions.evicted_nonzero.label Evictions prior to Expire - memcached_multi_evictions.reclaimed.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_evictions.reclaimed", @frontends %> - memcached_multi_evictions.reclaimed.label Reclaimed Items - memcached_multi_items.graph_title Items - memcached_multi_items.graph_vlabel Items in Memcached - memcached_multi_items.graph_category memcached - memcached_multi_items.graph_order curr_items total_items - memcached_multi_items.curr_items.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_items.curr_items", @frontends %> - memcached_multi_items.curr_items.label Current Items - memcached_multi_items.total_items.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_items.total_items", @frontends %> - memcached_multi_items.total_items.label New Items - memcached_multi_memory.graph_title Memory Usage - memcached_multi_memory.graph_vlabel Bytes Used - memcached_multi_memory.graph_category memcached - memcached_multi_memory.graph_order limit_maxbytes bytes - memcached_multi_memory.limit_maxbytes.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_memory.limit_maxbytes", @frontends %> - memcached_multi_memory.limit_maxbytes.label Maximum Bytes Allocated - memcached_multi_memory.bytes.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_memory.bytes", @frontends %> - memcached_multi_memory.bytes.label Current Bytes Used - memcached_multi_bytes.graph_title Network Traffic - memcached_multi_bytes.graph_args --base 1000 - memcached_multi_bytes.graph_vlabel bits in (-) / out (+) - memcached_multi_bytes.graph_category memcached - memcached_multi_bytes.graph_order bytes_read bytes_written - memcached_multi_bytes.bytes_read.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_bytes.bytes_read", @frontends %> - memcached_multi_bytes.bytes_read.label Network Traffic coming in (-) - memcached_multi_bytes.bytes_read.cdef bytes_read,8,* - memcached_multi_bytes.bytes_read.graph no - memcached_multi_bytes.bytes_written.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:memcached_multi_bytes.bytes_written", @frontends %> - memcached_multi_bytes.bytes_written.negative bytes_read - memcached_multi_bytes.bytes_written.label Traffic in (-) / out (+) - memcached_multi_bytes.bytes_written.cdef bytes_written,8,* -<% end -%> -<% unless @renderers.empty? -%> - -# Configure compound graphs for render.openstreetmap.org -[render.openstreetmap.org] - update no - apache_accesses.graph_title Apache accesses - apache_accesses.graph_vlabel accesses / ${graph_period} - apache_accesses.graph_category apache - apache_accesses.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:apache_accesses.accesses80", @renderers %> - apache_accesses.graph_total total - apache_accesses.graph_args --lower-limit 0 -<% @renderers.each do |rs| -%> - apache_accesses.<%= rs[:name].tr("-", "_") %>.label <%= rs[:name] %> - apache_accesses.<%= rs[:name].tr("-", "_") %>.draw AREASTACK - apache_accesses.<%= rs[:name].tr("-", "_") %>.min 0 -<% end -%> - apache_volume.graph_title Apache volume - apache_volume.graph_vlabel bytes per ${graph_period} - apache_volume.graph_category apache - apache_volume.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:apache_volume.volume80", @renderers %> - apache_volume.graph_total total - apache_volume.graph_args --lower-limit 0 -<% @renderers.each do |rs| -%> - apache_volume.<%= rs[:name].tr("-", "_") %>.label <%= rs[:name] %> - apache_volume.<%= rs[:name].tr("-", "_") %>.draw AREASTACK - apache_volume.<%= rs[:name].tr("-", "_") %>.min 0 -<% end -%> - network_in.graph_title Inbound network traffic - network_in.graph_vlabel bits in per ${graph_period} - network_in.graph_category network - network_in.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.down", @renderers %> - network_in.graph_total total - network_in.graph_args --lower-limit 0 -<% @renderers.each do |rs| -%> - network_in.<%= rs[:name].tr("-", "_") %>.label <%= rs[:name] %> - network_in.<%= rs[:name].tr("-", "_") %>.cdef <%= rs[:name].tr("-", "_") %>,8,* - network_in.<%= rs[:name].tr("-", "_") %>.draw AREASTACK - network_in.<%= rs[:name].tr("-", "_") %>.min 0 -<% end -%> - network_out.graph_title Outbound network traffic - network_out.graph_vlabel bits out per ${graph_period} - network_out.graph_category network - network_out.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.up", @renderers %> - network_out.graph_total total - network_out.graph_args --lower-limit 0 -<% @renderers.each do |rs| -%> - network_out.<%= rs[:name].tr("-", "_") %>.label <%= rs[:name] %> - network_out.<%= rs[:name].tr("-", "_") %>.cdef <%= rs[:name].tr("-", "_") %>,8,* - network_out.<%= rs[:name].tr("-", "_") %>.draw AREASTACK - network_out.<%= rs[:name].tr("-", "_") %>.min 0 -<% end -%> - mod_tile_fresh.graph_title freshness of served tiles - mod_tile_fresh.graph_args --base 1000 -l 0 - mod_tile_fresh.graph_vlabel tiles per ${graph_period} - mod_tile_fresh.graph_order fresh freshrender old oldrender outdated outdatedrender - mod_tile_fresh.graph_category mod_tile - mod_tile_fresh.fresh.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.fresh", @renderers %> - mod_tile_fresh.fresh.label Fresh from disk - mod_tile_fresh.fresh.draw AREA - mod_tile_fresh.freshrender.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.freshrender", @renderers %> - mod_tile_fresh.freshrender.label Freshly rendered - mod_tile_fresh.freshrender.draw STACK - mod_tile_fresh.old.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.old", @renderers %> - mod_tile_fresh.old.label Old from disk - mod_tile_fresh.old.draw STACK - mod_tile_fresh.oldrender.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.oldrender", @renderers %> - mod_tile_fresh.oldrender.label Old tile, attempted render - mod_tile_fresh.oldrender.draw STACK - mod_tile_fresh.outdated.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.outdated", @renderers %> - mod_tile_fresh.outdated.label Outdated from disk - mod_tile_fresh.outdated.draw STACK - mod_tile_fresh.outdatedrender.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_fresh.outdatedrender", @renderers %> - mod_tile_fresh.outdatedrender.label Outdated tile, attempted render - mod_tile_fresh.outdatedrender.draw STACK - mod_tile_response.graph_title mod_tile HTTP response codes - mod_tile_response.graph_args --base 1000 -l 0 - mod_tile_response.graph_vlabel responses per ${graph_period} - mod_tile_response.graph_order response200 response304 response404 response500 - mod_tile_response.graph_category mod_tile - mod_tile_response.response200.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_response.response200", @renderers %> - mod_tile_response.response200.label 200 OK - mod_tile_response.response200.draw AREA - mod_tile_response.response304.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_response.response304", @renderers %> - mod_tile_response.response304.label 304 Not Modified - mod_tile_response.response304.draw STACK - mod_tile_response.response404.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_response.response404", @renderers %> - mod_tile_response.response404.label 404 Not Found - mod_tile_response.response404.draw STACK - mod_tile_response.response500.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_response.response500", @renderers %> - mod_tile_response.response500.label 500 Internal Error - mod_tile_response.response500.draw STACK - mod_tile_zoom.graph_title mod_tile responses by zoom layer - mod_tile_zoom.graph_args --base 1000 -l 0 - mod_tile_zoom.graph_vlabel responses per ${graph_period} - mod_tile_zoom.graph_order z1 z2 z3 z4 z5 z6 - mod_tile_zoom.graph_category mod_tile - mod_tile_zoom.z1.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z1", @renderers %> - mod_tile_zoom.z1.label z1-8 - mod_tile_zoom.z1.draw AREA - mod_tile_zoom.z2.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z2", @renderers %> - mod_tile_zoom.z2.label z9-12 - mod_tile_zoom.z2.draw STACK - mod_tile_zoom.z3.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z3", @renderers %> - mod_tile_zoom.z3.label z13-14 - mod_tile_zoom.z3.draw STACK - mod_tile_zoom.z4.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z4", @renderers %> - mod_tile_zoom.z4.label z15-16 - mod_tile_zoom.z4.draw STACK - mod_tile_zoom.z5.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z5", @renderers %> - mod_tile_zoom.z5.label z17-18 - mod_tile_zoom.z5.draw STACK - mod_tile_zoom.z6.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:mod_tile_zoom.z6", @renderers %> - mod_tile_zoom.z6.label z19-20 - mod_tile_zoom.z6.draw STACK - renderd_queue.graph_title Renderd queue length - renderd_queue.graph_args --base 1000 -l 0 - renderd_queue.graph_vlabel metatiles - renderd_queue.graph_order reqPrio req reqLow dirty reqBulk - renderd_queue.graph_category renderd - renderd_queue.reqPrio.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue.reqPrio", @renderers %> - renderd_queue.reqPrio.label Priority request Queue - renderd_queue.reqPrio.type GAUGE - renderd_queue.req.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue.req", @renderers %> - renderd_queue.req.label Request Queue - renderd_queue.req.type GAUGE - renderd_queue.reqLow.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue.reqLow", @renderers %> - renderd_queue.reqLow.label Low priority request Queue - renderd_queue.reqLow.type GAUGE - renderd_queue.dirty.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue.dirty", @renderers %> - renderd_queue.dirty.label Dirty Queue - renderd_queue.dirty.type GAUGE - renderd_queue.reqBulk.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue.reqBulk", @renderers %> - renderd_queue.reqBulk.label Bulk request Queue - renderd_queue.reqBulk.type GAUGE - renderd_processed.graph_title Renderd throughput - renderd_processed.graph_args --base 1000 -l 0 - renderd_processed.graph_vlabel Metatiles per ${graph_period} - renderd_processed.graph_order reqPrio req reqLow dirty reqBulk dropped - renderd_processed.graph_category renderd - renderd_processed.graph_info Displays the number of metatiles being rendered by renderd per ${graph_period} - renderd_processed.reqPrio.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.reqPrio", @renderers %> - renderd_processed.reqPrio.label Priority request Queue - renderd_processed.reqPrio.draw AREA - renderd_processed.reqPrio.info Throughput of Metatiles submitted high priority for on the fly rendering - renderd_processed.req.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.req", @renderers %> - renderd_processed.req.label Request Queue - renderd_processed.req.draw STACK - renderd_processed.req.info Throughput of Metatiles submitted for on the fly rendering - renderd_processed.reqLow.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.reqLow", @renderers %> - renderd_processed.reqLow.label Low priority request Queue - renderd_processed.reqLow.draw STACK - renderd_processed.reqLow.info Throughput of Metatiles submitted low priority for on the fly rendering - renderd_processed.dirty.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.dirty", @renderers %> - renderd_processed.dirty.label Dirty Queue - renderd_processed.dirty.draw STACK - renderd_processed.dirty.info Throughput of dirty Metatiles submitted for re-render - renderd_processed.reqBulk.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.reqBulk", @renderers %> - renderd_processed.reqBulk.label Bulk request Queue - renderd_processed.reqBulk.draw STACK - renderd_processed.reqBulk.info Throughput of Metatiles submitted with background priority - renderd_processed.dropped.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_processed.dropped", @renderers %> - renderd_processed.dropped.label Dropped (x20) - renderd_processed.dropped.draw LINE2 - renderd_processed.dropped.info Number of Tiles dropped due to queue overload (x20) - renderd_processed.dropped.cdef dropped,20,/ - renderd_zoom.graph_title Renderd throughput by zoom - renderd_zoom.graph_args --base 1000 -l 0 - renderd_zoom.graph_vlabel Metatiles per ${graph_period} - renderd_zoom.graph_order z1 z2 z3 z4 z5 z6 - renderd_zoom.graph_category renderd - renderd_zoom.graph_info Displays the number of metatiles being rendered by renderd per ${graph_period} - renderd_zoom.z1.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z1", @renderers %> - renderd_zoom.z1.label zoom z0 - z8 - renderd_zoom.z1.draw AREA - renderd_zoom.z1.info Throughput of Metatiles for z0 - z8 - renderd_zoom.z2.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z2", @renderers %> - renderd_zoom.z2.label zoom z9 - z12 - renderd_zoom.z2.draw STACK - renderd_zoom.z2.info Throughput of Metatiles for z9 - z12 - renderd_zoom.z3.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z3", @renderers %> - renderd_zoom.z3.label zoom z13 - z14 - renderd_zoom.z3.draw STACK - renderd_zoom.z3.info Throughput of Metatiles for z13 - z14 - renderd_zoom.z4.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z4", @renderers %> - renderd_zoom.z4.label zoom z15 - z16 - renderd_zoom.z4.draw STACK - renderd_zoom.z4.info Throughput of Metatiles for z15 - z16 - renderd_zoom.z5.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z5", @renderers %> - renderd_zoom.z5.label zoom z17 - z18 - renderd_zoom.z5.draw STACK - renderd_zoom.z5.info Throughput of Metatiles for z17 - z18 - renderd_zoom.z6.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom.z6", @renderers %> - renderd_zoom.z6.label zoom z19 - z20 - renderd_zoom.z6.draw STACK - renderd_zoom.z6.info Throughput of Metatiles for z19 - z20 - renderd_queue_time.graph_title Renderd time spent by queue - renderd_queue_time.graph_args --base 1000 -l 0 - renderd_queue_time.graph_vlabel metatiles - renderd_queue_time.graph_order reqPrio req reqLow dirty reqBulk - renderd_queue_time.graph_category renderd - renderd_queue_time.reqPrio.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue_time.reqPrio", @renderers %> - renderd_queue_time.reqPrio.label Priority request queue - renderd_queue_time.reqPrio.cdef reqPrio,1000,/ - renderd_queue_time.reqPrio.draw AREA - renderd_queue_time.reqPrio.info Time for priority request queue - renderd_queue_time.req.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue_time.req", @renderers %> - renderd_queue_time.req.label Request queue - renderd_queue_time.req.cdef req,1000,/ - renderd_queue_time.req.draw STACK - renderd_queue_time.req.info Time for Request queue - renderd_queue_time.reqLow.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue_time.reqLow", @renderers %> - renderd_queue_time.reqLow.label Low priority request queue - renderd_queue_time.reqLow.cdef reqLow,1000,/ - renderd_queue_time.reqLow.draw STACK - renderd_queue_time.reqLow.info Time for low priority request queue - renderd_queue_time.dirty.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue_time.dirty", @renderers %> - renderd_queue_time.dirty.label Dirty queue - renderd_queue_time.dirty.cdef dirty,1000,/ - renderd_queue_time.dirty.draw STACK - renderd_queue_time.dirty.info Time for dirty queue - renderd_queue_time.reqBulk.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_queue_time.reqBulk", @renderers %> - renderd_queue_time.reqBulk.label Bulk queue - renderd_queue_time.reqBulk.cdef reqBulk,1000,/ - renderd_queue_time.reqBulk.draw STACK - renderd_queue_time.reqBulk.info Time for bulk queue - renderd_zoom_time.graph_title Renderd time spent by zoom - renderd_zoom_time.graph_args --base 1000 -l 0 - renderd_zoom_time.graph_vlabel time spent per ${graph_period} - renderd_zoom_time.graph_order zoomtime1 zoomtime2 zoomtime3 zoomtime4 zoomtime5 zoomtime6 - renderd_zoom_time.graph_category renderd - renderd_zoom_time.graph_info Displays the amount of time renderd has spent rendering tiles of a given zoom per ${graph_period} - renderd_zoom_time.zoomtime1.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime1", @renderers %> - renderd_zoom_time.zoomtime1.label zoom z0 - z8 - renderd_zoom_time.zoomtime1.cdef zoomtime1,1000,/ - renderd_zoom_time.zoomtime1.draw AREA - renderd_zoom_time.zoomtime1.info Time for Metatiles z0 - z8 - renderd_zoom_time.zoomtime2.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime2", @renderers %> - renderd_zoom_time.zoomtime2.label zoom z9 - z12 - renderd_zoom_time.zoomtime2.cdef zoomtime2,1000,/ - renderd_zoom_time.zoomtime2.draw STACK - renderd_zoom_time.zoomtime2.info Time for Metatiles for z9 - z12 - renderd_zoom_time.zoomtime3.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime3", @renderers %> - renderd_zoom_time.zoomtime3.label zoom z13 - z14 - renderd_zoom_time.zoomtime3.cdef zoomtime3,1000,/ - renderd_zoom_time.zoomtime3.draw STACK - renderd_zoom_time.zoomtime3.info Time for Metatiles for z13 - z14 - renderd_zoom_time.zoomtime4.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime4", @renderers %> - renderd_zoom_time.zoomtime4.label zoom z15 - z16 - renderd_zoom_time.zoomtime4.cdef zoomtime4,1000,/ - renderd_zoom_time.zoomtime4.draw STACK - renderd_zoom_time.zoomtime4.info Time for Metatiles for z15 - z16 - renderd_zoom_time.zoomtime5.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime5", @renderers %> - renderd_zoom_time.zoomtime5.label zoom z17 - z18 - renderd_zoom_time.zoomtime5.cdef zoomtime5,1000,/ - renderd_zoom_time.zoomtime5.draw STACK - renderd_zoom_time.zoomtime5.info Time for Metatiles for z17 - z18 - renderd_zoom_time.zoomtime6.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:renderd_zoom_time.zoomtime6", @renderers %> - renderd_zoom_time.zoomtime6.label zoom z19 - z20 - renderd_zoom_time.zoomtime6.cdef zoomtime6,1000,/ - renderd_zoom_time.zoomtime6.draw STACK - renderd_zoom_time.zoomtime6.info Time for Metatiles for z19 - z20 -<% end -%> -<% unless @geocoders.empty? -%> - -# Configure compound graphs for nominatim.openstreetmap.org -[nominatim.openstreetmap.org] - update no - nominatim_requests.graph_title Requests by API call - nominatim_requests.graph_args --base 1000 -l 0 - nominatim_requests.graph_vlabel requests per minute - nominatim_requests.graph_category nominatim - nominatim_requests.graph_order z1 z2 z3 z4 - nominatim_requests.z1.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_requests.z1", @geocoders %> - nominatim_requests.z1.label reverse - nominatim_requests.z1.draw AREA - nominatim_requests.z1.type GAUGE - nominatim_requests.z2.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_requests.z2", @geocoders %> - nominatim_requests.z2.label search (successful) - nominatim_requests.z2.draw STACK - nominatim_requests.z2.type GAUGE - nominatim_requests.z3.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_requests.z3", @geocoders %> - nominatim_requests.z3.label search (no result) - nominatim_requests.z3.draw STACK - nominatim_requests.z3.type GAUGE - nominatim_requests.z4.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_requests.z4", @geocoders %> - nominatim_requests.z4.label details - nominatim_requests.z4.draw STACK - nominatim_requests.z4.type GAUGE - nominatim_throttled_ips.graph_title Restricted IPs - nominatim_throttled_ips.graph_args -l 0 - nominatim_throttled_ips.graph_vlabel number of IPs - nominatim_throttled_ips.graph_category nominatim - nominatim_throttled_ips.graph_order bulk block - nominatim_throttled_ips.bulk.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_throttled_ips.bulk", @geocoders %> - nominatim_throttled_ips.bulk.label bulk - nominatim_throttled_ips.bulk.draw AREA - nominatim_throttled_ips.bulk.type GAUGE - nominatim_throttled_ips.block.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:nominatim_throttled_ips.block", @geocoders %> - nominatim_throttled_ips.block.label blocked - nominatim_throttled_ips.block.draw STACK - nominatim_throttled_ips.block.type GAUGE -<% end -%> diff --git a/cookbooks/munin/templates/default/rrdcached.erb b/cookbooks/munin/templates/default/rrdcached.erb deleted file mode 100644 index 8d2ae8a04..000000000 --- a/cookbooks/munin/templates/default/rrdcached.erb +++ /dev/null @@ -1,57 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -# Full path to daemon -DAEMON=/usr/bin/rrdcached - -# Optional override flush interval, in seconds. -WRITE_TIMEOUT=1800 - -# Optional override maximum write delay, in seconds. -WRITE_JITTER=1800 - -# Optional override number of write_threads -#WRITE_THREADS=4 - -# Where database files are placed. If left unset, the default /tmp will -# be used. NB: The daemon will reject a directory that has symlinks as -# components. NB: You may want to have -B in BASE_OPTS. -BASE_PATH=/var/lib/munin/ - -# Where journal files are placed. If left unset, journaling will -# be disabled. -JOURNAL_PATH=/var/lib/munin/rrdcached/ - -# FHS standard placement for process ID file. -PIDFILE=/var/run/rrdcached.pid - -# FHS standard placement for local control socket. -SOCKFILE=/var/run/rrdcached.sock - -# Optional override group that should own/access the local control -# socket -SOCKGROUP=munin - -# Optional override access mode of local control socket. -SOCKMODE=0666 - -# Optional unprivileged group to run under when daemon. If unset -# retains invocation group privileges. -#DAEMON_GROUP=_rrdcached - -# Optional unprivileged user to run under when daemon. If unset -# retains invocation user privileges. -#DAEMON_USER=_rrdcached - -# Network socket address requests. Use in conjunction with SOCKFILE to -# also listen on INET domain sockets. The option is a lower-case ell -# ASCII 108 = 0x6c, and should be repeated for each address. The -# parameter is an optional IP address, followed by an optional port with -# a colon separating it from the address. The empty string is -# interpreted as "open sockets on the default port on all available -# interfaces", but generally does not pass through init script functions -# so use -L with no parameters for that configuration. -#NETWORK_OPTIONS="-L" - -# Any other options not specifically supported by the script (-P, -f, -# -F, -B). -BASE_OPTIONS="-F -B" diff --git a/cookbooks/munin/templates/default/sensors_volt.erb b/cookbooks/munin/templates/default/sensors_volt.erb deleted file mode 100644 index 1224ef3ba..000000000 --- a/cookbooks/munin/templates/default/sensors_volt.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[sensors_volt] -env.volt_warn_percent 0 diff --git a/cookbooks/mysql/recipes/default.rb b/cookbooks/mysql/recipes/default.rb index 0fa3df913..b38a6364b 100644 --- a/cookbooks/mysql/recipes/default.rb +++ b/cookbooks/mysql/recipes/default.rb @@ -55,29 +55,13 @@ template "/etc/apparmor.d/local/usr.sbin.mysqld" do only_if { ::Dir.exist?("/sys/kernel/security/apparmor") } end -package "libdbd-mysql-perl" -package "libcache-cache-perl" - -%w[ - commands connections files handler_read handler_tmp handler_transaction - handler_write innodb_bpool innodb_bpool_act innodb_history_list_length - innodb_insert_buf innodb_io innodb_io_pend innodb_log innodb_queries - innodb_read_views innodb_rows innodb_semaphores innodb_srv_master_thread - innodb_tnx max_mem mrr myisam_indexes network_traffic performance - qcache qcache_mem select_types slow sorts table_definitions table_locks - tmp_tables -].each do |stat| - munin_plugin "mysql_#{stat}" do - target "mysql_" - end +# FIXME: Remove purge post munin removal +package "libdbd-mysql-perl" do + action :purge end -%w[ - bin_relay_log files_tables replication -].each do |stat| - munin_plugin "mysql_#{stat}" do - action :delete - end +package "libcache-cache-perl" do + action :purge end mysql_password = persistent_token("mysql", "prometheus", "password") diff --git a/cookbooks/nginx/recipes/default.rb b/cookbooks/nginx/recipes/default.rb index 085428583..bc7637609 100644 --- a/cookbooks/nginx/recipes/default.rb +++ b/cookbooks/nginx/recipes/default.rb @@ -53,15 +53,11 @@ service "nginx" do subscribes :restart, "template[/etc/nginx/nginx.conf]" end -munin_plugin_conf "nginx" do - template "munin.erb" +# FIXME: Remove purge post munin removal +package "libwww-perl" do + action :purge end -package "libwww-perl" - -munin_plugin "nginx_request" -munin_plugin "nginx_status" - prometheus_exporter "nginx" do port 9113 options "--nginx.scrape-uri=http://localhost:8050/nginx_status" diff --git a/cookbooks/nginx/templates/default/munin.erb b/cookbooks/nginx/templates/default/munin.erb deleted file mode 100644 index 56a2effaf..000000000 --- a/cookbooks/nginx/templates/default/munin.erb +++ /dev/null @@ -1,2 +0,0 @@ -[nginx*] - env.url http://localhost:8050/nginx_status diff --git a/cookbooks/nginx/templates/default/nginx.conf.erb b/cookbooks/nginx/templates/default/nginx.conf.erb index f5d4fc269..0d2387b2e 100644 --- a/cookbooks/nginx/templates/default/nginx.conf.erb +++ b/cookbooks/nginx/templates/default/nginx.conf.erb @@ -57,7 +57,7 @@ http { proxy_cache_path <%= node['nginx']['cache']['proxy']['directory'] %> levels=2:2:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['proxy']['keys_zone'] %> inactive=<%= node['nginx']['cache']['proxy']['inactive'] %> max_size=<%= node['nginx']['cache']['proxy']['max_size'] %>; <% end -%> - # Internal site for munin monitoring + # Internal site for stats monitoring server { listen 127.0.0.1:8050; server_name localhost; diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index bf0db0aec..14b2b6628 100644 --- a/cookbooks/nominatim/recipes/default.rb +++ b/cookbooks/nominatim/recipes/default.rb @@ -86,11 +86,6 @@ postgresql_user "www-data" do only_if { node[:nominatim][:state] != "slave" } end -postgresql_munin "nominatim" do - cluster node[:nominatim][:dbcluster] - database node[:nominatim][:dbname] -end - directory "#{basedir}/tablespaces" do owner "postgres" group "postgres" @@ -611,25 +606,6 @@ template "/etc/logrotate.d/nominatim" do end # Monitoring - -munin_plugin_conf "nominatim" do - template "munin.erb" - variables :db => node[:nominatim][:dbname], - :querylog => "#{node[:nominatim][:logdir]}/query.log" -end - -munin_plugin "nominatim_importlag" do - target "#{source_directory}/munin/nominatim_importlag" -end - -munin_plugin "nominatim_query_speed" do - target "#{source_directory}/munin/nominatim_query_speed_querylog" -end - -munin_plugin "nominatim_requests" do - target "#{source_directory}/munin/nominatim_requests_querylog" -end - prometheus_exporter "nominatim" do port 8082 user "www-data" diff --git a/cookbooks/nominatim/templates/default/munin.erb b/cookbooks/nominatim/templates/default/munin.erb deleted file mode 100644 index 284314567..000000000 --- a/cookbooks/nominatim/templates/default/munin.erb +++ /dev/null @@ -1,7 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[nominatim_*] -user www-data -env.PGDATABASE <%= @db %> -env.PGUSER www-data -env.NOMINATIM_QUERYLOG <%= @querylog %> diff --git a/cookbooks/ntp/recipes/default.rb b/cookbooks/ntp/recipes/default.rb index 3a9b0bb8b..1b131f8f8 100644 --- a/cookbooks/ntp/recipes/default.rb +++ b/cookbooks/ntp/recipes/default.rb @@ -61,8 +61,6 @@ service "chrony" do action [:enable, :start] end -munin_plugin "chrony" - prometheus_exporter "chrony" do port 9123 end diff --git a/cookbooks/overpass/recipes/default.rb b/cookbooks/overpass/recipes/default.rb index 720b11321..474697168 100644 --- a/cookbooks/overpass/recipes/default.rb +++ b/cookbooks/overpass/recipes/default.rb @@ -27,7 +27,7 @@ username = "overpass" basedir = data_bag_item("accounts", username)["home"] web_passwords = data_bag_item("web", "passwords") -%w[bin site diffs db src munin].each do |dirname| +%w[bin site diffs db src].each do |dirname| directory "#{basedir}/#{dirname}" do owner username group username @@ -36,6 +36,12 @@ web_passwords = data_bag_item("web", "passwords") end end +# FIXME: Remove purge post munin removal +directory "#{basedir}/munin" do + action :delete + recursive true +end + ## Install overpass from source srcdir = "#{basedir}/src/osm-3s_v#{node[:overpass][:version]}" @@ -229,24 +235,6 @@ template "/etc/logrotate.d/overpass" do variables :logdir => logdir end -# Munin scripts - -%w[db_lag request_count].each do |name| - template "#{basedir}/munin/overpass_#{name}" do - source "munin_#{name}.erb" - owner username - group username - mode "755" - variables :basedir => basedir - end - - munin_plugin "overpass_#{name}" do - target "#{basedir}/munin/overpass_#{name}" - conf "munin.erb" - conf_variables :user => username - end -end - prometheus_exporter "overpass" do port 9898 user username diff --git a/cookbooks/overpass/templates/default/munin.erb b/cookbooks/overpass/templates/default/munin.erb deleted file mode 100644 index a2f47fa92..000000000 --- a/cookbooks/overpass/templates/default/munin.erb +++ /dev/null @@ -1,4 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[<%= @name %>] -user <%= @user %> diff --git a/cookbooks/overpass/templates/default/munin_db_lag.erb b/cookbooks/overpass/templates/default/munin_db_lag.erb deleted file mode 100644 index ce8bdfaf7..000000000 --- a/cookbooks/overpass/templates/default/munin_db_lag.erb +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# DO NOT EDIT - This file is being maintained by Chef -# -# Based on: https://github.com/drolbr/Overpass-API/blob/way_based_areas/munin/osm_replication_lag-api - -if [ "$1" = "config" ]; then - - echo 'graph_title DB Lag' - echo 'graph_args --base 1000' - echo 'graph_vlabel minutes behind main database' - echo 'graph_category overpass' - - echo 'lag.label replication lag' - echo 'lag.draw LINE' - echo 'lag.cdef lag,60,/' - echo 'lag.critical 1000' - - exit 0 -fi - -lag=$(($(date +%s)-$(date +%s --utc -d "$(cat <%= @basedir %>/db/osm_base_version | cut -f2 -d\" | sed s/"\\\\"/""/g | sed s/[ZT]/" "/g)" ))) -echo "lag.value $lag" diff --git a/cookbooks/overpass/templates/default/munin_request_count.erb b/cookbooks/overpass/templates/default/munin_request_count.erb deleted file mode 100644 index 7e85851f1..000000000 --- a/cookbooks/overpass/templates/default/munin_request_count.erb +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -# -# DO NOT EDIT - This file is being maintained by Chef -# -# Based on: https://github.com/drolbr/Overpass-API/blob/way_based_areas/munin/osm_db_request_count - -if [[ "$1" = "config" ]]; then -{ - echo 'graph_title API request count' - echo 'graph_vlabel per minute' - echo 'graph_category overpass' - echo "overpass_request_started.label Base started" - echo "overpass_request_started.type COUNTER" - echo "overpass_request_started.cdef overpass_request_started,60,*" - echo "overpass_request_started.max 10000" - echo "overpass_request_completed.label Base completed" - echo "overpass_request_completed.type COUNTER" - echo "overpass_request_completed.cdef overpass_request_completed,60,*" - echo "overpass_request_completed.max 10000" - echo "overpass_area_request_started.label Area started" - echo "overpass_area_request_started.type COUNTER" - echo "overpass_area_request_started.cdef overpass_area_request_started,60,*" - echo "overpass_area_request_started.max 10000" - echo "overpass_area_request_completed.label Area completed" - echo "overpass_area_request_completed.type COUNTER" - echo "overpass_area_request_completed.cdef overpass_area_request_completed,60,*" - echo "overpass_area_request_completed.max 10000" - exit 0 -}; fi - -BASE_STATUS=`<%= @basedir %>/bin/dispatcher --osm-base --status | tr '\n' '|'` -AREA_STATUS=`<%= @basedir %>/bin/dispatcher --areas --status | tr '\n' '|'` - -STARTED=`echo $BASE_STATUS | sed 's,.*Counter of started requests:,,;s:|.*::'` -echo "overpass_request_started.value $STARTED" - -COMPLETED=`echo $BASE_STATUS | sed 's,.*Counter of finished requests:,,;s:|.*::'` -echo "overpass_request_completed.value $COMPLETED" - -STARTED=`echo $AREA_STATUS | sed 's,.*Counter of started requests:,,;s:|.*::'` -echo "overpass_area_request_started.value $STARTED" - -COMPLETED=`echo $AREA_STATUS | sed 's,.*Counter of finished requests:,,;s:|.*::'` -echo "overpass_area_request_completed.value $COMPLETED" diff --git a/cookbooks/passenger/recipes/default.rb b/cookbooks/passenger/recipes/default.rb index e162e612f..04e85b486 100644 --- a/cookbooks/passenger/recipes/default.rb +++ b/cookbooks/passenger/recipes/default.rb @@ -42,15 +42,6 @@ apache_module "passenger" do conf "passenger.conf.erb" end -munin_plugin_conf "passenger" do - template "munin.erb" -end - -munin_plugin "passenger_memory" -munin_plugin "passenger_processes" -munin_plugin "passenger_queues" -munin_plugin "passenger_requests" - prometheus_exporter "passenger" do port 9149 user "root" diff --git a/cookbooks/passenger/templates/default/munin.erb b/cookbooks/passenger/templates/default/munin.erb deleted file mode 100644 index 903fcfe34..000000000 --- a/cookbooks/passenger/templates/default/munin.erb +++ /dev/null @@ -1,5 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[passenger_*] -user root -env.PASSENGER_INSTANCE_REGISTRY_DIR <%= node[:passenger][:instance_registry_dir] %> diff --git a/cookbooks/planet/recipes/default.rb b/cookbooks/planet/recipes/default.rb index b83d3449b..519f58a52 100644 --- a/cookbooks/planet/recipes/default.rb +++ b/cookbooks/planet/recipes/default.rb @@ -138,8 +138,6 @@ template "/etc/logrotate.d/apache2" do mode "644" end -munin_plugin "planet_age" - template "/usr/local/bin/planet-file-cleanup" do source "planet-file-cleanup.erb" owner "root" diff --git a/cookbooks/postgresql/README.md b/cookbooks/postgresql/README.md index b23cd2bc6..4aea35d54 100644 --- a/cookbooks/postgresql/README.md +++ b/cookbooks/postgresql/README.md @@ -6,7 +6,6 @@ defines a number of providers that can be used in other cookbooks: * database: For managing databases. * execute: For running commands against the database. * extension: For installing extensions. -* munin: For configuring munin plugins for a given database name. * table: For managing database tables. * user: For managing database users. * tablespace: For managing tablespaces. diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index 086047258..c34b4b013 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -173,44 +173,4 @@ clusters.each do |name, details| action :delete end end - - munin_suffix = name.tr("/", ":") - - munin_plugin "postgres_bgwriter_#{munin_suffix}" do - target "postgres_bgwriter" - conf "munin.erb" - conf_variables :port => details[:port] - end - - munin_plugin "postgres_checkpoints_#{munin_suffix}" do - target "postgres_checkpoints" - conf "munin.erb" - conf_variables :port => details[:port] - end - - munin_plugin "postgres_connections_db_#{munin_suffix}" do - target "postgres_connections_db" - conf "munin.erb" - conf_variables :port => details[:port] - end - - munin_plugin "postgres_users_#{munin_suffix}" do - target "postgres_users" - conf "munin.erb" - conf_variables :port => details[:port] - end - - munin_plugin "postgres_xlog_#{munin_suffix}" do - target "postgres_xlog" - conf "munin.erb" - conf_variables :port => details[:port] - end - - next unless File.exist?("/var/lib/postgresql/#{details[:version]}/main/recovery.conf") - - munin_plugin "postgres_replication_#{munin_suffix}" do - target "postgres_replication" - conf "munin.erb" - conf_variables :port => details[:port] - end end diff --git a/cookbooks/postgresql/resources/munin.rb b/cookbooks/postgresql/resources/munin.rb deleted file mode 100644 index 4b69d4224..000000000 --- a/cookbooks/postgresql/resources/munin.rb +++ /dev/null @@ -1,66 +0,0 @@ -# -# Cookbook:: postgresql -# Resource:: postgresql_munin -# -# Copyright:: 2015, OpenStreetMap Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -unified_mode true - -default_action :create - -property :munin, :kind_of => String, :name_property => true -property :cluster, :kind_of => String, :required => true -property :database, :kind_of => String, :required => true - -action :create do - cluster = node[:postgresql][:clusters] && node[:postgresql][:clusters][new_resource.cluster] - database = new_resource.database - - if cluster - %w[cache connections locks querylength scans size transactions tuples].each do |plugin| - munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do - target "postgres_#{plugin}_" - conf "munin.erb" - conf_cookbook "postgresql" - conf_variables :port => cluster[:port] - restart_munin false - end - end - else - Chef::Log.info "Postgres cluster #{new_resource.cluster} not found" - end -end - -action :delete do - database = new_resource.database - - %w[cache connections locks querylength scans size transactions tuples].each do |plugin| - munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do - action :delete - restart_munin false - end - end -end - -action_class do - def suffix - new_resource.cluster.tr("/", ":") - end -end - -def after_created - notifies :restart, "service[munin-node]" -end diff --git a/cookbooks/postgresql/templates/default/munin.erb b/cookbooks/postgresql/templates/default/munin.erb deleted file mode 100644 index fd08870d4..000000000 --- a/cookbooks/postgresql/templates/default/munin.erb +++ /dev/null @@ -1,6 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - -[<%= @name %>] -user postgres -env.PGUSER postgres -env.PGPORT <%= @port %> diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index 6cfe88d45..bd660f342 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -490,11 +490,6 @@ if node[:tile][:database][:external_data_script] end end -postgresql_munin "gis" do - cluster node[:tile][:database][:cluster] - database "gis" -end - directory File.dirname(node[:tile][:database][:node_file]) do owner "root" group "root" @@ -669,19 +664,6 @@ tile_directories.each do |directory| end end -munin_plugin "mod_tile_fresh" -munin_plugin "mod_tile_latency" -munin_plugin "mod_tile_response" -munin_plugin "mod_tile_zoom" - -munin_plugin "renderd_processed" -munin_plugin "renderd_queue" -munin_plugin "renderd_queue_time" -munin_plugin "renderd_zoom" -munin_plugin "renderd_zoom_time" - -munin_plugin "replication_delay" - package "ruby-webrick" prometheus_exporter "modtile" do diff --git a/cookbooks/web/recipes/rails.rb b/cookbooks/web/recipes/rails.rb index 7d39696dc..ddaecdffb 100644 --- a/cookbooks/web/recipes/rails.rb +++ b/cookbooks/web/recipes/rails.rb @@ -231,14 +231,3 @@ end gem_package "hpricot" do gem_binary node[:ruby][:gem] end - -munin_plugin "api_calls_status" -munin_plugin "api_calls_num" - -munin_plugin "api_calls_#{node[:hostname]}" do - target "api_calls_" -end - -munin_plugin "api_waits_#{node[:hostname]}" do - target "api_waits_" -end diff --git a/roles/base.rb b/roles/base.rb index d37a4097d..faa580d9a 100644 --- a/roles/base.rb +++ b/roles/base.rb @@ -10,13 +10,6 @@ default_attributes( :jburgess => { :status => :administrator } } }, - :munin => { - :plugins => { - :chrony => { - :systime => { :warning => "100", :critical => "250" } - } - } - }, :networking => { :roles => { :internal => { :metric => 200 }, diff --git a/roles/chef-server.rb b/roles/chef-server.rb index a21cb286b..9ae1fbc00 100644 --- a/roles/chef-server.rb +++ b/roles/chef-server.rb @@ -1,20 +1,6 @@ name "chef-server" description "Role applied to all chef servers" -default_attributes( - :munin => { - :plugins => { - :chef_status => { - :ascalon => { :warning => ":", :critical => ":" }, - :idris => { :warning => ":", :critical => ":" }, - :norbert => { :warning => ":", :critical => ":" }, - :smaug => { :warning => ":", :critical => ":" }, - :zark => { :warning => ":", :critical => ":" } - } - } - } -) - run_list( "recipe[chef::server]" ) diff --git a/roles/db.rb b/roles/db.rb index 05cd66aa9..24ae10683 100644 --- a/roles/db.rb +++ b/roles/db.rb @@ -15,26 +15,6 @@ default_attributes( :enable => false } }, - :munin => { - :plugins => { - :postgres_connections_openstreetmap => { - :waiting => { - :warning => 10, - :critical => 20 - } - }, - :postgres_locks_openstreetmap => { - :accesssharelock => { - :warning => 900, - :critical => 1000 - }, - :rowexclusivelock => { - :warning => 250, - :critical => 300 - } - } - } - }, :postgresql => { :settings => { :defaults => { diff --git a/roles/gp-dl360e-g8.rb b/roles/gp-dl360e-g8.rb index 20c9c32c0..695bc958e 100644 --- a/roles/gp-dl360e-g8.rb +++ b/roles/gp-dl360e-g8.rb @@ -1,13 +1,2 @@ name "hp-dl360e-g8" description "Role applied to all HP DL360e G8 machines" - -default_attributes( - :munin => { - :plugins => { - :hpasmcli2_temp => { - :temp15 => { :warning => 68, :critical => 80 }, - :temp16 => { :warning => 68, :critical => 80 } - } - } - } -) diff --git a/roles/hp-dl180-g6.rb b/roles/hp-dl180-g6.rb index 20125bb34..f7aa64a3a 100644 --- a/roles/hp-dl180-g6.rb +++ b/roles/hp-dl180-g6.rb @@ -4,44 +4,5 @@ description "Role applied to all HP DL180 G6 machines" default_attributes( :hardware => { :blacklisted_modules => %w[acpi_power_meter] - }, - :munin => { - :plugins => { - :hpasmcli2_fans => { - :fan1 => { :warning => "98", :critical => "100" }, - :fan2 => { :warning => "98", :critical => "100" }, - :fan3 => { :warning => "98", :critical => "100" }, - :fan4 => { :warning => "98", :critical => "100" } - }, - :hpasmcli2_temp => { - :temp3 => { :warning => "80.0", :critical => "85" } - }, - :ipmi_temp => { - :Temp1 => { :label => "Air Inlet" }, - :Temp2CPU1 => { :warning => ":", :label => "CPU 1" }, - :Temp3CPU2 => { :warning => ":", :label => "CPU 2" }, - :Temp4 => { :warning => ":", :label => "Memory 1" }, - :Temp5 => { :warning => ":", :label => "Memory 2" }, - :Temp8MemB0 => { :warning => ":", :label => "Memory 3" }, - :Temp9MemB0 => { :warning => ":", :label => "Memory 4" }, - :Temp10MemB0 => { :warning => ":", :label => "Memory 5" }, - :Temp12MemB1 => { :warning => ":", :label => "Memory 6" }, - :Temp13MemB1 => { :warning => ":", :label => "Memory 7" }, - :Temp14MemB1 => { :warning => ":", :label => "Memory 8" }, - :Temp15 => { :warning => ":", :label => "Main System Board 3" }, - :Temp16 => { :warning => ":", :label => "Main System Board 4" }, - :Temp17 => { :warning => ":", :label => "Main System Board 5" }, - :Temp18 => { :warning => ":", :label => "Main System Board 6" }, - :Temp19 => { :warning => ":", :label => "Main System Board 7" }, - :Temp20 => { :warning => ":", :label => "Main System Board 8" }, - :Temp21 => { :warning => ":", :label => "Main System Board 9" }, - :Temp26 => { :warning => ":", :label => "Drive Backplane 1" }, - :Temp27 => { :warning => ":", :label => "Drive Backplane 2" }, - :Temp28 => { :warning => ":", :label => "Drive Backplane 3" }, - :Temp29 => { :warning => ":", :label => "Drive Backplane 4" }, - :Temp30 => { :warning => ":", :label => "Drive Backplane 5" }, - :Temp31 => { :warning => ":", :label => "Drive Backplane 6" } - } - } } ) diff --git a/roles/hp-dl360-g6.rb b/roles/hp-dl360-g6.rb index c7a14cda4..fe953d50a 100644 --- a/roles/hp-dl360-g6.rb +++ b/roles/hp-dl360-g6.rb @@ -4,45 +4,5 @@ description "Role applied to all HP DL360 G6 machines" default_attributes( :hardware => { :blacklisted_modules => %w[acpi_power_meter] - }, - :munin => { - :plugins => { - :hpasmcli2_fans => { - :fan1 => { :warning => "85", :critical => "90" }, - :fan2 => { :warning => "85", :critical => "90" }, - :fan3 => { :warning => "85", :critical => "90" }, - :fan4 => { :warning => "85", :critical => "90" } - }, - :ipmi_temp => { - :Temp1 => { :label => "External Environment" }, - :Temp2 => { :warning => ":", :label => "CPU 1" }, - :Temp3 => { :warning => ":", :label => "CPU 2" }, - :Temp4 => { :warning => ":", :label => "Memory 1" }, - :Temp5 => { :warning => ":", :label => "Memory 2" }, - :Temp6 => { :warning => ":", :label => "Memory 3" }, - :Temp7 => { :warning => ":", :label => "Memory 4" }, - :Temp8 => { :warning => ":", :label => "Memory 5" }, - :Temp9 => { :warning => ":", :label => "Memory 6" }, - :Temp10 => { :warning => ":", :label => "Memory 7" }, - :Temp11 => { :warning => ":", :label => "Memory 8" }, - :Temp12 => { :warning => ":", :label => "PSU 1" }, - :Temp13 => { :warning => ":", :label => "PSU 2" }, - :Temp14 => { :warning => ":", :label => "Memory 9" }, - :Temp15 => { :warning => ":", :label => "CPU Zone 1" }, - :Temp16 => { :warning => ":", :label => "CPU Zone 2" }, - :Temp17 => { :warning => ":", :label => "Memory 10" }, - :Temp18 => { :warning => ":", :label => "CPU Zone 3" }, - :Temp19 => { :warning => ":", :label => "Peripheral Bay 1" }, - :Temp20 => { :warning => ":", :label => "Peripheral Bay 2" }, - :Temp21 => { :warning => ":", :label => "Peripheral Bay 3" }, - :Temp22 => { :warning => ":", :label => "Peripheral Bay 4" }, - :Temp23 => { :warning => ":", :label => "Peripheral Bay 5" }, - :Temp24 => { :warning => ":", :label => "Peripheral Bay 6" }, - :Temp25 => { :warning => ":", :label => "Peripheral Bay 7" }, - :Temp26 => { :warning => ":", :label => "Peripheral Bay 8" }, - :Temp27 => { :warning => ":", :label => "Drive Backplane" }, - :Temp28 => { :warning => ":", :label => "System Board" } - } - } } ) diff --git a/roles/hp-g9.rb b/roles/hp-g9.rb index 01f2afc00..4d086da76 100644 --- a/roles/hp-g9.rb +++ b/roles/hp-g9.rb @@ -1,15 +1,2 @@ name "hp-g9" description "Role applied to all HP G9 machines" - -default_attributes( - :munin => { - :plugins => { - :hpasmcli2_temp => { - :temp11 => { :warning => 85, :critical => 100 }, - :temp12 => { :warning => 85, :critical => 100 }, - :temp19 => { :warning => 85, :critical => 100 }, - :temp20 => { :warning => 85, :critical => 100 } - } - } - } -) diff --git a/roles/kessie.rb b/roles/kessie.rb index 3af961307..3505bc18a 100644 --- a/roles/kessie.rb +++ b/roles/kessie.rb @@ -10,16 +10,6 @@ default_attributes( } } }, - :munin => { - :plugins => { - :sensors_temp => { - :temp6 => { :warning => "71.0", :critical => "76.0" }, - :temp7 => { :warning => "71.0", :critical => "76.0" }, - :temp8 => { :warning => "71.0", :critical => "76.0" }, - :temp9 => { :warning => "71.0", :critical => "76.0" } - } - } - }, :networking => { :interfaces => { :external => { diff --git a/roles/mail.rb b/roles/mail.rb index 6cf895493..6648ce7d8 100644 --- a/roles/mail.rb +++ b/roles/mail.rb @@ -98,16 +98,6 @@ default_attributes( }, :private_aliases => "mail" }, - :munin => { - :plugins => { - :exim_mailqueue => { - :mails => { - :warning => 500, - :critical => 1000 - } - } - } - }, :prometheus => { :metrics => { :exim_queue_limit => { :metric => 2500 } diff --git a/roles/paulla.rb b/roles/paulla.rb index 516546968..1fad914b4 100644 --- a/roles/paulla.rb +++ b/roles/paulla.rb @@ -9,10 +9,7 @@ default_attributes( } }, :hosted_by => "Université de Pau et des Pays de l'Adour", - :location => "Pau, France", - :munin => { - :allow => ["10.64.1.11"] - } + :location => "Pau, France" ) override_attributes( diff --git a/roles/rhaegal.rb b/roles/rhaegal.rb index a16c9e721..61352aaa7 100644 --- a/roles/rhaegal.rb +++ b/roles/rhaegal.rb @@ -8,24 +8,6 @@ default_attributes( } }, :location => "Zagreb, Croatia", - :munin => { - :plugins => { - :sensors_temp => { - :temp1 => { :warning => "85.0" }, - :temp2 => { :warning => "85.0" }, - :temp3 => { :warning => "85.0" }, - :temp4 => { :warning => "85.0" }, - :temp5 => { :warning => "85.0" }, - :temp6 => { :warning => "85.0" }, - :temp8 => { :warning => "85.0" }, - :temp9 => { :warning => "85.0" }, - :temp10 => { :warning => "85.0" }, - :temp11 => { :warning => "85.0" }, - :temp12 => { :warning => "85.0" }, - :temp13 => { :warning => "85.0" } - } - } - }, :networking => { :interfaces => { :external => { diff --git a/roles/stormfly-03.rb b/roles/stormfly-03.rb index 5b60d18b0..d81b06c9f 100644 --- a/roles/stormfly-03.rb +++ b/roles/stormfly-03.rb @@ -2,44 +2,6 @@ name "stormfly-03" description "Master role applied to stormfly-03" default_attributes( - :munin => { - :plugins => { - :hpasmcli2_temp => { - :temp2 => { :warning => "68" }, - :temp3 => { :warning => "68" } - }, - :sensors_temp => { - :temp4 => { :warning => "98" }, - :temp5 => { :warning => "98" }, - :temp6 => { :warning => "98" }, - :temp7 => { :warning => "98" }, - :temp8 => { :warning => "98" }, - :temp9 => { :warning => "98" }, - :temp10 => { :warning => "98" }, - :temp11 => { :warning => "98" }, - :temp12 => { :warning => "98" }, - :temp13 => { :warning => "98" }, - :temp14 => { :warning => "98" }, - :temp15 => { :warning => "98" }, - :temp16 => { :warning => "98" }, - :temp17 => { :warning => "98" }, - :temp21 => { :warning => "98" }, - :temp22 => { :warning => "98" }, - :temp23 => { :warning => "98" }, - :temp24 => { :warning => "98" }, - :temp25 => { :warning => "98" }, - :temp26 => { :warning => "98" }, - :temp27 => { :warning => "98" }, - :temp28 => { :warning => "98" }, - :temp29 => { :warning => "98" }, - :temp30 => { :warning => "98" }, - :temp31 => { :warning => "98" }, - :temp32 => { :warning => "98" }, - :temp33 => { :warning => "98" }, - :temp34 => { :warning => "98" } - } - } - }, :networking => { :interfaces => { :external => { diff --git a/roles/tile.rb b/roles/tile.rb index b5ab16932..97bd895f8 100644 --- a/roles/tile.rb +++ b/roles/tile.rb @@ -24,15 +24,6 @@ default_attributes( :listen_cores_buckets_ratio => 8 } }, - :munin => { - :plugins => { - :renderd_processed => { - :graph_order => "reqPrio req reqLow dirty reqBulk dropped", - :reqPrio => { :draw => "AREA" }, - :req => { :draw => "STACK" } - } - } - }, :postgresql => { :settings => { :defaults => { diff --git a/test/integration/munin-server/inspec/apache_spec.rb b/test/integration/munin-server/inspec/apache_spec.rb deleted file mode 100644 index 8006330b4..000000000 --- a/test/integration/munin-server/inspec/apache_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -describe package("apache2") do - it { should be_installed } -end - -describe service("apache2") do - it { should be_enabled } - it { should be_running } -end - -describe port(80) do - it { should be_listening } - its("protocols") { should cmp "tcp" } -end - -describe port(443) do - it { should be_listening } - its("protocols") { should cmp "tcp" } -end diff --git a/test/integration/munin-server/inspec/munin_spec.rb b/test/integration/munin-server/inspec/munin_spec.rb index a27a00ce9..766d65c03 100644 --- a/test/integration/munin-server/inspec/munin_spec.rb +++ b/test/integration/munin-server/inspec/munin_spec.rb @@ -1,3 +1,3 @@ describe package("munin") do - it { should be_installed } + it { should_not be_installed } end diff --git a/test/integration/munin-server/inspec/rrdcached_spec.rb b/test/integration/munin-server/inspec/rrdcached_spec.rb index 570258970..e097789de 100644 --- a/test/integration/munin-server/inspec/rrdcached_spec.rb +++ b/test/integration/munin-server/inspec/rrdcached_spec.rb @@ -1,8 +1,8 @@ describe package("rrdcached") do - it { should be_installed } + it { should_not be_installed } end describe service("rrdcached") do - it { should be_enabled } - it { should be_running } + it { should_not be_enabled } + it { should_not be_running } end diff --git a/test/integration/munin/inspec/munin_node_spec.rb b/test/integration/munin/inspec/munin_node_spec.rb index e07e3b279..023bd9612 100644 --- a/test/integration/munin/inspec/munin_node_spec.rb +++ b/test/integration/munin/inspec/munin_node_spec.rb @@ -1,13 +1,12 @@ describe package("munin-node") do - it { should be_installed } + it { should_not be_installed } end describe service("munin-node") do - it { should be_enabled } - it { should be_running } + it { should_not be_enabled } + it { should_not be_running } end describe port(4949) do - it { should be_listening } - its("protocols") { should cmp "tcp" } + it { should_not be_listening } end -- 2.39.5