mmonit 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mmonit/connection.rb +20 -14
- data/lib/mmonit/version.rb +1 -1
- metadata +2 -2
data/lib/mmonit/connection.rb
CHANGED
@@ -50,36 +50,42 @@ module MMonit
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def users
|
53
|
-
JSON.parse(self.request('/json/admin/users/list').body)
|
53
|
+
JSON.parse(self.request('/json/admin/users/list').body)
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
57
|
-
JSON.parse(self.request('/json/admin/
|
56
|
+
def alerts
|
57
|
+
JSON.parse(self.request('/json/admin/alerts/list').body)
|
58
58
|
end
|
59
59
|
|
60
60
|
def events
|
61
61
|
JSON.parse(self.request('/json/events/list').body)['records']
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
#### topography and reports are disabled until I figure out their new equivalent in M/Monit
|
65
|
+
# def topography
|
66
|
+
# JSON.parse(self.request('/json/status/topography').body)
|
67
|
+
# end
|
67
68
|
|
68
|
-
def reports(hostid=nil)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
69
|
+
# def reports(hostid=nil)
|
70
|
+
# body = String.new
|
71
|
+
# body = "hostid=#{hostid.to_s}" if hostid
|
72
|
+
# JSON.parse(self.request('/json/reports/overview', body).body)
|
73
|
+
# end
|
73
74
|
|
74
|
-
def
|
75
|
+
def find_host(fqdn)
|
75
76
|
host = self.hosts.select{ |h| h['host'] == fqdn }
|
76
77
|
host.empty? ? nil : host.first
|
77
78
|
end
|
78
79
|
|
80
|
+
# another option: /admin/hosts/json/get?id=####
|
81
|
+
def get_host_details(id)
|
82
|
+
JSON.parse(self.request("/json/status/detail?hostid=#{id}").body)['records']['host'] rescue nil
|
83
|
+
end
|
84
|
+
|
79
85
|
def delete_host(host)
|
80
|
-
host = self.
|
86
|
+
host = self.find_host(host['host']) if host.key?('host') && ! host.key?('id')
|
81
87
|
return false unless host['id']
|
82
|
-
self.request(
|
88
|
+
self.request("/admin/hosts/delete?id=#{host['id']}")
|
83
89
|
end
|
84
90
|
|
85
91
|
def request(path, body="", headers = {})
|
data/lib/mmonit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmonit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Ruby interface to M/Monit
|
15
15
|
email:
|