hostmon 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/hostmon +4 -0
- data/examples/config.yml +14 -0
- data/examples/reports/bad_exit_status/cluster1/mach1/report_2012-06-28-16:49:32.yaml +11 -0
- data/examples/reports/bad_exit_status/cluster2/mach1/report_2012-06-14-15:06:12.yaml +11 -0
- data/examples/reports/bad_exit_status/cluster2/mach2/report_2012-06-14-15:06:12.yaml +11 -0
- data/examples/reports/foo/cluster1/mach1/report_2012-06-28-16:49:32.yaml +10 -0
- data/examples/reports/foo/cluster2/mach1/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/foo/cluster2/mach2/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/missing_prelude/cluster1/mach1/report_2012-06-28-16:49:32.yaml +12 -0
- data/examples/reports/missing_prelude/cluster2/mach1/report_2012-06-14-15:06:12.yaml +12 -0
- data/examples/reports/missing_prelude/cluster2/mach2/report_2012-06-14-15:06:12.yaml +12 -0
- data/examples/reports/network/config/bootproto_dhcp/cluster1/mach1/report_2012-06-28-16:49:32.yaml +10 -0
- data/examples/reports/network/config/bootproto_dhcp/cluster2/mach1/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/network/config/bootproto_dhcp/cluster2/mach2/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/network/ethernet_bonded/cluster1/mach1/report_2012-06-28-16:49:32.yaml +31 -0
- data/examples/reports/network/ethernet_bonded/cluster2/mach1/report_2012-06-14-15:06:12.yaml +22 -0
- data/examples/reports/network/ethernet_bonded/cluster2/mach2/report_2012-06-14-15:06:12.yaml +22 -0
- data/examples/reports/nonexec/cluster1/mach1/report_2012-06-28-16:49:32.yaml +10 -0
- data/examples/reports/nonexec/cluster2/mach1/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/nonexec/cluster2/mach2/report_2012-06-14-15:06:12.yaml +10 -0
- data/examples/reports/yum/badcheck/cluster1/mach1/report_2012-06-28-16:49:32.yaml +13 -0
- data/examples/reports/yum/badcheck/cluster2/mach1/report_2012-06-14-15:06:12.yaml +13 -0
- data/examples/reports/yum/badcheck/cluster2/mach2/report_2012-06-14-15:06:12.yaml +13 -0
- data/lib/hostmon.rb +208 -0
- data/lib/hostmon/config.rb +47 -0
- data/lib/hostmon/helpers.rb +174 -0
- data/lib/hostmon/models.rb +4 -0
- data/lib/hostmon/models/base.rb +39 -0
- data/lib/hostmon/models/check.rb +45 -0
- data/lib/hostmon/models/host.rb +211 -0
- data/lib/hostmon/models/report.rb +108 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_flat_30_cccccc_40x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_glass_20_333333_1x400.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_glass_40_000000_1x400.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_glass_40_ffc73d_1x400.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_highlight-soft_15_000000_1x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-bg_inset-soft_30_ff4e0a_1x100.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-icons_222222_256x240.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-icons_4b8e0b_256x240.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-icons_a83300_256x240.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-icons_cccccc_256x240.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/hostmon/public/css/jquery_themes/hostmon/jquery-ui-1.8.16.custom.css +568 -0
- data/lib/hostmon/public/favicon.ico +0 -0
- data/lib/hostmon/public/js/cufon.js +7 -0
- data/lib/hostmon/public/js/gotham.font.js +40 -0
- data/lib/hostmon/public/js/hostmon.js +89 -0
- data/lib/hostmon/public/js/jquery-1.6.2.min.js +18 -0
- data/lib/hostmon/public/js/jquery-ui-1.8.16.custom.min.js +791 -0
- data/lib/hostmon/public/js/product-design.font.js +8 -0
- data/lib/hostmon/public/style.css +311 -0
- data/lib/hostmon/rubyfixes.rb +12 -0
- data/lib/hostmon/version.rb +3 -0
- data/lib/hostmon/views/check.erb +23 -0
- data/lib/hostmon/views/check_status.erb +16 -0
- data/lib/hostmon/views/cluster.erb +19 -0
- data/lib/hostmon/views/host.erb +15 -0
- data/lib/hostmon/views/host_status.erb +16 -0
- data/lib/hostmon/views/layout.erb +61 -0
- data/lib/hostmon/views/partials/check_status_selector.erb +6 -0
- data/lib/hostmon/views/partials/host_status_selector.erb +6 -0
- data/lib/hostmon/views/partials/hosts_selector.erb +9 -0
- data/lib/hostmon/views/partials/report.erb +7 -0
- data/lib/hostmon/views/partials/search.erb +18 -0
- data/lib/hostmon/views/partials/status_selector.erb +7 -0
- data/lib/hostmon/views/search_all.erb +25 -0
- data/lib/hostmon/views/search_checks.erb +12 -0
- data/lib/hostmon/views/search_host.erb +7 -0
- data/lib/hostmon/views/status.erb +15 -0
- data/lib/hostmon/views/view.erb +49 -0
- metadata +152 -0
data/bin/hostmon
ADDED
data/examples/config.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
:main:
|
|
3
|
+
:report_dir: "./reports" # where read from and store reports, relative to # this file
|
|
4
|
+
# :saved_reports: 1
|
|
5
|
+
|
|
6
|
+
:bugzilla:
|
|
7
|
+
:bugzilla_url: "https://bugzilla.mozilla.org/enter_bug.cgi?alias=&assigned_to=nobody%40mozilla.org&blocked=&bug_file_loc=http%3A%2F%2F&bug_severity=normal&bug_status=NEW&cf_blocking_191=---&cf_blocking_192=---&cf_blocking_20=---&cf_blocking_fennec=---&cf_crash_signature=&cf_status_191=---&cf_status_192=---&cf_status_20=---&cf_status_firefox5=---&cf_status_firefox6=---&cf_status_firefox7=---&cf_status_firefox8=---&cf_tracking_firefox5=---&cf_tracking_firefox6=---&cf_tracking_firefox7=---&cf_tracking_firefox8=---&component=Operations%3A%20Metrics%2FMonitoring&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&dependson=&description=&flag_type-325=X&flag_type-37=X&flag_type-4=X&flag_type-607=X&flag_type-708=X&flag_type-720=X&flag_type-721=X&flag_type-737=X&form_name=enter_bug&groups=services-infra&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Linux&priority=--&product=Mozilla%20Services&qa_contact=operations%40services.bugs&rep_platform=x86_64&requestee_type-325=&requestee_type-4=&requestee_type-607=&status_whiteboard=&target_milestone=---&version=unspecified"
|
|
8
|
+
:bugzilla_search_url: "https://bugzilla.mozilla.org/buglist.cgi?list_id=1127320&resolution=---&resolution=DUPLICATE&query_format=advanced&short_desc_type=allwords&component=Operations%3A%20Metrics%2FMonitoring&product=Mozilla%20Services"
|
|
9
|
+
:hostlint_url: "localhost:9998"
|
|
10
|
+
|
|
11
|
+
# :amqp:
|
|
12
|
+
# :host: localhost
|
|
13
|
+
# :vhost: /
|
|
14
|
+
# :exchange: hostlint
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
:status:
|
|
3
|
+
- :CHECK_FAILED
|
|
4
|
+
:stdout: |
|
|
5
|
+
output of ifconfig:
|
|
6
|
+
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436
|
|
7
|
+
inet 127.0.0.1 netmask 255.0.0.0
|
|
8
|
+
inet6 ::1 prefixlen 128 scopeid 0x10<host>
|
|
9
|
+
\ loop txqueuelen 0 (Local Loopback)
|
|
10
|
+
RX packets 2592342 bytes 411323230 (392.2 MiB)
|
|
11
|
+
RX errors 0 dropped 0 overruns 0 frame 0
|
|
12
|
+
TX packets 2592342 bytes 411323230 (392.2 MiB)
|
|
13
|
+
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
|
14
|
+
|
|
15
|
+
p128p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> \ mtu 1500
|
|
16
|
+
inet 10.250.3.163 netmask 255.255.248.0 broadcast 10.250.7.255
|
|
17
|
+
\ inet6 2620:101:8003:200:a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x0<global>
|
|
18
|
+
\ inet6 fe80::a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x20<link>
|
|
19
|
+
ether a4:ba:db:fd:fe:71 txqueuelen 1000 (Ethernet)
|
|
20
|
+
RX packets 15272170 bytes 2840450940 (2.6 GiB)
|
|
21
|
+
RX errors 0 dropped 7 overruns 0 frame 0
|
|
22
|
+
TX packets 312785 bytes 39125389 (37.3 MiB)
|
|
23
|
+
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
|
24
|
+
device interrupt 16
|
|
25
|
+
|
|
26
|
+
:stderr: ""
|
|
27
|
+
:exit_status: 0
|
|
28
|
+
:timestamp: Thu Jun 28 16:49:32 -0700 2012
|
|
29
|
+
:cluster: cluster1
|
|
30
|
+
:host: mach1
|
|
31
|
+
:name: network.ethernet_bonded
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
:status:
|
|
3
|
+
- :CHECK_FAILED
|
|
4
|
+
:stdout: ! "output of ifconfig:\nlo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436\n inet
|
|
5
|
+
127.0.0.1 netmask 255.0.0.0\n inet6 ::1 prefixlen 128 scopeid 0x10<host>\n
|
|
6
|
+
\ loop txqueuelen 0 (Local Loopback)\n RX packets 2651014 bytes
|
|
7
|
+
410810736 (391.7 MiB)\n RX errors 0 dropped 0 overruns 0 frame 0\n TX
|
|
8
|
+
packets 2651014 bytes 410810736 (391.7 MiB)\n TX errors 0 dropped 0 overruns
|
|
9
|
+
0 carrier 0 collisions 0\n\np128p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
|
|
10
|
+
\ mtu 1500\n inet 10.250.3.163 netmask 255.255.248.0 broadcast 10.250.7.255\n
|
|
11
|
+
\ inet6 2620:101:8003:200:a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x0<global>\n
|
|
12
|
+
\ inet6 fe80::a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x20<link>\n ether
|
|
13
|
+
a4:ba:db:fd:fe:71 txqueuelen 1000 (Ethernet)\n RX packets 16682970 bytes
|
|
14
|
+
3053667650 (2.8 GiB)\n RX errors 0 dropped 1 overruns 0 frame 0\n TX
|
|
15
|
+
packets 306643 bytes 40247466 (38.3 MiB)\n TX errors 0 dropped 0 overruns
|
|
16
|
+
0 carrier 0 collisions 0\n device interrupt 16 \n"
|
|
17
|
+
:stderr: ''
|
|
18
|
+
:cluster: cluster2
|
|
19
|
+
:exit_status: 0
|
|
20
|
+
:name: network.ethernet_bonded
|
|
21
|
+
:timestamp: Thu Jun 14 15:06:12 -0700 2012
|
|
22
|
+
:host: mach1
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
:status:
|
|
3
|
+
- :CHECK_OK
|
|
4
|
+
:stdout: ! "output of ifconfig:\nlo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436\n inet
|
|
5
|
+
127.0.0.1 netmask 255.0.0.0\n inet6 ::1 prefixlen 128 scopeid 0x10<host>\n
|
|
6
|
+
\ loop txqueuelen 0 (Local Loopback)\n RX packets 2651014 bytes
|
|
7
|
+
410810736 (391.7 MiB)\n RX errors 0 dropped 0 overruns 0 frame 0\n TX
|
|
8
|
+
packets 2651014 bytes 410810736 (391.7 MiB)\n TX errors 0 dropped 0 overruns
|
|
9
|
+
0 carrier 0 collisions 0\n\np128p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
|
|
10
|
+
\ mtu 1500\n inet 10.250.3.163 netmask 255.255.248.0 broadcast 10.250.7.255\n
|
|
11
|
+
\ inet6 2620:101:8003:200:a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x0<global>\n
|
|
12
|
+
\ inet6 fe80::a6ba:dbff:fefd:fe71 prefixlen 64 scopeid 0x20<link>\n ether
|
|
13
|
+
a4:ba:db:fd:fe:71 txqueuelen 1000 (Ethernet)\n RX packets 16682970 bytes
|
|
14
|
+
3053667650 (2.8 GiB)\n RX errors 0 dropped 1 overruns 0 frame 0\n TX
|
|
15
|
+
packets 306643 bytes 40247466 (38.3 MiB)\n TX errors 0 dropped 0 overruns
|
|
16
|
+
0 carrier 0 collisions 0\n device interrupt 16 \n"
|
|
17
|
+
:stderr: ''
|
|
18
|
+
:cluster: cluster2
|
|
19
|
+
:exit_status: 0
|
|
20
|
+
:name: network.ethernet_bonded
|
|
21
|
+
:timestamp: Thu Jun 14 15:06:12 -0700 2012
|
|
22
|
+
:host: mach2
|
data/lib/hostmon.rb
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
require "erb"
|
|
2
|
+
require "rack"
|
|
3
|
+
require "sinatra/base"
|
|
4
|
+
require "open-uri"
|
|
5
|
+
require "yaml"
|
|
6
|
+
require "thread"
|
|
7
|
+
require "set"
|
|
8
|
+
require "fileutils"
|
|
9
|
+
require "digest/sha1"
|
|
10
|
+
require "bunny"
|
|
11
|
+
require "pathname"
|
|
12
|
+
require "pp"
|
|
13
|
+
|
|
14
|
+
require "hostmon/version"
|
|
15
|
+
require "hostmon/models"
|
|
16
|
+
require "hostmon/config"
|
|
17
|
+
require "hostmon/helpers"
|
|
18
|
+
require "hostmon/models"
|
|
19
|
+
require "hostmon/rubyfixes"
|
|
20
|
+
require "bunny"
|
|
21
|
+
|
|
22
|
+
# should really be using queues (thread-safe according to pickaxe)
|
|
23
|
+
|
|
24
|
+
module Hostmon
|
|
25
|
+
class App < Sinatra::Base
|
|
26
|
+
include Hostmon::Models
|
|
27
|
+
helpers Hostmon::Helpers
|
|
28
|
+
set :config, Hostmon::Config.new
|
|
29
|
+
set :port, config.global_config[:port]
|
|
30
|
+
set :run, true
|
|
31
|
+
set :root, File.expand_path('../hostmon', __FILE__)
|
|
32
|
+
set :static, true
|
|
33
|
+
set :logging, true
|
|
34
|
+
|
|
35
|
+
confd = Pathname.new(config.conf_file).dirname.realpath
|
|
36
|
+
reportd = Pathname.new(config.report_dir)
|
|
37
|
+
if reportd.relative?
|
|
38
|
+
reportd = File.join(confd, reportd)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Host.saved_reports = config.global_config[:saved_reports]
|
|
42
|
+
Report.report_base = reportd
|
|
43
|
+
|
|
44
|
+
# timestamp order is relevant when loading reports from disk (but not amqp)
|
|
45
|
+
Dir.glob(File.join(reportd, "/**/*.yaml")).sort do |a, b|
|
|
46
|
+
Time.parse(a) <=> Time.parse(b)
|
|
47
|
+
end.each do |f|
|
|
48
|
+
puts "load #{f}"
|
|
49
|
+
# YAML::load_documents doesn't work in 1.8.7
|
|
50
|
+
stream = YAML::load_stream(File.read(f))
|
|
51
|
+
stream.documents.each do |check|
|
|
52
|
+
Report.new(check)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# spin off the amqp thread
|
|
57
|
+
# rescue errors and bail "correctly"
|
|
58
|
+
amqp = Bunny.new(config.amqp_config)
|
|
59
|
+
amqp.start
|
|
60
|
+
queue = amqp.queue("hostlint-#{Process.pid}", :auto_delete => true)
|
|
61
|
+
exchange = amqp.exchange(config.amqp_config[:exchange]||"hostlint",
|
|
62
|
+
:type => :topic,
|
|
63
|
+
:durable => true)
|
|
64
|
+
queue.bind(exchange)
|
|
65
|
+
Thread.new do
|
|
66
|
+
begin
|
|
67
|
+
queue.subscribe do |msg|
|
|
68
|
+
puts "processing amqp report"
|
|
69
|
+
Report.new(YAML.load(msg[:payload]))
|
|
70
|
+
end
|
|
71
|
+
rescue Bunny::ServerDownError, Bunny::ConnectionError
|
|
72
|
+
# TODO: implement reconnect
|
|
73
|
+
throw
|
|
74
|
+
end # begin
|
|
75
|
+
end # Thread.new
|
|
76
|
+
|
|
77
|
+
before do
|
|
78
|
+
@request_time = Time.now
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
get '/' do
|
|
82
|
+
@title = "Overview"
|
|
83
|
+
erb :view
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
get '/check/:check/?' do
|
|
87
|
+
unless check = Check.find(params[:check])
|
|
88
|
+
# could probably do better than raise an exception
|
|
89
|
+
raise "check not found #{params[:check]}"
|
|
90
|
+
end
|
|
91
|
+
@title = "check :: #{params[:check]}"
|
|
92
|
+
@check = check
|
|
93
|
+
|
|
94
|
+
@statuses = [[Host::OK, "passing"],
|
|
95
|
+
[Host::FAIL, "failing"],
|
|
96
|
+
[Host::EXEC_FAIL, "failing to run"],
|
|
97
|
+
[nil, "all"]]
|
|
98
|
+
|
|
99
|
+
erb :check
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
get '/check/:check/:status/?' do
|
|
103
|
+
unless check = Check.find(params[:check])
|
|
104
|
+
# could probably do better than raise an exception
|
|
105
|
+
raise "check not found #{params[:check]}"
|
|
106
|
+
end
|
|
107
|
+
@title1 = "check :: #{params[:check]} :: "
|
|
108
|
+
@check = check
|
|
109
|
+
|
|
110
|
+
@status = params[:status]
|
|
111
|
+
unless Host.statuses.member?(@status)
|
|
112
|
+
raise "unknown status #{@status}"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
@statuses = [[Host::OK, "passing"],
|
|
116
|
+
[Host::FAIL, "failing"],
|
|
117
|
+
[Host::EXEC_FAIL, "failing to run"],
|
|
118
|
+
["", "all"]]
|
|
119
|
+
case @status
|
|
120
|
+
when Host::OK
|
|
121
|
+
@subtitle = "passing"
|
|
122
|
+
@method = :hosts_ok
|
|
123
|
+
when Host::FAIL
|
|
124
|
+
@subtitle = "failing"
|
|
125
|
+
@method = :hosts_failing
|
|
126
|
+
when Host::EXEC_FAIL
|
|
127
|
+
@subtitle = "failing to run"
|
|
128
|
+
@method = :hosts_check_failing
|
|
129
|
+
end
|
|
130
|
+
@title = @title1 + @subtitle
|
|
131
|
+
erb :check_status
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# fixme dup
|
|
135
|
+
get '/host/:cluster/:host/?' do
|
|
136
|
+
@title = "#{params[:cluster]} :: host :: #{params[:host]}"
|
|
137
|
+
@host = Host.find_by_name_and_cluster(params[:host], params[:cluster])
|
|
138
|
+
|
|
139
|
+
@statuses = [[Host::FAIL, @host.failing, "failing", "checks failing"],
|
|
140
|
+
[Host::OK, @host.succeeding, "succeeding", "checks passing"],
|
|
141
|
+
[Host::EXEC_FAIL, @host.checks_failing, "failing to run", "checks failing to run"],
|
|
142
|
+
[nil, [], "all", "all"]]
|
|
143
|
+
erb :host
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
get '/host/:cluster/:host/:status?/?' do
|
|
147
|
+
@title = "#{params[:cluster]} :: host :: #{params[:host]} :: FIXME"
|
|
148
|
+
@host = Host.find_by_name_and_cluster(params[:host], params[:cluster])
|
|
149
|
+
raise "unknown host #{params[:host]}" unless @host
|
|
150
|
+
@status = params[:status]
|
|
151
|
+
raise "unknown status #{@status}" unless Host.statuses.member?(@status)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@statuses = [[Host::FAIL, @host.failing, "failing", "checks failing"],
|
|
155
|
+
[Host::OK, @host.succeeding, "succeeding", "checks passing"],
|
|
156
|
+
[Host::EXEC_FAIL, @host.checks_failing, "failing to run", "checks failing to run"],
|
|
157
|
+
[nil, [], "all", "all"]]
|
|
158
|
+
|
|
159
|
+
if @status
|
|
160
|
+
@statuses2 = @statuses.select {|s| s.first == @status}
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
erb :host_status
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# get '/host/:cluster/:host/:check/?' do
|
|
167
|
+
# "fixme"
|
|
168
|
+
# end
|
|
169
|
+
|
|
170
|
+
get '/cluster/:cluster/?' do
|
|
171
|
+
@title = "cluster :: #{params[:cluster]}"
|
|
172
|
+
erb :cluster
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
get '/status/:status/?' do
|
|
176
|
+
@status = params[:status]
|
|
177
|
+
unless Host.statuses.member?(@status)
|
|
178
|
+
raise "unknown status #{@status}"
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
case @status
|
|
182
|
+
when Host::OK
|
|
183
|
+
@title = "checks passing"
|
|
184
|
+
@method = :hosts_ok
|
|
185
|
+
when Host::FAIL
|
|
186
|
+
@title = "checks failing"
|
|
187
|
+
@method = :hosts_failing
|
|
188
|
+
when Host::EXEC_FAIL
|
|
189
|
+
@title = "checks failing to run"
|
|
190
|
+
@method = :hosts_check_failing
|
|
191
|
+
end
|
|
192
|
+
erb :status
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
get '/search' do
|
|
196
|
+
regexp = Regexp.new(params["keyword"], Regexp::IGNORECASE)
|
|
197
|
+
case params["cat"]
|
|
198
|
+
when "0" # all
|
|
199
|
+
when "1" # hosts
|
|
200
|
+
when "2" # checks
|
|
201
|
+
when "3" # failing
|
|
202
|
+
when "4" # succeeding
|
|
203
|
+
end
|
|
204
|
+
regexp.to_s
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
end
|
|
208
|
+
end
|