zabby 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.rdoc +17 -0
- data/README.rdoc +8 -6
- data/Rakefile +4 -2
- data/TODO.rdoc +12 -0
- data/doc/Zabby.html +9 -9
- data/doc/Zabby/AuthenticationError.html +1 -1
- data/doc/Zabby/Config.html +2 -2
- data/doc/Zabby/ConfigurationError.html +1 -1
- data/doc/Zabby/Connection.html +3 -3
- data/doc/Zabby/ResponseCodeError.html +1 -1
- data/doc/Zabby/Runner.html +142 -201
- data/doc/Zabby/ZObject.html +480 -0
- data/doc/_index.html +14 -1
- data/doc/class_list.html +1 -1
- data/doc/file.ChangeLog.html +91 -0
- data/doc/file.LICENSE.html +1 -1
- data/doc/file.README.html +52 -15
- data/doc/file.TODO.html +99 -0
- data/doc/file_list.html +6 -0
- data/doc/index.html +52 -15
- data/doc/method_list.html +70 -46
- data/doc/top-level-namespace.html +1 -1
- data/lib/zabby/runner.rb +28 -3
- data/lib/zabby/version.rb +1 -1
- data/lib/zabby/zobject.rb +5 -1
- metadata +8 -3
data/doc/method_list.html
CHANGED
@@ -73,65 +73,65 @@
|
|
73
73
|
|
74
74
|
|
75
75
|
<li class="r1 ">
|
76
|
-
<span class='object_link'><a href="Zabby/
|
76
|
+
<span class='object_link'><a href="Zabby/Runner.html#create_zobject-class_method" title="Zabby::Runner.create_zobject (method)">create_zobject</a></span>
|
77
77
|
|
78
|
-
<small>Zabby::
|
78
|
+
<small>Zabby::Runner</small>
|
79
79
|
|
80
80
|
</li>
|
81
81
|
|
82
82
|
|
83
83
|
<li class="r2 ">
|
84
|
-
<span class='object_link'><a href="Zabby/
|
84
|
+
<span class='object_link'><a href="Zabby/Connection.html#format_message-instance_method" title="Zabby::Connection#format_message (method)">#format_message</a></span>
|
85
85
|
|
86
|
-
<small>Zabby::
|
86
|
+
<small>Zabby::Connection</small>
|
87
87
|
|
88
88
|
</li>
|
89
89
|
|
90
90
|
|
91
91
|
<li class="r1 ">
|
92
|
-
<span class='object_link'><a href="Zabby/
|
92
|
+
<span class='object_link'><a href="Zabby/Connection.html#http-instance_method" title="Zabby::Connection#http (method)">#http</a></span>
|
93
93
|
|
94
|
-
<small>Zabby::
|
94
|
+
<small>Zabby::Connection</small>
|
95
95
|
|
96
96
|
</li>
|
97
97
|
|
98
98
|
|
99
99
|
<li class="r2 ">
|
100
|
-
<span class='object_link'><a href="Zabby
|
100
|
+
<span class='object_link'><a href="Zabby.html#init-class_method" title="Zabby.init (method)">init</a></span>
|
101
101
|
|
102
|
-
<small>Zabby
|
102
|
+
<small>Zabby</small>
|
103
103
|
|
104
104
|
</li>
|
105
105
|
|
106
106
|
|
107
107
|
<li class="r1 ">
|
108
|
-
<span class='object_link'><a href="Zabby.html#
|
108
|
+
<span class='object_link'><a href="Zabby/Config.html#initialize-instance_method" title="Zabby::Config#initialize (method)">#initialize</a></span>
|
109
109
|
|
110
|
-
<small>Zabby</small>
|
110
|
+
<small>Zabby::Config</small>
|
111
111
|
|
112
112
|
</li>
|
113
113
|
|
114
114
|
|
115
115
|
<li class="r2 ">
|
116
|
-
<span class='object_link'><a href="Zabby/
|
116
|
+
<span class='object_link'><a href="Zabby/Runner.html#initialize-instance_method" title="Zabby::Runner#initialize (method)">#initialize</a></span>
|
117
117
|
|
118
|
-
<small>Zabby::
|
118
|
+
<small>Zabby::Runner</small>
|
119
119
|
|
120
120
|
</li>
|
121
121
|
|
122
122
|
|
123
123
|
<li class="r1 ">
|
124
|
-
<span class='object_link'><a href="Zabby/
|
124
|
+
<span class='object_link'><a href="Zabby/Connection.html#initialize-instance_method" title="Zabby::Connection#initialize (method)">#initialize</a></span>
|
125
125
|
|
126
|
-
<small>Zabby::
|
126
|
+
<small>Zabby::Connection</small>
|
127
127
|
|
128
128
|
</li>
|
129
129
|
|
130
130
|
|
131
131
|
<li class="r2 ">
|
132
|
-
<span class='object_link'><a href="Zabby/
|
132
|
+
<span class='object_link'><a href="Zabby/ZObject.html#initialize-instance_method" title="Zabby::ZObject#initialize (method)">#initialize</a></span>
|
133
133
|
|
134
|
-
<small>Zabby::
|
134
|
+
<small>Zabby::ZObject</small>
|
135
135
|
|
136
136
|
</li>
|
137
137
|
|
@@ -145,49 +145,49 @@
|
|
145
145
|
|
146
146
|
|
147
147
|
<li class="r2 ">
|
148
|
-
<span class='object_link'><a href="Zabby/
|
148
|
+
<span class='object_link'><a href="Zabby/Connection.html#logged_in%3F-instance_method" title="Zabby::Connection#logged_in? (method)">#logged_in?</a></span>
|
149
149
|
|
150
|
-
<small>Zabby::
|
150
|
+
<small>Zabby::Connection</small>
|
151
151
|
|
152
152
|
</li>
|
153
153
|
|
154
154
|
|
155
155
|
<li class="r1 ">
|
156
|
-
<span class='object_link'><a href="Zabby/
|
156
|
+
<span class='object_link'><a href="Zabby/Runner.html#logged_in%3F-instance_method" title="Zabby::Runner#logged_in? (method)">#logged_in?</a></span>
|
157
157
|
|
158
|
-
<small>Zabby::
|
158
|
+
<small>Zabby::Runner</small>
|
159
159
|
|
160
160
|
</li>
|
161
161
|
|
162
162
|
|
163
163
|
<li class="r2 ">
|
164
|
-
<span class='object_link'><a href="Zabby/
|
164
|
+
<span class='object_link'><a href="Zabby/Runner.html#login-instance_method" title="Zabby::Runner#login (method)">#login</a></span>
|
165
165
|
|
166
|
-
<small>Zabby::
|
166
|
+
<small>Zabby::Runner</small>
|
167
167
|
|
168
168
|
</li>
|
169
169
|
|
170
170
|
|
171
171
|
<li class="r1 ">
|
172
|
-
<span class='object_link'><a href="Zabby/
|
172
|
+
<span class='object_link'><a href="Zabby/Connection.html#login-instance_method" title="Zabby::Connection#login (method)">#login</a></span>
|
173
173
|
|
174
|
-
<small>Zabby::
|
174
|
+
<small>Zabby::Connection</small>
|
175
175
|
|
176
176
|
</li>
|
177
177
|
|
178
178
|
|
179
179
|
<li class="r2 ">
|
180
|
-
<span class='object_link'><a href="Zabby/
|
180
|
+
<span class='object_link'><a href="Zabby/Runner.html#logout-instance_method" title="Zabby::Runner#logout (method)">#logout</a></span>
|
181
181
|
|
182
|
-
<small>Zabby::
|
182
|
+
<small>Zabby::Runner</small>
|
183
183
|
|
184
184
|
</li>
|
185
185
|
|
186
186
|
|
187
187
|
<li class="r1 ">
|
188
|
-
<span class='object_link'><a href="Zabby/
|
188
|
+
<span class='object_link'><a href="Zabby/Connection.html#logout-instance_method" title="Zabby::Connection#logout (method)">#logout</a></span>
|
189
189
|
|
190
|
-
<small>Zabby::
|
190
|
+
<small>Zabby::Connection</small>
|
191
191
|
|
192
192
|
</li>
|
193
193
|
|
@@ -201,6 +201,14 @@
|
|
201
201
|
|
202
202
|
|
203
203
|
<li class="r1 ">
|
204
|
+
<span class='object_link'><a href="Zabby/ZObject.html#method_missing-instance_method" title="Zabby::ZObject#method_missing (method)">#method_missing</a></span>
|
205
|
+
|
206
|
+
<small>Zabby::ZObject</small>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
<li class="r2 ">
|
204
212
|
<span class='object_link'><a href="Zabby/Connection.html#next_request_id-instance_method" title="Zabby::Connection#next_request_id (method)">#next_request_id</a></span>
|
205
213
|
|
206
214
|
<small>Zabby::Connection</small>
|
@@ -208,7 +216,7 @@
|
|
208
216
|
</li>
|
209
217
|
|
210
218
|
|
211
|
-
<li class="
|
219
|
+
<li class="r1 ">
|
212
220
|
<span class='object_link'><a href="Zabby/Connection.html#password-instance_method" title="Zabby::Connection#password (method)">#password</a></span>
|
213
221
|
|
214
222
|
<small>Zabby::Connection</small>
|
@@ -216,7 +224,7 @@
|
|
216
224
|
</li>
|
217
225
|
|
218
226
|
|
219
|
-
<li class="
|
227
|
+
<li class="r2 ">
|
220
228
|
<span class='object_link'><a href="Zabby/Connection.html#perform_request-instance_method" title="Zabby::Connection#perform_request (method)">#perform_request</a></span>
|
221
229
|
|
222
230
|
<small>Zabby::Connection</small>
|
@@ -224,7 +232,7 @@
|
|
224
232
|
</li>
|
225
233
|
|
226
234
|
|
227
|
-
<li class="
|
235
|
+
<li class="r1 ">
|
228
236
|
<span class='object_link'><a href="Zabby/Connection.html#proxy_host-instance_method" title="Zabby::Connection#proxy_host (method)">#proxy_host</a></span>
|
229
237
|
|
230
238
|
<small>Zabby::Connection</small>
|
@@ -232,7 +240,7 @@
|
|
232
240
|
</li>
|
233
241
|
|
234
242
|
|
235
|
-
<li class="
|
243
|
+
<li class="r2 ">
|
236
244
|
<span class='object_link'><a href="Zabby/Connection.html#proxy_password-instance_method" title="Zabby::Connection#proxy_password (method)">#proxy_password</a></span>
|
237
245
|
|
238
246
|
<small>Zabby::Connection</small>
|
@@ -240,7 +248,7 @@
|
|
240
248
|
</li>
|
241
249
|
|
242
250
|
|
243
|
-
<li class="
|
251
|
+
<li class="r1 ">
|
244
252
|
<span class='object_link'><a href="Zabby/Connection.html#proxy_user-instance_method" title="Zabby::Connection#proxy_user (method)">#proxy_user</a></span>
|
245
253
|
|
246
254
|
<small>Zabby::Connection</small>
|
@@ -248,7 +256,7 @@
|
|
248
256
|
</li>
|
249
257
|
|
250
258
|
|
251
|
-
<li class="
|
259
|
+
<li class="r2 ">
|
252
260
|
<span class='object_link'><a href="Zabby/Connection.html#query_zabbix_rpc-instance_method" title="Zabby::Connection#query_zabbix_rpc (method)">#query_zabbix_rpc</a></span>
|
253
261
|
|
254
262
|
<small>Zabby::Connection</small>
|
@@ -256,7 +264,7 @@
|
|
256
264
|
</li>
|
257
265
|
|
258
266
|
|
259
|
-
<li class="
|
267
|
+
<li class="r1 ">
|
260
268
|
<span class='object_link'><a href="Zabby/Connection.html#request-instance_method" title="Zabby::Connection#request (method)">#request</a></span>
|
261
269
|
|
262
270
|
<small>Zabby::Connection</small>
|
@@ -264,7 +272,7 @@
|
|
264
272
|
</li>
|
265
273
|
|
266
274
|
|
267
|
-
<li class="
|
275
|
+
<li class="r2 ">
|
268
276
|
<span class='object_link'><a href="Zabby/Connection.html#request_id-instance_method" title="Zabby::Connection#request_id (method)">#request_id</a></span>
|
269
277
|
|
270
278
|
<small>Zabby::Connection</small>
|
@@ -272,7 +280,7 @@
|
|
272
280
|
</li>
|
273
281
|
|
274
282
|
|
275
|
-
<li class="
|
283
|
+
<li class="r1 ">
|
276
284
|
<span class='object_link'><a href="Zabby/Connection.html#request_path-instance_method" title="Zabby::Connection#request_path (method)">#request_path</a></span>
|
277
285
|
|
278
286
|
<small>Zabby::Connection</small>
|
@@ -280,7 +288,7 @@
|
|
280
288
|
</li>
|
281
289
|
|
282
290
|
|
283
|
-
<li class="
|
291
|
+
<li class="r2 ">
|
284
292
|
<span class='object_link'><a href="Zabby/Connection.html#reset-instance_method" title="Zabby::Connection#reset (method)">#reset</a></span>
|
285
293
|
|
286
294
|
<small>Zabby::Connection</small>
|
@@ -288,7 +296,7 @@
|
|
288
296
|
</li>
|
289
297
|
|
290
298
|
|
291
|
-
<li class="
|
299
|
+
<li class="r1 ">
|
292
300
|
<span class='object_link'><a href="Zabby/Runner.html#run-instance_method" title="Zabby::Runner#run (method)">#run</a></span>
|
293
301
|
|
294
302
|
<small>Zabby::Runner</small>
|
@@ -296,7 +304,7 @@
|
|
296
304
|
</li>
|
297
305
|
|
298
306
|
|
299
|
-
<li class="
|
307
|
+
<li class="r2 ">
|
300
308
|
<span class='object_link'><a href="Zabby/Runner.html#set-instance_method" title="Zabby::Runner#set (method)">#set</a></span>
|
301
309
|
|
302
310
|
<small>Zabby::Runner</small>
|
@@ -304,7 +312,7 @@
|
|
304
312
|
</li>
|
305
313
|
|
306
314
|
|
307
|
-
<li class="
|
315
|
+
<li class="r1 ">
|
308
316
|
<span class='object_link'><a href="Zabby/Runner.html#setup-instance_method" title="Zabby::Runner#setup (method)">#setup</a></span>
|
309
317
|
|
310
318
|
<small>Zabby::Runner</small>
|
@@ -312,7 +320,7 @@
|
|
312
320
|
</li>
|
313
321
|
|
314
322
|
|
315
|
-
<li class="
|
323
|
+
<li class="r2 ">
|
316
324
|
<span class='object_link'><a href="Zabby/Config.html#setup-instance_method" title="Zabby::Config#setup (method)">#setup</a></span>
|
317
325
|
|
318
326
|
<small>Zabby::Config</small>
|
@@ -320,7 +328,7 @@
|
|
320
328
|
</li>
|
321
329
|
|
322
330
|
|
323
|
-
<li class="
|
331
|
+
<li class="r1 ">
|
324
332
|
<span class='object_link'><a href="Zabby/Runner.html#shell-instance_method" title="Zabby::Runner#shell (method)">#shell</a></span>
|
325
333
|
|
326
334
|
<small>Zabby::Runner</small>
|
@@ -328,7 +336,7 @@
|
|
328
336
|
</li>
|
329
337
|
|
330
338
|
|
331
|
-
<li class="
|
339
|
+
<li class="r2 ">
|
332
340
|
<span class='object_link'><a href="Zabby/Connection.html#uri-instance_method" title="Zabby::Connection#uri (method)">#uri</a></span>
|
333
341
|
|
334
342
|
<small>Zabby::Connection</small>
|
@@ -336,7 +344,7 @@
|
|
336
344
|
</li>
|
337
345
|
|
338
346
|
|
339
|
-
<li class="
|
347
|
+
<li class="r1 ">
|
340
348
|
<span class='object_link'><a href="Zabby/Connection.html#user-instance_method" title="Zabby::Connection#user (method)">#user</a></span>
|
341
349
|
|
342
350
|
<small>Zabby::Connection</small>
|
@@ -344,7 +352,7 @@
|
|
344
352
|
</li>
|
345
353
|
|
346
354
|
|
347
|
-
<li class="
|
355
|
+
<li class="r2 ">
|
348
356
|
<span class='object_link'><a href="Zabby/Runner.html#version-instance_method" title="Zabby::Runner#version (method)">#version</a></span>
|
349
357
|
|
350
358
|
<small>Zabby::Runner</small>
|
@@ -352,6 +360,22 @@
|
|
352
360
|
</li>
|
353
361
|
|
354
362
|
|
363
|
+
<li class="r1 ">
|
364
|
+
<span class='object_link'><a href="Zabby/ZObject.html#zmethods-instance_method" title="Zabby::ZObject#zmethods (method)">#zmethods</a></span>
|
365
|
+
|
366
|
+
<small>Zabby::ZObject</small>
|
367
|
+
|
368
|
+
</li>
|
369
|
+
|
370
|
+
|
371
|
+
<li class="r2 ">
|
372
|
+
<span class='object_link'><a href="Zabby/ZObject.html#zname-instance_method" title="Zabby::ZObject#zname (method)">#zname</a></span>
|
373
|
+
|
374
|
+
<small>Zabby::ZObject</small>
|
375
|
+
|
376
|
+
</li>
|
377
|
+
|
378
|
+
|
355
379
|
</ul>
|
356
380
|
</div>
|
357
381
|
</body>
|
data/lib/zabby/runner.rb
CHANGED
@@ -26,7 +26,7 @@ module Zabby
|
|
26
26
|
# All the created method does is return the second form which will be
|
27
27
|
# used by "set".
|
28
28
|
Zabby::Config::SETTING_LIST.each { |setting|
|
29
|
-
# TODO: Ruby 1.8 does not support default values for block arguments..
|
29
|
+
# TODO.rdoc: Ruby 1.8 does not support default values for block arguments..
|
30
30
|
# Writing "... do |value = nil|" would be more elegant.
|
31
31
|
define_method(setting) do |*args|
|
32
32
|
if args.empty?
|
@@ -37,15 +37,40 @@ module Zabby
|
|
37
37
|
end
|
38
38
|
}
|
39
39
|
|
40
|
+
# Create a method mapping a Zabbix object.
|
41
|
+
# @param [Symbol] name Zabbix Object name (:item, :host, etc.)
|
42
|
+
# @param [Array] zmethods The list of supported verbs
|
40
43
|
def self.create_zobject(name, zmethods)
|
41
44
|
define_method(name) do
|
42
45
|
@zobject[name] ||= Zabby::ZObject.new(name, zmethods)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
46
|
-
|
47
|
-
create_zobject(:
|
49
|
+
# Create all Zabbix object types and theirs verbs.
|
50
|
+
create_zobject(:action, [ :create, :delete, :exists, :get, :update ])
|
51
|
+
create_zobject(:alert, [ :create, :delete, :get ])
|
48
52
|
create_zobject(:apiinfo, [ :version ])
|
53
|
+
create_zobject(:application, [ :create, :delete, :exists, :get, :massAdd, :update ])
|
54
|
+
create_zobject(:event, [ :acknowledge, :create, :delete, :get ])
|
55
|
+
create_zobject(:graph, [ :create, :delete, :exists, :get, :update ])
|
56
|
+
create_zobject(:graphitem, [ :get ])
|
57
|
+
create_zobject(:history, [ :delete, :get ])
|
58
|
+
create_zobject(:host, [ :create, :delete, :exists, :get, :update ])
|
59
|
+
create_zobject(:hostgroup, [ :create, :delete, :exists, :get, :massAdd, :massRemove, :massUpdate, :update ])
|
60
|
+
create_zobject(:image, [ :create, :delete, :exists, :get, :update ])
|
61
|
+
create_zobject(:item, [ :create, :delete, :exists, :get, :update ])
|
62
|
+
create_zobject(:maintenance, [ :create, :delete, :exists, :get, :update ])
|
63
|
+
create_zobject(:map, [ :create, :delete, :exists, :get, :update ])
|
64
|
+
create_zobject(:mediatype, [ :create, :delete, :get, :update ])
|
65
|
+
create_zobject(:proxy, [ :get ])
|
66
|
+
create_zobject(:screen, [ :create, :delete, :get, :update ])
|
67
|
+
create_zobject(:script, [ :create, :delete, :execute, :get, :update ])
|
68
|
+
create_zobject(:template, [ :create, :delete, :exists, :get, :massAdd, :massRemove, :massUpdate, :update ])
|
69
|
+
create_zobject(:trigger, [ :addDependencies, :create, :delete, :deleteDependencies, :exists, :get, :update ])
|
70
|
+
create_zobject(:user, [ :addMedia, :authenticate, :create, :delete, :deleteMedia, :get, :login, :logout, :update, :updateMedia, :updateProfile ])
|
71
|
+
create_zobject(:usergroup, [ :create, :delete, :exists, :get, :massAdd, :massRemove, :massUpdate, :update ])
|
72
|
+
create_zobject(:usermacro, [ :createGlobal, :deleteGlobal, :deleteHostMacro, :get, :massAdd, :massRemove, :massUpdate, :updateGlobal ])
|
73
|
+
create_zobject(:usermedia, [ :get ])
|
49
74
|
|
50
75
|
def initialize &block
|
51
76
|
@config = Zabby::Config.new &block
|
data/lib/zabby/version.rb
CHANGED
data/lib/zabby/zobject.rb
CHANGED
@@ -8,6 +8,10 @@ module Zabby
|
|
8
8
|
class ZObject
|
9
9
|
attr_reader :zname, :zmethods
|
10
10
|
|
11
|
+
# Define the Zabbix object name and associated methods
|
12
|
+
#
|
13
|
+
# @param [String] zname Zabbix Object name
|
14
|
+
# @param [Array] zmethods List of associated methods
|
11
15
|
def initialize(zname, zmethods)
|
12
16
|
@zname = zname
|
13
17
|
@zmethods = zmethods.map { |f| f.to_sym }
|
@@ -15,7 +19,7 @@ module Zabby
|
|
15
19
|
|
16
20
|
# Simulate methods on the object.
|
17
21
|
# For example: "host.get", "item.create"..
|
18
|
-
# @zmethods is the list of valid methods.
|
22
|
+
# The instance variable @zmethods is the list of valid methods.
|
19
23
|
def method_missing(zmethod, *args, &block)
|
20
24
|
if @zmethods.include? zmethod
|
21
25
|
Zabby::Runner.instance.connection.perform_request(@zname, zmethod, args.first)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Farzad FARID
|
@@ -95,10 +95,12 @@ extra_rdoc_files: []
|
|
95
95
|
|
96
96
|
files:
|
97
97
|
- .gitignore
|
98
|
+
- ChangeLog.rdoc
|
98
99
|
- Gemfile
|
99
100
|
- LICENSE
|
100
101
|
- README.rdoc
|
101
102
|
- Rakefile
|
103
|
+
- TODO.rdoc
|
102
104
|
- bin/zabbyrb
|
103
105
|
- bin/zabbysh
|
104
106
|
- doc/Zabby.html
|
@@ -108,13 +110,16 @@ files:
|
|
108
110
|
- doc/Zabby/Connection.html
|
109
111
|
- doc/Zabby/ResponseCodeError.html
|
110
112
|
- doc/Zabby/Runner.html
|
113
|
+
- doc/Zabby/ZObject.html
|
111
114
|
- doc/_index.html
|
112
115
|
- doc/class_list.html
|
113
116
|
- doc/css/common.css
|
114
117
|
- doc/css/full_list.css
|
115
118
|
- doc/css/style.css
|
119
|
+
- doc/file.ChangeLog.html
|
116
120
|
- doc/file.LICENSE.html
|
117
121
|
- doc/file.README.html
|
122
|
+
- doc/file.TODO.html
|
118
123
|
- doc/file_list.html
|
119
124
|
- doc/frames.html
|
120
125
|
- doc/index.html
|