rubix 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rubix/monitors/zabbix_monitor.rb +8 -11
- data/spec/rubix/monitors/zabbix_monitor_spec.rb +1 -1
- metadata +11 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
@@ -33,8 +33,6 @@ module Rubix
|
|
33
33
|
# FooMonitor.run if $0 == __FILE__
|
34
34
|
module ZabbixMonitor
|
35
35
|
|
36
|
-
attr_accessor :template, :host_group, :hosts
|
37
|
-
|
38
36
|
def self.included klass
|
39
37
|
klass.default_settings.tap do |s|
|
40
38
|
s.define :zabbix_api_url, :description => "Zabbix API URL" , :required => true, :default => 'http://localhost/api_jsonrpc.php'
|
@@ -43,10 +41,8 @@ module Rubix
|
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
46
|
-
def
|
47
|
-
super(settings)
|
44
|
+
def connect_to_zabbix
|
48
45
|
Rubix.connect(settings[:zabbix_api_url], settings[:username], settings[:password])
|
49
|
-
find_hosts
|
50
46
|
end
|
51
47
|
|
52
48
|
def template_name
|
@@ -54,15 +50,16 @@ module Rubix
|
|
54
50
|
|
55
51
|
def host_group_name
|
56
52
|
end
|
57
|
-
|
58
|
-
def
|
53
|
+
|
54
|
+
def hosts
|
55
|
+
connect_to_zabbix
|
59
56
|
case
|
60
57
|
when template_name
|
61
|
-
|
62
|
-
|
58
|
+
template = Rubix::Template.find(:name => template_name)
|
59
|
+
Rubix::Host.list(template.host_ids).find_all(&:monitored)
|
63
60
|
when host_group_name
|
64
|
-
|
65
|
-
|
61
|
+
host_group = Rubix::HostGroup.find(:name => host_group_name)
|
62
|
+
Rubix::Host.list(host_group.host_ids).find_all(&:monitored)
|
66
63
|
else
|
67
64
|
raise Rubix::Error.new("Must define either a 'template_name' or a 'host_group_name' property for a Zabbix monitor.")
|
68
65
|
end
|
@@ -11,7 +11,7 @@ describe Rubix::ZabbixMonitor do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "will raise an error when no template name or host group is defined" do
|
14
|
-
lambda { @wrapper.new(@wrapper.default_settings) }.should raise_error(Rubix::Error)
|
14
|
+
lambda { @wrapper.new(@wrapper.default_settings).hosts }.should raise_error(Rubix::Error)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "can find hosts based on a template" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &17098960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17098960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mysql2
|
27
|
-
requirement: &
|
27
|
+
requirement: &17098520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *17098520
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &17098000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - <=
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *17098000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: configliere
|
49
|
-
requirement: &
|
49
|
+
requirement: &17097460 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.4.8
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *17097460
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: multipart-post
|
60
|
-
requirement: &
|
60
|
+
requirement: &17097080 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *17097080
|
69
69
|
description: Rubix provides abstractions for connecting to Zabbix's API, an ORM for
|
70
70
|
wrapping Zabbix resources, a set of scripts for writing data to Zabbix, and a collection
|
71
71
|
of Monitor classes for building periodic monitors.
|