]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/planet_age
Install registration-honeypot plugin on the CRM site
[chef.git] / cookbooks / munin / files / default / plugins / planet_age
1 #!/usr/bin/ruby
2
3 files = [
4   {
5     :label => "planet",
6     :name => "/store/planet/planet/planet-latest.osm.bz2",
7     :title => "Planet Dump",
8     :frequency => 7 * 24 * 60 * 60
9   },
10   {
11     :label => "day",
12     :name => "/store/planet/replication/day/state.txt",
13     :title => "Daily Replication",
14     :frequency => 24 * 60 * 60
15   },
16   {
17     :label => "hour",
18     :name => "/store/planet/replication/hour/state.txt",
19     :title => "Hourly Replication",
20     :frequency => 60 * 60
21   },
22   {
23     :label => "minute",
24     :name => "/store/planet/replication/minute/state.txt",
25     :title => "Minutely Replication",
26     :frequency => 60
27   }
28 ]
29
30 if ARGV[0] == "config"
31   puts "graph_title Planet Age"
32   puts "graph_args --base 1000 --lower-limit 0"
33   puts "graph_scale no"
34   puts "graph_vlabel fraction of expected max age"
35   puts "graph_category planet"
36
37   files.each do |file|
38     puts "#{file[:label]}.label #{file[:title]}"
39     puts "#{file[:label]}.type GAUGE"
40     puts "#{file[:label]}.warning 0:1.05"
41     puts "#{file[:label]}.critical 0:1.1"
42   end
43 else
44
45   files.each do |file|
46     value = (Time.now - File.mtime(file[:name])) / file[:frequency]
47
48     puts "#{file[:label]}.value #{value}"
49   end
50 end