zabbixapi 0.6.4 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +32 -0
- data/lib/zabbixapi/2.0/classes/hosts.rb +1 -0
- data/lib/zabbixapi/2.0/classes/proxies.rb +31 -0
- data/lib/zabbixapi/2.0/classes/usermacros.rb +46 -0
- data/lib/zabbixapi/version.rb +1 -1
- data/lib/zabbixapi.rb +8 -0
- data/zabbixapi.gemspec +4 -4
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MGU3ZGZjNTAyOThmMTcxOGNiNDZmZjIwODYyMTBmNDczNDA3YTJhOTdlNjU5
|
10
|
-
OWIwNzNkMDM1ZDFjZmIyMzUwZGYxODRhMmEyNTIwNjliZDhjYWEzMmY4NWIy
|
11
|
-
MmQ2ZGZiZWY1NDk1MDQ4OWM5ODc3ZjM3NGEyMDZhOTdmMzA2NTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODViOGRkYWM1OGRkZWFhOTg2NzFlNDQzYzdhNmI3ODE4MDBjMjI3ZGY4Mzdm
|
14
|
-
ZGFmYjE5ZjFkOTBhZWRmNzc5NTk4YWY4NWZhNzc5ZmY5ZDM2NTRhNjY3YzYy
|
15
|
-
MzllNDU1OGM3YWNjYTZjMzdkN2VhZjBmOTBhZjM0OTVhYjliM2Y=
|
3
|
+
metadata.gz: 635adc2b44f68bdca298f1fa7a72839901528f0e
|
4
|
+
data.tar.gz: f257c9c6f322b313de54fb9b4893ddc37f217488
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e893b3fc1a1cee7cc81d9e44e2f1af92f4a5f96cf0f3f2a62d3cdb007bae119b7988078dace1818a6d73cf64087ba7b216c52905d838dbf61d5b586b40d3c5f
|
7
|
+
data.tar.gz: 3f1cc8fe7bfa1dc99d779c44d536fde3aa3e84dff2a666266f463c7b1f415e78f53ee75e6bcb0690f9690e5b4303b93e42c8a038b4f515e8d80b23f459e1cc72
|
data/README.md
CHANGED
@@ -314,6 +314,38 @@ zbx.users.add_medias(
|
|
314
314
|
)
|
315
315
|
```
|
316
316
|
|
317
|
+
### Create proxy (2.0 and later)
|
318
|
+
#### Active proxy
|
319
|
+
```ruby
|
320
|
+
zbx.proxies.create(
|
321
|
+
:host => "Proxy 1",
|
322
|
+
:status => 5
|
323
|
+
)
|
324
|
+
```
|
325
|
+
|
326
|
+
#### Passive Proxy
|
327
|
+
```ruby
|
328
|
+
zbx.proxies.create(
|
329
|
+
:host => "Passive proxy",
|
330
|
+
:status => 6,
|
331
|
+
:interfaces => [
|
332
|
+
:ip => "127.0.0.1",
|
333
|
+
:dns => "",
|
334
|
+
:useip => 1,
|
335
|
+
:port => 10051
|
336
|
+
]
|
337
|
+
)
|
338
|
+
```
|
339
|
+
|
340
|
+
### User and global macros
|
341
|
+
```ruby
|
342
|
+
zbx.usermacros.create(
|
343
|
+
:hostid => zbx.hosts.get_id( :host => "Zabbix server" ),
|
344
|
+
:macro => "{$ZZZZ}",
|
345
|
+
:value => 1.1.1.1
|
346
|
+
)
|
347
|
+
```
|
348
|
+
|
317
349
|
### Custom queries
|
318
350
|
```ruby
|
319
351
|
zbx.query(
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class ZabbixApi
|
2
|
+
class Proxies < Basic
|
3
|
+
|
4
|
+
def array_flag
|
5
|
+
true
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_name
|
9
|
+
"proxy"
|
10
|
+
end
|
11
|
+
|
12
|
+
def indentify
|
13
|
+
"host"
|
14
|
+
end
|
15
|
+
|
16
|
+
def delete(data)
|
17
|
+
result = @client.api_request(:method => "proxy.delete", :params => data)
|
18
|
+
result.empty? ? nil : result['proxyids'][0].to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def isreadable(data)
|
22
|
+
result = @client.api_request(:method => "proxy.isreadable", :params => data)
|
23
|
+
end
|
24
|
+
|
25
|
+
def iswritable(data)
|
26
|
+
result = @client.api_request(:method => "proxy.iswritable", :params => data)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class ZabbixApi
|
2
|
+
class Usermacros < Basic
|
3
|
+
def array_flag
|
4
|
+
true
|
5
|
+
end
|
6
|
+
|
7
|
+
def indentify
|
8
|
+
"macro"
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_name
|
12
|
+
"usermacro"
|
13
|
+
end
|
14
|
+
|
15
|
+
def create(data)
|
16
|
+
request(data, "usermacro.create", "hostmacroids")
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_global(data)
|
20
|
+
request(data, "usermacro.createglobal", "globalmacroids")
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete(data)
|
24
|
+
request(data, "usermacro.delete", "hostmacroids")
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete_global(data)
|
28
|
+
request(data, "usermacro.deleteglobal", "globalmacroids")
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
request(data, "usermacro.update", "hostmacroids")
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_global
|
36
|
+
request(data, "usermacro.updateglobal", "globalmacroids")
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def request(data, method, result_key)
|
41
|
+
result = @client.api_request(:method => method, :params => data)
|
42
|
+
result.empty? ? nil : result[result_key][0].to_i
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/zabbixapi/version.rb
CHANGED
data/lib/zabbixapi.rb
CHANGED
@@ -69,6 +69,10 @@ class ZabbixApi
|
|
69
69
|
@graphs ||= Graphs.new(@client)
|
70
70
|
end
|
71
71
|
|
72
|
+
def proxies
|
73
|
+
@proxies ||= Proxies.new(@client)
|
74
|
+
end
|
75
|
+
|
72
76
|
def screens
|
73
77
|
@screens ||= Screens.new(@client)
|
74
78
|
end
|
@@ -77,6 +81,10 @@ class ZabbixApi
|
|
77
81
|
@usergroups ||= Usergroups.new(@client)
|
78
82
|
end
|
79
83
|
|
84
|
+
def usermacros
|
85
|
+
@usermacros ||= Usermacros.new(@client)
|
86
|
+
end
|
87
|
+
|
80
88
|
def mediatypes
|
81
89
|
@mediatypes ||= Mediatypes.new(@client)
|
82
90
|
end
|
data/zabbixapi.gemspec
CHANGED
@@ -5,14 +5,14 @@ require 'zabbixapi/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "zabbixapi"
|
7
7
|
s.version = ZabbixApi::VERSION
|
8
|
-
s.authors = ["Vasiliev D.V."]
|
9
|
-
|
10
|
-
s.homepage = "https://github.com/
|
8
|
+
s.authors = ["Vasiliev D.V.", "Ivan Evtuhovich"]
|
9
|
+
s.email = %w(vadv.mkn@gmail.com evtuhovich@gmail.com)
|
10
|
+
s.homepage = "https://github.com/express42/zabbixapi"
|
11
11
|
s.summary = %q{Realization for Zabbix API.}
|
12
12
|
s.description = %q{Allows you to work with zabbix api from ruby.}
|
13
13
|
s.licenses = %w(MIT)
|
14
14
|
|
15
|
-
|
15
|
+
s.add_dependency('json', '~> 1.6', '>= 1.6.0')
|
16
16
|
|
17
17
|
s.rubyforge_project = "zabbixapi"
|
18
18
|
|
metadata
CHANGED
@@ -1,32 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbixapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev D.V.
|
8
|
+
- Ivan Evtuhovich
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: json
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
17
21
|
- - ! '>='
|
18
22
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
23
|
+
version: 1.6.0
|
20
24
|
type: :runtime
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.6'
|
24
31
|
- - ! '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
33
|
+
version: 1.6.0
|
27
34
|
description: Allows you to work with zabbix api from ruby.
|
28
35
|
email:
|
29
36
|
- vadv.mkn@gmail.com
|
37
|
+
- evtuhovich@gmail.com
|
30
38
|
executables: []
|
31
39
|
extensions: []
|
32
40
|
extra_rdoc_files: []
|
@@ -68,19 +76,21 @@ files:
|
|
68
76
|
- lib/zabbixapi/2.0/classes/hosts.rb
|
69
77
|
- lib/zabbixapi/2.0/classes/items.rb
|
70
78
|
- lib/zabbixapi/2.0/classes/mediatypes.rb
|
79
|
+
- lib/zabbixapi/2.0/classes/proxies.rb
|
71
80
|
- lib/zabbixapi/2.0/classes/screens.rb
|
72
81
|
- lib/zabbixapi/2.0/classes/server.rb
|
73
82
|
- lib/zabbixapi/2.0/classes/templates.rb
|
74
83
|
- lib/zabbixapi/2.0/classes/triggers.rb
|
75
84
|
- lib/zabbixapi/2.0/classes/unusable.rb
|
76
85
|
- lib/zabbixapi/2.0/classes/usergroups.rb
|
86
|
+
- lib/zabbixapi/2.0/classes/usermacros.rb
|
77
87
|
- lib/zabbixapi/2.0/classes/users.rb
|
78
88
|
- lib/zabbixapi/client.rb
|
79
89
|
- lib/zabbixapi/version.rb
|
80
90
|
- spec/localhost.rb
|
81
91
|
- spec/run.rb
|
82
92
|
- zabbixapi.gemspec
|
83
|
-
homepage: https://github.com/
|
93
|
+
homepage: https://github.com/express42/zabbixapi
|
84
94
|
licenses:
|
85
95
|
- MIT
|
86
96
|
metadata: {}
|
@@ -100,10 +110,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
110
|
version: '0'
|
101
111
|
requirements: []
|
102
112
|
rubyforge_project: zabbixapi
|
103
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.2.1
|
104
114
|
signing_key:
|
105
115
|
specification_version: 4
|
106
116
|
summary: Realization for Zabbix API.
|
107
117
|
test_files:
|
108
118
|
- spec/localhost.rb
|
109
119
|
- spec/run.rb
|
120
|
+
has_rdoc:
|