X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/b20599b6503be65674c3e420be6cca91b507ac0a..ff044920428608b2c04507ad52d6ab52c9d6555f:/cookbooks/munin/files/default/plugins/api_waits_ diff --git a/cookbooks/munin/files/default/plugins/api_waits_ b/cookbooks/munin/files/default/plugins/api_waits_ index 029c9f4a6..741f190f0 100755 --- a/cookbooks/munin/files/default/plugins/api_waits_ +++ b/cookbooks/munin/files/default/plugins/api_waits_ @@ -5,7 +5,7 @@ require 'date' require 'hpricot' require 'open-uri' -def uri_and_times_from_status(server) +def uri_and_times_from_status(server) file = open("http://#{server}/server-status").read doc = Hpricot.parse(file) tables = doc / 'table' @@ -18,19 +18,19 @@ def uri_and_times_from_status(server) end CALL_TYPES = { - :map => "Map API calls", - :upload => "Changeset diff uploads", - :amf => "AMF API calls", - :history => "Element history fetches", + :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", + :web => "Web site traffic", :other => "Other API calls" } def categorise_uri(line) uri = line.split(" ")[1] - + case uri when /api\/0\.6\/map/ then :map when /api\/0\.6\/changeset\/[0-9]*\/upload/ then :upload @@ -63,7 +63,7 @@ else end h end - + CALL_TYPES.keys.each do |type| count = counts[type] || [0] avg = count.inject(0){|x,y|x+y} / (1.0 * count.length)