zabbixapi 2.0.0 → 2.2.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +8 -7
- data/lib/zabbixapi.rb +1 -1
- data/lib/zabbixapi/classes/items.rb +1 -10
- data/lib/zabbixapi/classes/screens.rb +1 -7
- data/lib/zabbixapi/version.rb +1 -1
- data/spec/server.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/usergroup.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e53d0e095f85693462a04e39c5c31d0cef3d6695
|
4
|
+
data.tar.gz: dcb73a599e97d0245b0bb510d867c2b99d1b157c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98fe68e87a8de3dbc7070ec412856c3d3f3f4d82f0e658cb75e62e1310d19fab9165327cfe907d8b4916f7c59d55fd0127ca1e0c58cc2692ade4ef2d9577c05b
|
7
|
+
data.tar.gz: 110ea1b4871e68d7c47ae2017c7fbe6cdb3abb426af78bc0fc9779af7dce99473d05771698f4fd2e9f0663b669b43017409b4d2049cb35ebe4e9b1d195fbfba1
|
data/.travis.yml
CHANGED
@@ -5,8 +5,8 @@ rvm:
|
|
5
5
|
- 2.0.0
|
6
6
|
- 2.1.1
|
7
7
|
before_script:
|
8
|
-
- wget -qO - http://obs.express42.com/project_root:/zabbix2.
|
9
|
-
- echo "deb http://obs.express42.com/project_root:/zabbix2.
|
8
|
+
- wget -qO - http://obs.express42.com/project_root:/zabbix2.2/precise/Release.key | sudo apt-key add -
|
9
|
+
- echo "deb http://obs.express42.com/project_root:/zabbix2.2/precise/ ./" | sudo tee /etc/apt/sources.list.d/zabbix.list
|
10
10
|
- sudo apt-get update
|
11
11
|
- sudo apt-get install libiodbc2
|
12
12
|
- sudo apt-get install zabbix-server-pgsql zabbix-frontend-php
|
data/README.md
CHANGED
@@ -4,10 +4,11 @@ Simple and lightweight ruby module for work with zabbix api
|
|
4
4
|
|
5
5
|
[](https://travis-ci.org/express42/zabbixapi)
|
6
6
|
|
7
|
-
#####Now
|
8
|
-
* 1.8.2 (api version 1.2) /zabbixapi 0.6.x
|
9
|
-
* 1.8.9 (api version 1.3) /zabbixapi 0.6.x
|
10
|
-
* 2.0.x (api version 1.4 -> 2.0.10) /zabbixapi 2.0.x
|
7
|
+
#####Now works with all version of zabbix
|
8
|
+
* 1.8.2 (api version 1.2) /zabbixapi 0.6.x [branch zabbix1.8](https://github.com/express42/zabbixapi/tree/zabbix1.8)
|
9
|
+
* 1.8.9 (api version 1.3) /zabbixapi 0.6.x [branch zabbix1.8](https://github.com/express42/zabbixapi/tree/zabbix1.8)
|
10
|
+
* 2.0.x (api version 1.4 -> 2.0.10) /zabbixapi 2.0.x [branch master](https://github.com/express42/zabbixapi/tree/master)
|
11
|
+
* 2.2.x (api version 2.2.x) /zabbixapi 2.2.x [current branch zabbix2.2](https://github.com/express42/zabbixapi/tree/zabbix2.2)
|
11
12
|
|
12
13
|
## Version policy
|
13
14
|
|
@@ -23,7 +24,7 @@ We support only two last versions of zabbix (2.0 and 2.2), so you should conside
|
|
23
24
|
|
24
25
|
## Installation
|
25
26
|
```
|
26
|
-
gem install zabbixapi
|
27
|
+
gem install zabbixapi -v 2.2.0
|
27
28
|
```
|
28
29
|
|
29
30
|
## Getting Started
|
@@ -310,7 +311,7 @@ zbx.users.add_medias(
|
|
310
311
|
)
|
311
312
|
```
|
312
313
|
|
313
|
-
### Create proxy
|
314
|
+
### Create proxy
|
314
315
|
#### Active proxy
|
315
316
|
```ruby
|
316
317
|
zbx.proxies.create(
|
@@ -366,4 +367,4 @@ zbx.query(
|
|
366
367
|
## Zabbix documentation
|
367
368
|
|
368
369
|
* [Zabbix Project Homepage](http://zabbix.com/)
|
369
|
-
* [Zabbix Api docs](https://www.zabbix.com/documentation/2.
|
370
|
+
* [Zabbix Api docs](https://www.zabbix.com/documentation/2.2/manual/api/reference)
|
data/lib/zabbixapi.rb
CHANGED
@@ -41,7 +41,7 @@ class ZabbixApi
|
|
41
41
|
|
42
42
|
def initialize(options = {})
|
43
43
|
@client = Client.new(options)
|
44
|
-
unless @client.api_version
|
44
|
+
unless @client.api_version =~ /2\.2\.\d+/
|
45
45
|
raise "Zabbix API version: #{@client.api_version} is not support by this version of zabbixapi"
|
46
46
|
end
|
47
47
|
end
|
@@ -13,7 +13,7 @@ class ZabbixApi
|
|
13
13
|
"name"
|
14
14
|
end
|
15
15
|
|
16
|
-
def default_options
|
16
|
+
def default_options
|
17
17
|
{
|
18
18
|
:name => nil,
|
19
19
|
:key_ => nil,
|
@@ -49,14 +49,5 @@ class ZabbixApi
|
|
49
49
|
:ipmi_sensor => ''
|
50
50
|
}
|
51
51
|
end
|
52
|
-
|
53
|
-
def delete(data)
|
54
|
-
log "[DEBUG] Call delete with parametrs: #{data.inspect}"
|
55
|
-
|
56
|
-
data_delete = array_flag ? [data] : [key.to_sym => data]
|
57
|
-
result = @client.api_request(:method => "#{method_name}.delete", :params => data_delete)
|
58
|
-
result['itemids'].keys[0].to_i
|
59
|
-
end
|
60
|
-
|
61
52
|
end
|
62
53
|
end
|
@@ -44,15 +44,9 @@ class ZabbixApi
|
|
44
44
|
colspan = data[:colspan] || 0
|
45
45
|
height = data[:height] || 320 # default 320
|
46
46
|
width = data[:width] || 200 # default 200
|
47
|
-
vsize = data[:vsize] || (graphids.size/hsize).to_i
|
47
|
+
vsize = data[:vsize] || [1, (graphids.size/hsize).to_i].max
|
48
48
|
screenid = get_id(:name => screen_name)
|
49
49
|
|
50
|
-
if ((graphids.size/hsize) / 2) == 0
|
51
|
-
vsize = data[:vsize] || (graphids.size/hsize).to_i
|
52
|
-
else
|
53
|
-
vsize = data[:vsize] || ((graphids.size/hsize)+1).to_i
|
54
|
-
end
|
55
|
-
|
56
50
|
unless screenid
|
57
51
|
# Create screen
|
58
52
|
graphids.each_with_index do |graphid, index|
|
data/lib/zabbixapi/version.rb
CHANGED
data/spec/server.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/usergroup.rb
CHANGED
@@ -61,8 +61,14 @@ describe 'usergroup' do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
describe 'delete' do
|
64
|
-
it "should
|
65
|
-
zbx.usergroups.delete(@usergroupid).
|
64
|
+
it "should raise error when has users with only one group" do
|
65
|
+
expect { zbx.usergroups.delete(@usergroupid) }.to raise_error
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should return id of deleted group" do
|
69
|
+
usergroupid = zbx.usergroups.create(:name => gen_name('usergroup'))
|
70
|
+
|
71
|
+
expect(zbx.usergroups.delete(usergroupid)).to eq usergroupid
|
66
72
|
end
|
67
73
|
end
|
68
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbixapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev D.V.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|