]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/api_calls_status
Add alert for failing discourse jobs
[chef.git] / cookbooks / munin / files / default / plugins / api_calls_status
index 8167f21d6ff05e0a1a783b605c47bfb79a5955dd..4a9623f9b877d33d9606f355e3afeb7bb541b512 100755 (executable)
@@ -19,11 +19,12 @@ HTTP_STATUSES = {
   "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"
@@ -34,11 +35,12 @@ if ARGV[0] == "config"
   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.keys.each do |code|
+  HTTP_STATUSES.each_key do |code|
     count = statistics["status"][code] || 0
     puts "http#{code}.value #{count}"
   end