zabbixapi 0.5.1b10 → 0.5.1b11

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.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  .rvmrc
2
2
  *.gem
3
3
  *.swp
4
+ .idea
4
5
  pkg
5
6
  test
@@ -1,8 +1,7 @@
1
1
  class Hash
2
2
 
3
- def deep_include?(sub_hash, without_key = nil)
3
+ def deep_include?(sub_hash)
4
4
  sub_hash.keys.all? do |key|
5
- next if key == without_key
6
5
  self.has_key?(key) && if sub_hash[key].is_a?(Hash)
7
6
  self[key].is_a?(Hash) && self[key].deep_include?(sub_hash[key])
8
7
  else
@@ -16,10 +15,14 @@ end
16
15
  class ZabbixApi
17
16
  class Basic
18
17
 
18
+ def log(message)
19
+ puts "#{message}" if @client.options[:debug]
20
+ end
21
+
19
22
  def symbolize_keys(obj)
20
23
  return obj.inject({}){|memo,(k,v)| memo[k.to_sym] = symbolize_keys(v); memo} if obj.is_a? Hash
21
24
  return obj.inject([]){|memo,v | memo << symbolize_keys(v); memo} if obj.is_a? Array
22
- return obj
25
+ obj
23
26
  end
24
27
 
25
28
  def parse_keys(data)
@@ -2,7 +2,7 @@ class ZabbixApi
2
2
  class Basic
3
3
 
4
4
  def create(data)
5
- puts "[DEBUG] Call create with parametrs: #{data.inspect}" if @client.options[:debug]
5
+ log "[DEBUG] Call create with parametrs: #{data.inspect}"
6
6
 
7
7
  data_with_default = default_options.empty? ? data : merge_params(data)
8
8
  data_create = array_flag ? [data_with_default] : data_with_default
@@ -11,7 +11,7 @@ class ZabbixApi
11
11
  end
12
12
 
13
13
  def delete(data)
14
- puts "[DEBUG] Call delete with parametrs: #{data.inspect}" if @client.options[:debug]
14
+ log "[DEBUG] Call delete with parametrs: #{data.inspect}"
15
15
 
16
16
  data_delete = array_flag ? [data] : [key.to_sym => data]
17
17
  result = @client.api_request(:method => "#{method_name}.delete", :params => data_delete)
@@ -19,14 +19,14 @@ class ZabbixApi
19
19
  end
20
20
 
21
21
  def create_or_update(data)
22
- puts "[DEBUG] Call create_or_update with parametrs: #{data.inspect}" if @client.options[:debug]
22
+ log "[DEBUG] Call create_or_update with parametrs: #{data.inspect}"
23
23
 
24
24
  id = get_id(indentify.to_sym => data[indentify.to_sym])
25
25
  id ? update(data.merge(key.to_sym => id.to_s)) : create(data)
26
26
  end
27
27
 
28
28
  def update(data)
29
- puts "[DEBUG] Call update with parametrs: #{data.inspect}" if @client.options[:debug]
29
+ log "[DEBUG] Call update with parametrs: #{data.inspect}"
30
30
 
31
31
  dump = {}
32
32
  item_id = data[key.to_sym].to_i
@@ -34,18 +34,18 @@ class ZabbixApi
34
34
  dump = symbolize_keys(item) if item[key].to_i == data[key.to_sym].to_i
35
35
  end
36
36
 
37
- unless dump.deep_include?(data, key.to_sym)
37
+ if dump.deep_include?(data)
38
+ item_id
39
+ else
38
40
  data_update = array_flag ? [data] : data
39
41
  result = @client.api_request(:method => "#{method_name}.update", :params => data_update)
40
42
  parse_keys result
41
- else
42
- item_id
43
43
  end
44
44
 
45
45
  end
46
46
 
47
47
  def get_full_data(data)
48
- puts "[DEBUG] Call get_full_data with parametrs: #{data.inspect}" if @client.options[:debug]
48
+ log "[DEBUG] Call get_full_data with parametrs: #{data.inspect}"
49
49
 
50
50
  @client.api_request(
51
51
  :method => "#{method_name}.get",
@@ -59,7 +59,7 @@ class ZabbixApi
59
59
  end
60
60
 
61
61
  def dump_by_id(data)
62
- puts "[DEBUG] Call dump_by_id with parametrs: #{data.inspect}" if @client.options[:debug]
62
+ log "[DEBUG] Call dump_by_id with parametrs: #{data.inspect}"
63
63
 
64
64
  @client.api_request(
65
65
  :method => "#{method_name}.get",
@@ -81,7 +81,7 @@ class ZabbixApi
81
81
  end
82
82
 
83
83
  def get_id(data)
84
- puts "[DEBUG] Call get_id with parametrs: #{data.inspect}" if @client.options[:debug]
84
+ log "[DEBUG] Call get_id with parametrs: #{data.inspect}"
85
85
 
86
86
  result = symbolize_keys( get_full_data(data) )
87
87
  id = nil
@@ -90,9 +90,9 @@ class ZabbixApi
90
90
  end
91
91
 
92
92
  def get_or_create(data)
93
- puts "[DEBUG] Call get_or_create with parametrs: #{data.inspect}" if @client.options[:debug]
93
+ log "[DEBUG] Call get_or_create with parametrs: #{data.inspect}"
94
94
 
95
- unless id = get_id(data)
95
+ unless (id = get_id(data))
96
96
  id = create(data)
97
97
  end
98
98
  id
@@ -20,7 +20,7 @@ class ZabbixApi
20
20
  end
21
21
 
22
22
  def get_or_create(data)
23
- unless appid = get_id(data)
23
+ unless (appid = get_id(data))
24
24
  appid = create(data)
25
25
  end
26
26
  appid
@@ -46,7 +46,7 @@ class ZabbixApi
46
46
  # * *Returns* :
47
47
  # - Integer
48
48
  def get_or_create(data)
49
- unless templateid = get_id(:host => data[:host])
49
+ unless (templateid = get_id(:host => data[:host]))
50
50
  templateid = create(data)
51
51
  end
52
52
  templateid
@@ -13,5 +13,9 @@ class ZabbixApi
13
13
  "description"
14
14
  end
15
15
 
16
+ def create_or_update(data)
17
+ raise "Don't use this shit, use get_or_create"
18
+ end
19
+
16
20
  end
17
21
  end
@@ -48,10 +48,10 @@ class ZabbixApi
48
48
 
49
49
  def http_request(body)
50
50
  uri = URI.parse(@options[:url])
51
- unless @proxy_uri.nil?
52
- http = Net::HTTP.new(uri.host, uri.port)
53
- else
51
+ if @proxy_uri.nil?
54
52
  http = Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
53
+ else
54
+ http = Net::HTTP.new(uri.host, uri.port)
55
55
  end
56
56
  request = Net::HTTP::Post.new(uri.request_uri)
57
57
  request.basic_auth @options[:http_user], @options[:http_password] if @options[:http_user]
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.5.1b10"
2
+ VERSION = "0.5.1b11"
3
3
  end
data/spec/localhost.rb CHANGED
@@ -1,3 +1,5 @@
1
+ #encoding: utf-8
2
+
1
3
  require 'zabbixapi'
2
4
 
3
5
  # settings
@@ -11,7 +13,7 @@ zbx = ZabbixApi.connect(
11
13
  :url => api_url,
12
14
  :user => api_login,
13
15
  :password => api_password,
14
- :debug => true
16
+ :debug => false
15
17
  )
16
18
 
17
19
  hostgroup = "hostgroup______1"
@@ -26,21 +28,34 @@ usergroup = "SomeUserGroup"
26
28
  graph = "graph___a"
27
29
  mediatype = "somemediatype"
28
30
 
31
+ hostgroupid = 0
32
+ templateid = 0
33
+ applicationid = 0
34
+ itemid = 0
35
+ hostid = 0
36
+ triggerid = 0
37
+ userid = 0
38
+ usergroupid = 0
39
+ graphid = 0
40
+ screenid = 0
41
+ mediatypeid = 0
42
+
29
43
 
30
44
  puts "### Zabbix API server version #{zbx.server.version} ###"
31
45
 
32
- describe ZabbixApi, "test_api" do
46
+ describe ZabbixApi do
33
47
 
34
48
  it "SERVER: Get version api" do
35
49
  zbx.server.version.should be_kind_of(String)
36
50
  end
37
51
 
38
52
  it "HOSTGROUP: Create" do
39
- zbx.hostgroups.create(:name => hostgroup).should be_kind_of(Integer)
53
+ hostgroupid = zbx.hostgroups.create(:name => hostgroup)
54
+ hostgroupid.should be_kind_of(Integer)
40
55
  end
41
56
 
42
57
  it "HOSTGROUP: Find" do
43
- zbx.hostgroups.get_id(:name => hostgroup).should be_kind_of(Integer)
58
+ zbx.hostgroups.get_id(:name => hostgroup).should eq hostgroupid
44
59
  end
45
60
 
46
61
  it "HOSTGROUP: Find unknown" do
@@ -48,37 +63,38 @@ describe ZabbixApi, "test_api" do
48
63
  end
49
64
 
50
65
  it "HOSTGROUP: Create or get" do
51
- zbx.hostgroups.get_or_create(:name => hostgroup).should be_kind_of(Integer)
66
+ zbx.hostgroups.get_or_create(:name => hostgroup).should eq hostgroupid
52
67
  end
53
68
 
54
69
  it "HOSTGROUP: Create or update" do
55
- zbx.hostgroups.create_or_update(:name => hostgroup).should be_kind_of(Integer)
70
+ zbx.hostgroups.create_or_update(:name => hostgroup).should eq hostgroupid
56
71
  end
57
72
 
58
73
  it "HOSTGROUP: Get all" do
59
- zbx.hostgroups.all.should be_kind_of(Hash)
74
+ zbx.hostgroups.all.should include(hostgroup=>hostgroupid.to_s)
60
75
  end
61
76
 
62
77
  it "TEMPLATE: Create" do
63
- zbx.templates.create(
78
+ templateid = zbx.templates.create(
64
79
  :host => template,
65
80
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
66
- ).should be_kind_of(Integer)
81
+ )
82
+ templateid.should be_kind_of(Integer)
67
83
  end
68
84
 
69
85
  it "TEMPLATE: Get get or create" do
70
86
  zbx.templates.get_or_create(
71
87
  :host => template,
72
88
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
73
- ).should be_kind_of(Integer)
89
+ ).should eq templateid
74
90
  end
75
91
 
76
92
  it "TEMPLATE: Check full data" do
77
- zbx.templates.get_full_data(:host => template)[0]['host'].should be_kind_of(String)
93
+ zbx.templates.get_full_data(:host => template)[0].should include("host"=>template)
78
94
  end
79
95
 
80
96
  it "TEMPLATE: Find" do
81
- zbx.templates.get_id(:host => template).should be_kind_of(Integer)
97
+ zbx.templates.get_id(:host => template).should eq templateid
82
98
  end
83
99
 
84
100
  it "TEMPLATE: Find unknown" do
@@ -86,25 +102,26 @@ describe ZabbixApi, "test_api" do
86
102
  end
87
103
 
88
104
  it "APPLICATION: Create" do
89
- zbx.applications.create(
105
+ applicationid = zbx.applications.create(
90
106
  :name => application,
91
107
  :hostid => zbx.templates.get_id(:host => template)
92
108
  )
109
+ applicationid.should be_kind_of(Integer)
93
110
  end
94
111
 
95
112
  it "APPLICATION: Get or create" do
96
113
  zbx.applications.get_or_create(
97
114
  :name => application,
98
115
  :hostid => zbx.templates.get_id(:host => template)
99
- )
116
+ ).should eq applicationid
100
117
  end
101
118
 
102
119
  it "APPLICATION: Full info check" do
103
- zbx.applications.get_full_data(:name => application)[0]['applicationid'].should be_kind_of(String)
120
+ zbx.applications.get_full_data(:name => application)[0].should include("name"=>application)
104
121
  end
105
122
 
106
123
  it "APPLICATION: Find" do
107
- zbx.applications.get_id(:name => application).should be_kind_of(Integer)
124
+ zbx.applications.get_id(:name => application).should eq applicationid
108
125
  end
109
126
 
110
127
  it "APPLICATION: Find unknown" do
@@ -112,57 +129,69 @@ describe ZabbixApi, "test_api" do
112
129
  end
113
130
 
114
131
  it "ITEM: Create" do
115
- zbx.items.create(
132
+ itemid = zbx.items.create(
116
133
  :description => item,
117
134
  :key_ => "proc.num[aaa]",
118
135
  :hostid => zbx.templates.get_id(:host => template),
119
136
  :applications => [zbx.applications.get_id(:name => application)]
120
- ).should be_kind_of(Integer)
137
+ )
138
+ itemid.should be_kind_of(Integer)
121
139
  end
122
140
 
123
141
  it "ITEM: Full info check" do
124
- zbx.items.get_full_data(:description => item)[0]['itemid'].should be_kind_of(String)
142
+ zbx.items.get_full_data(:description => item)[0].should include("description"=>item)
125
143
  end
126
144
 
127
145
  it "ITEM: Find" do
128
- zbx.items.get_id(:description => item).should be_kind_of(Integer)
146
+ zbx.items.get_id(:description => item).should eq itemid
129
147
  end
130
148
 
131
149
  it "ITEM: Update" do
132
150
  zbx.items.update(
133
151
  :itemid => zbx.items.get_id(:description => item),
134
- :status => 0
135
- ).should be_kind_of(Integer)
152
+ :status => 1
153
+ ).should eq itemid
136
154
  end
137
155
 
138
- it "ITEM: Create or update" do
156
+ it "ITEM: Create or update (update)" do
139
157
  zbx.items.create_or_update(
140
158
  :description => item,
141
159
  :key_ => "proc.num[aaa]",
142
160
  :status => 0,
143
161
  :hostid => zbx.templates.get_id(:host => template),
144
162
  :applications => [zbx.applications.get_id(:name => application)]
145
- ).should be_kind_of(Integer)
163
+ ).should eq itemid
164
+ end
165
+
166
+ it "ITEM: Create or update (create)" do
167
+ zbx.items.create_or_update(
168
+ :description => item + "____1",
169
+ :key_ => "proc.num[aaabb]",
170
+ :status => 0,
171
+ :hostid => zbx.templates.get_id(:host => template),
172
+ :applications => [zbx.applications.get_id(:name => application)]
173
+ ).should eq itemid + 1
146
174
  end
147
175
 
148
176
  it "ITEM: Get unknown" do
149
- zbx.items.get_id(:description => "#{item}_____")
177
+ zbx.items.get_id(:description => "#{item}_____").should be_kind_of(NilClass)
150
178
  end
151
179
 
152
180
  it "HOST: Create" do
153
- zbx.hosts.create(
181
+ hostid = zbx.hosts.create(
154
182
  :host => host,
155
183
  :ip => "10.20.48.88",
156
184
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
157
- ).should be_kind_of(Integer)
185
+ )
186
+ hostid.should be_kind_of(Integer)
158
187
  end
159
188
 
160
- it "HOST: Update or create" do
189
+ it "HOST: Update or create (update)" do
161
190
  zbx.hosts.create_or_update(
162
191
  :host => host,
163
192
  :ip => "10.20.48.89",
164
193
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
165
- ).should be_kind_of(Integer)
194
+ ).should eq hostid
166
195
  end
167
196
 
168
197
  it "HOST: Find unknown" do
@@ -170,20 +199,29 @@ describe ZabbixApi, "test_api" do
170
199
  end
171
200
 
172
201
  it "HOST: Find" do
173
- zbx.hosts.get_id(:host => host).should be_kind_of(Integer)
202
+ zbx.hosts.get_id(:host => host).should eq hostid
174
203
  end
175
204
 
176
205
  it "HOST: Update" do
177
206
  zbx.hosts.update(
178
207
  :hostid => zbx.hosts.get_id(:host => host),
179
208
  :status => 0
180
- )
209
+ ).should eq hostid
210
+ end
211
+
212
+ it "TEMPLATE: Update hosts with templates" do
213
+ zbx.templates.mass_update(
214
+ :hosts_id => [zbx.hosts.get_id(:host => host)],
215
+ :templates_id => [zbx.templates.get_id(:host => template)]
216
+ ).should be_kind_of(TrueClass)
181
217
  end
182
218
 
183
219
  it "TEMPLATE: Get all templates linked with host" do
184
- zbx.templates.get_ids_by_host(
220
+ tmpl_array = zbx.templates.get_ids_by_host(
185
221
  :hostids => [zbx.hosts.get_id(:host => host)]
186
- ).should be_kind_of(Array)
222
+ )
223
+ tmpl_array.should be_kind_of(Array)
224
+ tmpl_array.should include templateid.to_s
187
225
  end
188
226
 
189
227
  it "TEMPLATE: Linked hosts with templates" do
@@ -193,19 +231,12 @@ describe ZabbixApi, "test_api" do
193
231
  ).should be_kind_of(TrueClass)
194
232
  end
195
233
 
196
- it "TEMPLATE: Update hosts with templates" do
197
- zbx.templates.mass_update(
198
- :hosts_id => [zbx.hosts.get_id(:host => host)],
199
- :templates_id => [zbx.templates.get_id(:host => template)]
200
- ).should be_kind_of(TrueClass)
201
- end
202
-
203
234
  it "TEMPLATE: Get all" do
204
- zbx.templates.all.should be_kind_of(Hash)
235
+ zbx.templates.all.should include(template=>templateid.to_s)
205
236
  end
206
237
 
207
238
  it "TRIGGER: Create" do
208
- zbx.triggers.create(
239
+ triggerid = zbx.triggers.create(
209
240
  :description => trigger,
210
241
  :expression => "{#{template}:proc.num[aaa].last(0)}<1",
211
242
  :comments => "Bla-bla is faulty (disaster)",
@@ -213,11 +244,12 @@ describe ZabbixApi, "test_api" do
213
244
  :status => 0,
214
245
  :templateid => 0,
215
246
  :type => 0
216
- ).should be_kind_of(Integer)
247
+ )
248
+ triggerid.should be_kind_of(Integer)
217
249
  end
218
250
 
219
251
  it "TRIGGER: Find" do
220
- zbx.triggers.get_id(:description => trigger).should be_kind_of(Integer)
252
+ zbx.triggers.get_id(:description => trigger).should eq triggerid + 1 # вау блять
221
253
  end
222
254
 
223
255
  it "GRAPH: Create" do
@@ -227,13 +259,14 @@ describe ZabbixApi, "test_api" do
227
259
  :type => "0",
228
260
  :periods_cnt => "5"
229
261
  }
230
- zbx.graphs.create(
262
+ graphid = zbx.graphs.create(
231
263
  :gitems => [gitems],
232
264
  :show_triggers => "0",
233
265
  :name => graph,
234
266
  :width => "900",
235
267
  :height => "200"
236
- ).should be_kind_of(Integer)
268
+ )
269
+ graphid.should be_kind_of(Integer)
237
270
  end
238
271
 
239
272
  it "GRAPH: Create or get" do
@@ -249,7 +282,7 @@ describe ZabbixApi, "test_api" do
249
282
  :name => graph,
250
283
  :width => "900",
251
284
  :height => "200"
252
- ).should be_kind_of(Integer)
285
+ ).should eq graphid
253
286
  end
254
287
 
255
288
  it "GRAPH: Find gititems" do
@@ -257,11 +290,13 @@ describe ZabbixApi, "test_api" do
257
290
  end
258
291
 
259
292
  it "GRAPH: Find" do
260
- zbx.graphs.get_id( :name => graph ).should be_kind_of(Integer)
293
+ zbx.graphs.get_id( :name => graph ).should eq graphid
261
294
  end
262
295
 
263
296
  it "GRAPH: get_ids_by_host" do
264
- zbx.graphs.get_ids_by_host( :host => host ).should be_kind_of(Array)
297
+ graph_array = zbx.graphs.get_ids_by_host( :host => host )
298
+ graph_array.should be_kind_of(Array)
299
+ graph_array.should include(graphid.to_s)
265
300
  end
266
301
 
267
302
  it "GRAPH: Update" do
@@ -271,7 +306,7 @@ describe ZabbixApi, "test_api" do
271
306
  :hostid => zbx.hosts.get_id(:host => host)
272
307
  ),
273
308
  :ymax_type => 1
274
- ).should be_kind_of(Integer)
309
+ ).should eq graphid
275
310
  end
276
311
 
277
312
  it "GRAPH: Create or Update" do
@@ -287,14 +322,15 @@ describe ZabbixApi, "test_api" do
287
322
  :name => graph,
288
323
  :width => "900",
289
324
  :height => "200"
290
- ).should be_kind_of(Integer)
325
+ ).should eq graphid
291
326
  end
292
327
 
293
328
  it "SCREEN: Get or create for host" do
294
- zbx.screens.get_or_create_for_host(
329
+ screenid = zbx.screens.get_or_create_for_host(
295
330
  :host => host,
296
331
  :graphids => zbx.graphs.get_ids_by_host(:host => host)
297
- ).should be_kind_of(Integer)
332
+ )
333
+ screenid.should be_kind_of(Integer)
298
334
  end
299
335
 
300
336
  it "TEMPLATE: Unlink hosts from templates" do
@@ -307,7 +343,7 @@ describe ZabbixApi, "test_api" do
307
343
  it "SCREEN: Delete" do
308
344
  zbx.screens.delete(
309
345
  [zbx.screens.get_id(:name => "#{host}_graphs")]
310
- ).should be_kind_of(Integer)
346
+ ).should eq screenid
311
347
  end
312
348
 
313
349
  it "GRAPH: Delete" do
@@ -315,40 +351,41 @@ describe ZabbixApi, "test_api" do
315
351
  end
316
352
 
317
353
  it "TRIGGER: Delete" do
318
- zbx.triggers.delete( zbx.triggers.get_id(:description => trigger) ).should be_kind_of(Integer)
354
+ zbx.triggers.delete( zbx.triggers.get_id(:description => trigger) ).should eq triggerid + 1
319
355
  end
320
356
 
321
357
  it "HOST: Delete" do
322
- zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should be_kind_of(Integer)
358
+ zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should eq hostid
323
359
  end
324
360
 
325
361
  it "ITEM: Delete" do
326
362
  zbx.items.delete(
327
363
  zbx.items.get_id(:description => item)
328
- ).should be_kind_of(Integer)
364
+ ).should eq itemid
329
365
  end
330
366
 
331
367
  it "APPLICATION: Delete" do
332
- zbx.applications.delete( zbx.applications.get_id(:name => application) )
368
+ zbx.applications.delete( zbx.applications.get_id(:name => application) ).should eq applicationid
333
369
  end
334
370
 
335
371
  it "TEMPLATE: Delete" do
336
- zbx.templates.delete(zbx.templates.get_id(:host => template))
372
+ zbx.templates.delete(zbx.templates.get_id(:host => template)).should eq templateid
337
373
  end
338
374
 
339
375
  it "HOSTGROUP: Delete" do
340
376
  zbx.hostgroups.delete(
341
377
  zbx.hostgroups.get_id(:name => hostgroup)
342
- ).should be_kind_of(Integer)
378
+ ).should eq hostgroupid
343
379
  end
344
380
 
345
381
  it "USER: Create" do
346
- zbx.users.create(
382
+ userid = zbx.users.create(
347
383
  :alias => "Test #{user}",
348
384
  :name => user,
349
385
  :surname => user,
350
386
  :passwd => user
351
- ).should be_kind_of(Integer)
387
+ )
388
+ userid.should be_kind_of(Integer)
352
389
  end
353
390
 
354
391
  it "USER: Create or update" do
@@ -357,7 +394,7 @@ describe ZabbixApi, "test_api" do
357
394
  :name => user,
358
395
  :surname => user,
359
396
  :passwd => user
360
- ).should be_kind_of(Integer)
397
+ ).should eq userid
361
398
  end
362
399
 
363
400
  it "USER: Find" do
@@ -369,22 +406,23 @@ describe ZabbixApi, "test_api" do
369
406
  end
370
407
 
371
408
  it "USER: Find unknown" do
372
- zbx.users.get_id(:name => "#{user}_____")
409
+ zbx.users.get_id(:name => "#{user}_____").should be_kind_of(NilClass)
373
410
  end
374
411
 
375
412
  it "USERGROUPS: Create" do
376
- zbx.usergroups.create(:name => usergroup).should be_kind_of(Integer)
413
+ usergroupid = zbx.usergroups.create(:name => usergroup)
414
+ usergroupid.should be_kind_of(Integer)
377
415
  end
378
416
 
379
417
  it "USERGROUPS: Create or update" do
380
- zbx.usergroups.get_or_create(:name => usergroup).should be_kind_of(Integer)
418
+ zbx.usergroups.get_or_create(:name => usergroup).should eq usergroupid
381
419
  end
382
420
 
383
421
  it "USERGROUPS: Add user" do
384
422
  zbx.usergroups.add_user(
385
423
  :usrgrpids => [zbx.usergroups.get_id(:name => usergroup)],
386
424
  :userids => [zbx.users.get_id(:name => user2)]
387
- ).should be_kind_of(Integer)
425
+ ).should eq usergroupid
388
426
  end
389
427
 
390
428
  it "USERGROUPS: Set UserGroup read & write perm" do
@@ -392,23 +430,24 @@ describe ZabbixApi, "test_api" do
392
430
  :usrgrpid => zbx.usergroups.get_or_create(:name => usergroup).to_s,
393
431
  :hostgroupids => zbx.hostgroups.all.values,
394
432
  :permission => 3
395
- ).should be_kind_of(Integer)
433
+ ).should eq usergroupid
396
434
  end
397
435
 
398
436
  it "MEDIATYPE: Create" do
399
- zbx.mediatypes.create(
437
+ mediatypeid = zbx.mediatypes.create(
400
438
  :description => mediatype,
401
439
  :type => 0,
402
440
  :smtp_server => "127.0.0.1",
403
441
  :smtp_email => "zabbix@test.com"
404
- ).should be_kind_of(Integer)
442
+ )
443
+ mediatypeid.should be_kind_of(Integer)
405
444
  end
406
445
 
407
446
  it "MEDIATYPE: Update or create" do
408
447
  zbx.mediatypes.create_or_update(
409
448
  :description => mediatype,
410
449
  :smtp_email => "zabbix2@test.com"
411
- ).should be_kind_of(Integer)
450
+ ).should eq mediatypeid
412
451
  end
413
452
 
414
453
  it "USER: Add mediatype" do
@@ -423,21 +462,21 @@ describe ZabbixApi, "test_api" do
423
462
  :severity => "56"
424
463
  }
425
464
  ]
426
- ).should be_kind_of(Integer)
465
+ ).should eq userid
427
466
  end
428
467
 
429
468
  it "MEDIATYPE: Delete" do
430
469
  zbx.mediatypes.delete(
431
470
  zbx.mediatypes.get_id(:description => mediatype)
432
- ).should be_kind_of(Integer)
471
+ ).should eq mediatypeid
433
472
  end
434
473
 
435
474
  it "USER: Delete" do
436
- zbx.users.delete(zbx.users.get_id(:name => user2)).should be_kind_of(Integer)
475
+ zbx.users.delete(zbx.users.get_id(:name => user2)).should eq userid
437
476
  end
438
477
 
439
478
  it "USERGROUPS: Delete" do
440
- zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should be_kind_of(Integer)
479
+ zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should eq usergroupid
441
480
  end
442
481
 
443
482
  it "QUERY" do
data/spec/run.rb CHANGED
@@ -1,3 +1,5 @@
1
+ #encoding: utf-8
2
+
1
3
  require 'zabbixapi'
2
4
 
3
5
  # settings
@@ -24,20 +26,34 @@ usergroup = "SomeUserGroup"
24
26
  graph = "graph"
25
27
  mediatype = "somemediatype"
26
28
 
29
+ hostgroupid = 0
30
+ templateid = 0
31
+ applicationid = 0
32
+ itemid = 0
33
+ hostid = 0
34
+ triggerid = 0
35
+ userid = 0
36
+ usergroupid = 0
37
+ graphid = 0
38
+ screenid = 0
39
+ mediatypeid = 0
40
+
41
+
27
42
  puts "### Zabbix API server version #{zbx.server.version} ###"
28
43
 
29
- describe ZabbixApi, "test_api" do
44
+ describe ZabbixApi do
30
45
 
31
46
  it "SERVER: Get version api" do
32
47
  zbx.server.version.should be_kind_of(String)
33
48
  end
34
49
 
35
50
  it "HOSTGROUP: Create" do
36
- zbx.hostgroups.create(:name => hostgroup).should be_kind_of(Integer)
51
+ hostgroupid = zbx.hostgroups.create(:name => hostgroup)
52
+ hostgroupid.should be_kind_of(Integer)
37
53
  end
38
54
 
39
55
  it "HOSTGROUP: Find" do
40
- zbx.hostgroups.get_id(:name => hostgroup).should be_kind_of(Integer)
56
+ zbx.hostgroups.get_id(:name => hostgroup).should eq hostgroupid
41
57
  end
42
58
 
43
59
  it "HOSTGROUP: Find unknown" do
@@ -45,33 +61,38 @@ describe ZabbixApi, "test_api" do
45
61
  end
46
62
 
47
63
  it "HOSTGROUP: Create or get" do
48
- zbx.hostgroups.get_or_create(:name => hostgroup).should be_kind_of(Integer)
64
+ zbx.hostgroups.get_or_create(:name => hostgroup).should eq hostgroupid
65
+ end
66
+
67
+ it "HOSTGROUP: Create or update" do
68
+ zbx.hostgroups.create_or_update(:name => hostgroup).should eq hostgroupid
49
69
  end
50
70
 
51
71
  it "HOSTGROUP: Get all" do
52
- zbx.hostgroups.all.should be_kind_of(Hash)
72
+ zbx.hostgroups.all.should include(hostgroup=>hostgroupid.to_s)
53
73
  end
54
74
 
55
75
  it "TEMPLATE: Create" do
56
- zbx.templates.create(
76
+ templateid = zbx.templates.create(
57
77
  :host => template,
58
78
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
59
- ).should be_kind_of(Integer)
79
+ )
80
+ templateid.should be_kind_of(Integer)
60
81
  end
61
82
 
62
83
  it "TEMPLATE: Get get or create" do
63
84
  zbx.templates.get_or_create(
64
85
  :host => template,
65
86
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
66
- ).should be_kind_of(Integer)
87
+ ).should eq templateid
67
88
  end
68
89
 
69
90
  it "TEMPLATE: Check full data" do
70
- zbx.templates.get_full_data(:host => template)[0]['host'].should be_kind_of(String)
91
+ zbx.templates.get_full_data(:host => template)[0].should include("host"=>template)
71
92
  end
72
93
 
73
94
  it "TEMPLATE: Find" do
74
- zbx.templates.get_id(:host => template).should be_kind_of(Integer)
95
+ zbx.templates.get_id(:host => template).should eq templateid
75
96
  end
76
97
 
77
98
  it "TEMPLATE: Find unknown" do
@@ -79,25 +100,26 @@ describe ZabbixApi, "test_api" do
79
100
  end
80
101
 
81
102
  it "APPLICATION: Create" do
82
- zbx.applications.create(
103
+ applicationid = zbx.applications.create(
83
104
  :name => application,
84
105
  :hostid => zbx.templates.get_id(:host => template)
85
106
  )
107
+ applicationid.should be_kind_of(Integer)
86
108
  end
87
109
 
88
110
  it "APPLICATION: Get or create" do
89
111
  zbx.applications.get_or_create(
90
112
  :name => application,
91
113
  :hostid => zbx.templates.get_id(:host => template)
92
- )
114
+ ).should eq applicationid
93
115
  end
94
116
 
95
117
  it "APPLICATION: Full info check" do
96
- zbx.applications.get_full_data(:name => application)[0]['applicationid'].should be_kind_of(String)
118
+ zbx.applications.get_full_data(:name => application)[0].should include("name"=>application)
97
119
  end
98
120
 
99
121
  it "APPLICATION: Find" do
100
- zbx.applications.get_id(:name => application).should be_kind_of(Integer)
122
+ zbx.applications.get_id(:name => application).should eq applicationid
101
123
  end
102
124
 
103
125
  it "APPLICATION: Find unknown" do
@@ -105,57 +127,69 @@ describe ZabbixApi, "test_api" do
105
127
  end
106
128
 
107
129
  it "ITEM: Create" do
108
- zbx.items.create(
130
+ itemid = zbx.items.create(
109
131
  :description => item,
110
132
  :key_ => "proc.num[aaa]",
111
133
  :hostid => zbx.templates.get_id(:host => template),
112
134
  :applications => [zbx.applications.get_id(:name => application)]
113
- ).should be_kind_of(Integer)
135
+ )
136
+ itemid.should be_kind_of(Integer)
114
137
  end
115
138
 
116
139
  it "ITEM: Full info check" do
117
- zbx.items.get_full_data(:description => item)[0]['itemid'].should be_kind_of(String)
140
+ zbx.items.get_full_data(:description => item)[0].should include("description"=>item)
118
141
  end
119
142
 
120
143
  it "ITEM: Find" do
121
- zbx.items.get_id(:description => item).should be_kind_of(Integer)
144
+ zbx.items.get_id(:description => item).should eq itemid
122
145
  end
123
146
 
124
147
  it "ITEM: Update" do
125
148
  zbx.items.update(
126
149
  :itemid => zbx.items.get_id(:description => item),
127
- :status => 0
128
- ).should be_kind_of(Integer)
150
+ :status => 1
151
+ ).should eq itemid
129
152
  end
130
153
 
131
- it "ITEM: Create or update" do
154
+ it "ITEM: Create or update (update)" do
132
155
  zbx.items.create_or_update(
133
156
  :description => item,
134
157
  :key_ => "proc.num[aaa]",
135
- :type => 6,
158
+ :status => 0,
136
159
  :hostid => zbx.templates.get_id(:host => template),
137
160
  :applications => [zbx.applications.get_id(:name => application)]
138
- ).should be_kind_of(Integer)
161
+ ).should eq itemid
162
+ end
163
+
164
+ it "ITEM: Create or update (create)" do
165
+ zbx.items.create_or_update(
166
+ :description => item + "____1",
167
+ :key_ => "proc.num[aaabb]",
168
+ :status => 0,
169
+ :hostid => zbx.templates.get_id(:host => template),
170
+ :applications => [zbx.applications.get_id(:name => application)]
171
+ ).should eq itemid + 1
139
172
  end
140
173
 
141
174
  it "ITEM: Get unknown" do
142
- zbx.items.get_id(:description => "#{item}_____")
175
+ zbx.items.get_id(:description => "#{item}_____").should be_kind_of(NilClass)
143
176
  end
144
177
 
145
178
  it "HOST: Create" do
146
- zbx.hosts.create(
179
+ hostid = zbx.hosts.create(
147
180
  :host => host,
148
181
  :ip => "10.20.48.88",
149
182
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
150
- ).should be_kind_of(Integer)
183
+ )
184
+ hostid.should be_kind_of(Integer)
151
185
  end
152
186
 
153
- it "HOST: Update or create" do
187
+ it "HOST: Update or create (update)" do
154
188
  zbx.hosts.create_or_update(
155
189
  :host => host,
156
190
  :ip => "10.20.48.89",
157
191
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
158
- ).should be_kind_of(Integer)
192
+ ).should eq hostid
159
193
  end
160
194
 
161
195
  it "HOST: Find unknown" do
@@ -163,20 +197,29 @@ describe ZabbixApi, "test_api" do
163
197
  end
164
198
 
165
199
  it "HOST: Find" do
166
- zbx.hosts.get_id(:host => host).should be_kind_of(Integer)
200
+ zbx.hosts.get_id(:host => host).should eq hostid
167
201
  end
168
202
 
169
203
  it "HOST: Update" do
170
204
  zbx.hosts.update(
171
205
  :hostid => zbx.hosts.get_id(:host => host),
172
206
  :status => 0
173
- )
207
+ ).should eq hostid
208
+ end
209
+
210
+ it "TEMPLATE: Update hosts with templates" do
211
+ zbx.templates.mass_update(
212
+ :hosts_id => [zbx.hosts.get_id(:host => host)],
213
+ :templates_id => [zbx.templates.get_id(:host => template)]
214
+ ).should be_kind_of(TrueClass)
174
215
  end
175
216
 
176
217
  it "TEMPLATE: Get all templates linked with host" do
177
- zbx.templates.get_ids_by_host(
218
+ tmpl_array = zbx.templates.get_ids_by_host(
178
219
  :hostids => [zbx.hosts.get_id(:host => host)]
179
- ).should be_kind_of(Array)
220
+ )
221
+ tmpl_array.should be_kind_of(Array)
222
+ tmpl_array.should include templateid.to_s
180
223
  end
181
224
 
182
225
  it "TEMPLATE: Linked hosts with templates" do
@@ -186,19 +229,12 @@ describe ZabbixApi, "test_api" do
186
229
  ).should be_kind_of(TrueClass)
187
230
  end
188
231
 
189
- it "TEMPLATE: Update hosts with templates" do
190
- zbx.templates.mass_update(
191
- :hosts_id => [zbx.hosts.get_id(:host => host)],
192
- :templates_id => [zbx.templates.get_id(:host => template)]
193
- ).should be_kind_of(TrueClass)
194
- end
195
-
196
232
  it "TEMPLATE: Get all" do
197
- zbx.templates.all.should be_kind_of(Hash)
233
+ zbx.templates.all.should include(template=>templateid.to_s)
198
234
  end
199
235
 
200
236
  it "TRIGGER: Create" do
201
- zbx.triggers.create(
237
+ triggerid = zbx.triggers.create(
202
238
  :description => trigger,
203
239
  :expression => "{#{template}:proc.num[aaa].last(0)}<1",
204
240
  :comments => "Bla-bla is faulty (disaster)",
@@ -206,11 +242,12 @@ describe ZabbixApi, "test_api" do
206
242
  :status => 0,
207
243
  :templateid => 0,
208
244
  :type => 0
209
- ).should be_kind_of(Integer)
245
+ )
246
+ triggerid.should be_kind_of(Integer)
210
247
  end
211
248
 
212
249
  it "TRIGGER: Find" do
213
- zbx.triggers.get_id(:description => trigger).should be_kind_of(Integer)
250
+ zbx.triggers.get_id(:description => trigger).should eq triggerid + 1 # вау блять
214
251
  end
215
252
 
216
253
  it "GRAPH: Create" do
@@ -220,13 +257,14 @@ describe ZabbixApi, "test_api" do
220
257
  :type => "0",
221
258
  :periods_cnt => "5"
222
259
  }
223
- zbx.graphs.create(
260
+ graphid = zbx.graphs.create(
224
261
  :gitems => [gitems],
225
262
  :show_triggers => "0",
226
263
  :name => graph,
227
264
  :width => "900",
228
265
  :height => "200"
229
- ).should be_kind_of(Integer)
266
+ )
267
+ graphid.should be_kind_of(Integer)
230
268
  end
231
269
 
232
270
  it "GRAPH: Create or get" do
@@ -242,7 +280,7 @@ describe ZabbixApi, "test_api" do
242
280
  :name => graph,
243
281
  :width => "900",
244
282
  :height => "200"
245
- ).should be_kind_of(Integer)
283
+ ).should eq graphid
246
284
  end
247
285
 
248
286
  it "GRAPH: Find gititems" do
@@ -250,11 +288,13 @@ describe ZabbixApi, "test_api" do
250
288
  end
251
289
 
252
290
  it "GRAPH: Find" do
253
- zbx.graphs.get_id( :name => graph ).should be_kind_of(Integer)
291
+ zbx.graphs.get_id( :name => graph ).should eq graphid
254
292
  end
255
293
 
256
294
  it "GRAPH: get_ids_by_host" do
257
- zbx.graphs.get_ids_by_host( :host => host ).should be_kind_of(Array)
295
+ graph_array = zbx.graphs.get_ids_by_host( :host => host )
296
+ graph_array.should be_kind_of(Array)
297
+ graph_array.should include(graphid.to_s)
258
298
  end
259
299
 
260
300
  it "GRAPH: Update" do
@@ -264,7 +304,7 @@ describe ZabbixApi, "test_api" do
264
304
  :hostid => zbx.hosts.get_id(:host => host)
265
305
  ),
266
306
  :ymax_type => 1
267
- ).should be_kind_of(Integer)
307
+ ).should eq graphid
268
308
  end
269
309
 
270
310
  it "GRAPH: Create or Update" do
@@ -280,14 +320,15 @@ describe ZabbixApi, "test_api" do
280
320
  :name => graph,
281
321
  :width => "900",
282
322
  :height => "200"
283
- ).should be_kind_of(Integer)
323
+ ).should eq graphid
284
324
  end
285
325
 
286
326
  it "SCREEN: Get or create for host" do
287
- zbx.screens.get_or_create_for_host(
327
+ screenid = zbx.screens.get_or_create_for_host(
288
328
  :host => host,
289
329
  :graphids => zbx.graphs.get_ids_by_host(:host => host)
290
- ).should be_kind_of(Integer)
330
+ )
331
+ screenid.should be_kind_of(Integer)
291
332
  end
292
333
 
293
334
  it "TEMPLATE: Unlink hosts from templates" do
@@ -300,48 +341,49 @@ describe ZabbixApi, "test_api" do
300
341
  it "SCREEN: Delete" do
301
342
  zbx.screens.delete(
302
343
  [zbx.screens.get_id(:name => "#{host}_graphs")]
303
- ).should be_kind_of(Integer)
344
+ ).should eq screenid
304
345
  end
305
346
 
306
347
  it "GRAPH: Delete" do
307
- zbx.graphs.delete(zbx.graphs.get_id(:name => graph)).should be_kind_of(Integer)
348
+ zbx.graphs.delete(zbx.graphs.get_id(:name => graph)).should be_kind_of(TrueClass)
308
349
  end
309
350
 
310
351
  it "TRIGGER: Delete" do
311
- zbx.triggers.delete( zbx.triggers.get_id(:description => trigger) ).should be_kind_of(Integer)
352
+ zbx.triggers.delete( zbx.triggers.get_id(:description => trigger) ).should eq triggerid + 1
312
353
  end
313
354
 
314
355
  it "HOST: Delete" do
315
- zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should be_kind_of(Integer)
356
+ zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should eq hostid
316
357
  end
317
358
 
318
359
  it "ITEM: Delete" do
319
360
  zbx.items.delete(
320
361
  zbx.items.get_id(:description => item)
321
- ).should be_kind_of(Integer)
362
+ ).should eq itemid
322
363
  end
323
364
 
324
365
  it "APPLICATION: Delete" do
325
- zbx.applications.delete( zbx.applications.get_id(:name => application) )
366
+ zbx.applications.delete( zbx.applications.get_id(:name => application) ).should eq applicationid
326
367
  end
327
368
 
328
369
  it "TEMPLATE: Delete" do
329
- zbx.templates.delete(zbx.templates.get_id(:host => template))
370
+ zbx.templates.delete(zbx.templates.get_id(:host => template)).should eq templateid
330
371
  end
331
372
 
332
373
  it "HOSTGROUP: Delete" do
333
374
  zbx.hostgroups.delete(
334
375
  zbx.hostgroups.get_id(:name => hostgroup)
335
- ).should be_kind_of(Integer)
376
+ ).should eq hostgroupid
336
377
  end
337
378
 
338
379
  it "USER: Create" do
339
- zbx.users.create(
380
+ userid = zbx.users.create(
340
381
  :alias => "Test #{user}",
341
382
  :name => user,
342
383
  :surname => user,
343
384
  :passwd => user
344
- ).should be_kind_of(Integer)
385
+ )
386
+ userid.should be_kind_of(Integer)
345
387
  end
346
388
 
347
389
  it "USER: Create or update" do
@@ -350,7 +392,7 @@ describe ZabbixApi, "test_api" do
350
392
  :name => user,
351
393
  :surname => user,
352
394
  :passwd => user
353
- ).should be_kind_of(Integer)
395
+ ).should eq userid
354
396
  end
355
397
 
356
398
  it "USER: Find" do
@@ -362,22 +404,23 @@ describe ZabbixApi, "test_api" do
362
404
  end
363
405
 
364
406
  it "USER: Find unknown" do
365
- zbx.users.get_id(:name => "#{user}_____")
407
+ zbx.users.get_id(:name => "#{user}_____").should be_kind_of(NilClass)
366
408
  end
367
409
 
368
410
  it "USERGROUPS: Create" do
369
- zbx.usergroups.create(:name => usergroup).should be_kind_of(Integer)
411
+ usergroupid = zbx.usergroups.create(:name => usergroup)
412
+ usergroupid.should be_kind_of(Integer)
370
413
  end
371
414
 
372
415
  it "USERGROUPS: Create or update" do
373
- zbx.usergroups.get_or_create(:name => usergroup).should be_kind_of(Integer)
416
+ zbx.usergroups.get_or_create(:name => usergroup).should eq usergroupid
374
417
  end
375
418
 
376
419
  it "USERGROUPS: Add user" do
377
420
  zbx.usergroups.add_user(
378
421
  :usrgrpids => [zbx.usergroups.get_id(:name => usergroup)],
379
422
  :userids => [zbx.users.get_id(:name => user2)]
380
- ).should be_kind_of(Integer)
423
+ ).should eq usergroupid
381
424
  end
382
425
 
383
426
  it "USERGROUPS: Set UserGroup read & write perm" do
@@ -385,23 +428,24 @@ describe ZabbixApi, "test_api" do
385
428
  :usrgrpid => zbx.usergroups.get_or_create(:name => usergroup).to_s,
386
429
  :hostgroupids => zbx.hostgroups.all.values,
387
430
  :permission => 3
388
- ).should be_kind_of(Integer)
431
+ ).should eq usergroupid
389
432
  end
390
433
 
391
434
  it "MEDIATYPE: Create" do
392
- zbx.mediatypes.create(
435
+ mediatypeid = zbx.mediatypes.create(
393
436
  :description => mediatype,
394
437
  :type => 0,
395
438
  :smtp_server => "127.0.0.1",
396
439
  :smtp_email => "zabbix@test.com"
397
- ).should be_kind_of(Integer)
440
+ )
441
+ mediatypeid.should be_kind_of(Integer)
398
442
  end
399
443
 
400
444
  it "MEDIATYPE: Update or create" do
401
445
  zbx.mediatypes.create_or_update(
402
446
  :description => mediatype,
403
447
  :smtp_email => "zabbix2@test.com"
404
- ).should be_kind_of(Integer)
448
+ ).should eq mediatypeid
405
449
  end
406
450
 
407
451
  it "USER: Add mediatype" do
@@ -416,21 +460,21 @@ describe ZabbixApi, "test_api" do
416
460
  :severity => "56"
417
461
  }
418
462
  ]
419
- ).should be_kind_of(Integer)
463
+ ).should eq userid
420
464
  end
421
465
 
422
466
  it "MEDIATYPE: Delete" do
423
467
  zbx.mediatypes.delete(
424
468
  zbx.mediatypes.get_id(:description => mediatype)
425
- ).should be_kind_of(Integer)
469
+ ).should eq mediatypeid
426
470
  end
427
471
 
428
472
  it "USER: Delete" do
429
- zbx.users.delete(zbx.users.get_id(:name => user2)).should be_kind_of(Integer)
473
+ zbx.users.delete(zbx.users.get_id(:name => user2)).should eq userid
430
474
  end
431
475
 
432
476
  it "USERGROUPS: Delete" do
433
- zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should be_kind_of(Integer)
477
+ zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should eq usergroupid
434
478
  end
435
479
 
436
480
  it "QUERY" do
data/zabbixapi.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "zabbixapi/version"
3
+ require 'zabbixapi/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "zabbixapi"
@@ -11,6 +11,8 @@ Gem::Specification.new do |s|
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
+
15
+ s.add_dependency('json')
14
16
 
15
17
  s.rubyforge_project = "zabbixapi"
16
18
 
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: 0.5.1b10
4
+ version: 0.5.1b11
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-19 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-12-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  description: Allows you to work with zabbix api from ruby.
15
31
  email:
16
32
  - vadv.mkn@gmail.com
@@ -63,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
79
  version: '0'
64
80
  segments:
65
81
  - 0
66
- hash: -675997134437473761
82
+ hash: -2676631147213702854
67
83
  required_rubygems_version: !ruby/object:Gem::Requirement
68
84
  none: false
69
85
  requirements: