zabbixapi 2.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: acfb3f390844a6875bacfda608080b148a3872a2
4
- data.tar.gz: 5c6a2e839a324b6de537b9e93d68db825a4e818f
3
+ metadata.gz: e53d0e095f85693462a04e39c5c31d0cef3d6695
4
+ data.tar.gz: dcb73a599e97d0245b0bb510d867c2b99d1b157c
5
5
  SHA512:
6
- metadata.gz: d47ef057a22a1268ea94f67c98381bff223037e8ff8f84fc48323c42bd96a5f5248bfd1396497a3ece93920acf25718f1d159fdda1e343b57d20d797a1781f76
7
- data.tar.gz: 2af73a1a183dee4576ed0a213993579d454646b77db072deb77c69b06389c10661c9360b4ab3cd266d42abc510d2f67e2778a07600b59246a2e61747f01528f5
6
+ metadata.gz: 98fe68e87a8de3dbc7070ec412856c3d3f3f4d82f0e658cb75e62e1310d19fab9165327cfe907d8b4916f7c59d55fd0127ca1e0c58cc2692ade4ef2d9577c05b
7
+ data.tar.gz: 110ea1b4871e68d7c47ae2017c7fbe6cdb3abb426af78bc0fc9779af7dce99473d05771698f4fd2e9f0663b669b43017409b4d2049cb35ebe4e9b1d195fbfba1
@@ -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.0/precise/Release.key | sudo apt-key add -
9
- - echo "deb http://obs.express42.com/project_root:/zabbix2.0/precise/ ./" | sudo tee /etc/apt/sources.list.d/zabbix.list
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
  [![Build Status](https://travis-ci.org/express42/zabbixapi.png)](https://travis-ci.org/express42/zabbixapi)
6
6
 
7
- #####Now worked with zabbix
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 (2.0 and later)
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.0/manual/appendix/api/api)
370
+ * [Zabbix Api docs](https://www.zabbix.com/documentation/2.2/manual/api/reference)
@@ -41,7 +41,7 @@ class ZabbixApi
41
41
 
42
42
  def initialize(options = {})
43
43
  @client = Client.new(options)
44
- unless @client.api_version == "1.4" || @client.api_version =~ /2\.0\.\d+/
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|
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "2.0.0"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -8,8 +8,8 @@ describe 'server' do
8
8
  zbx.server.version.should be_kind_of(String)
9
9
  end
10
10
 
11
- it "should be 2.0.x" do
12
- zbx.server.version.should match(/2\.0\.\d+/)
11
+ it "should be 2.2.x" do
12
+ zbx.server.version.should match(/2\.2\.\d+/)
13
13
  end
14
14
  end
15
15
  end
@@ -3,7 +3,7 @@ require 'zabbixapi'
3
3
 
4
4
  def zbx
5
5
  # settings
6
- @api_url = ENV['ZABBIX_HOST_URL'] || 'http://localhost:7070/api_jsonrpc.php'
6
+ @api_url = ENV['ZABBIX_HOST_URL'] || 'http://10.211.55.6/api_jsonrpc.php'
7
7
  @api_login = 'Admin'
8
8
  @api_password = 'zabbix'
9
9
 
@@ -61,8 +61,14 @@ describe 'usergroup' do
61
61
  end
62
62
 
63
63
  describe 'delete' do
64
- it "should return id" do
65
- zbx.usergroups.delete(@usergroupid).should eq @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.0.0
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-18 00:00:00.000000000 Z
12
+ date: 2014-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json