zabby 0.0.2 → 0.0.4

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.
@@ -0,0 +1,17 @@
1
+ = ChangeLog for Zabby
2
+
3
+ == v0.0.4 (2011/12/21)
4
+
5
+ * Same as v0.0.3 that I could not publish on rubygems.org
6
+
7
+ == v0.0.3 (2011/12/21)
8
+
9
+ * Improve documentation and add all Zabbix API verbs
10
+
11
+ == v0.0.2 (2011/12/20)
12
+
13
+ * First public release.
14
+
15
+ == v0.0.1 (2011/12/18)
16
+
17
+ * Unpublished.
@@ -21,7 +21,7 @@ Zabby has the following caracteristics:
21
21
 
22
22
  - Low level Ruby API that maps every Zabbix API (JSON RPC) to Ruby hashes.
23
23
  - Higher level Ruby DSL, both available in pure Ruby and for writing configuration files.
24
- - Supports authenticated HTTP proxies.
24
+ - Supports SSL and authenticated HTTP proxies.
25
25
  - Full featured IRB like shell included with Readline support. You can mix Zabbix instructions
26
26
  with Ruby calls transparently.
27
27
 
@@ -36,7 +36,7 @@ The barebone API can be used in Ruby like this:
36
36
  require "pp"
37
37
 
38
38
  z = Zabby.init do
39
- host "https://monitoring.example.com"
39
+ server "https://monitoring.example.com"
40
40
  user "api_user"
41
41
  password "s3cr3t"
42
42
  proxy_host "http://10.10.10.10"
@@ -48,7 +48,7 @@ The barebone API can be used in Ruby like this:
48
48
  pp z.connection.perform_request("host", "get", { "filter" => { "host" => "master.example.com" } })
49
49
  pp z.connection.perform_request("item", "get", { "host" => "master.example.com", "output" => "shorten" })
50
50
 
51
- - The _host_, _user_ and _passord_ are necessary.
51
+ - The _server_, _user_ and _passord_ are necessary.
52
52
  - If you don't provide the path to the JSON-RPC script "/api_jsonrpc.php" is appended
53
53
  to the URI automatically.
54
54
  - The <em>proxy_*</em> settings are optionnal.
@@ -71,14 +71,14 @@ to use.
71
71
  ==== Interactive shell
72
72
 
73
73
  # zabbysh
74
- zabby> set host "https://monitoring.example.com"
74
+ zabby> set server "https://monitoring.example.com"
75
75
  zabby> set user "api_user"
76
76
  zabby> set password "s3cr3t"
77
77
  zabby> set proxy_host "http://10.10.10.10"
78
78
  zabby> set proxy_user "john"
79
79
  zabby> set proxy_password "D0e"
80
80
  zabby> login
81
- zabby> logged_in?
81
+ zabby> puts logged_in?
82
82
  zabby> host.get "filter" => { "host" => "monitor.example.com" }, "output" => "extend"
83
83
  zabby> item.get "host" => "monitor.example.com", "output" => "refer"
84
84
  zabby> [...]
@@ -93,7 +93,7 @@ Create a file and put the same instructions as above in it, then execute *zabbys
93
93
 
94
94
  == Requirements
95
95
 
96
- - Ruby 1.8.5. It basically runs anywhere!
96
+ - Ruby 1.8.5. IT BASICALLY RUNS ANYWHERE!
97
97
  - JSON library: 'json' or 'json_pure'
98
98
  - OptionParser
99
99
  - Readline (optionnal, used by the interactive shell)
@@ -102,6 +102,8 @@ Create a file and put the same instructions as above in it, then execute *zabbys
102
102
 
103
103
  - Main web site: http://zabby.org
104
104
  - GitHub projet: https://github.com/Pragmatic-Source/zabby
105
+ - RubyGems.org homepage: https://rubygems.org/gems/zabby
106
+ - Author's company: http://www.pragmatic-source.com
105
107
 
106
108
  == Contributing
107
109
 
data/Rakefile CHANGED
@@ -3,6 +3,8 @@ require 'yard'
3
3
  Bundler::GemHelper.install_tasks
4
4
 
5
5
  YARD::Rake::YardocTask.new do |t|
6
- t.files = ['lib/**/*.rb', '-', 'LICENSE']
6
+ t.files = ['lib/**/*.rb', '-', 'LICENSE', 'TODO.rdoc', 'ChangeLog.rdoc']
7
7
  #t.options = ['--any', '--extra', '--opts'] # optional
8
- end
8
+ end
9
+
10
+ task :default => [ :yard, :install ]
@@ -0,0 +1,12 @@
1
+ = TODO list for Zabby
2
+
3
+ Zabby is still a young projet! There are many features missing and possible improvements:
4
+
5
+ - Document the code with *Yard*
6
+ - Write tests:
7
+ - Use RSpec
8
+ - Use a _webmock_ to simulate a Zabix Server, maybe *VCR*
9
+ - Validate API verbs
10
+ - Betting Exceptions and error handling
11
+ - Add online help to the shell
12
+ - Improve or merge +zabbysh+ and +zabbyrb+
@@ -73,7 +73,7 @@
73
73
 
74
74
  <dt class="r1 last">Defined in:</dt>
75
75
  <dd class="r1 last">lib/zabby/config.rb<span class="defines">,<br />
76
- lib/zabby.rb,<br /> lib/zabby/runner.rb,<br /> lib/zabby/version.rb,<br /> lib/zabby/connection.rb,<br /> lib/zabby/exceptions.rb</span>
76
+ lib/zabby.rb,<br /> lib/zabby/runner.rb,<br /> lib/zabby/zobject.rb,<br /> lib/zabby/version.rb,<br /> lib/zabby/connection.rb,<br /> lib/zabby/exceptions.rb</span>
77
77
  </dd>
78
78
 
79
79
  </dl>
@@ -105,7 +105,7 @@
105
105
 
106
106
 
107
107
 
108
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Zabby/AuthenticationError.html" title="Zabby::AuthenticationError (class)">AuthenticationError</a></span>, <span class='object_link'><a href="Zabby/Config.html" title="Zabby::Config (class)">Config</a></span>, <span class='object_link'><a href="Zabby/ConfigurationError.html" title="Zabby::ConfigurationError (class)">ConfigurationError</a></span>, <span class='object_link'><a href="Zabby/Connection.html" title="Zabby::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Zabby/ResponseCodeError.html" title="Zabby::ResponseCodeError (class)">ResponseCodeError</a></span>, <span class='object_link'><a href="Zabby/Runner.html" title="Zabby::Runner (class)">Runner</a></span>
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Zabby/AuthenticationError.html" title="Zabby::AuthenticationError (class)">AuthenticationError</a></span>, <span class='object_link'><a href="Zabby/Config.html" title="Zabby::Config (class)">Config</a></span>, <span class='object_link'><a href="Zabby/ConfigurationError.html" title="Zabby::ConfigurationError (class)">ConfigurationError</a></span>, <span class='object_link'><a href="Zabby/Connection.html" title="Zabby::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Zabby/ResponseCodeError.html" title="Zabby::ResponseCodeError (class)">ResponseCodeError</a></span>, <span class='object_link'><a href="Zabby/Runner.html" title="Zabby::Runner (class)">Runner</a></span>, <span class='object_link'><a href="Zabby/ZObject.html" title="Zabby::ZObject (class)">ZObject</a></span>
109
109
 
110
110
 
111
111
  </p>
@@ -117,7 +117,7 @@
117
117
  <dt id="VERSION-constant" class="">VERSION =
118
118
 
119
119
  </dt>
120
- <dd><pre class="code"><span class='string val'>&quot;0.0.1&quot;</span>
120
+ <dd><pre class="code"><span class='string val'>&quot;0.0.4&quot;</span>
121
121
  </pre></dd>
122
122
 
123
123
  </dl>
@@ -178,15 +178,15 @@
178
178
  <pre class="lines">
179
179
 
180
180
 
181
- 20
182
- 21
183
- 22</pre>
181
+ 22
182
+ 23
183
+ 24</pre>
184
184
  </td>
185
185
  <td>
186
- <pre class="code"><span class="info file"># File 'lib/zabby.rb', line 20</span>
186
+ <pre class="code"><span class="info file"># File 'lib/zabby.rb', line 22</span>
187
187
 
188
188
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_init identifier id'>init</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
189
- <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_Runner constant id'>Runner</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
189
+ <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_Runner constant id'>Runner</span><span class='dot token'>.</span><span class='rubyid_instance identifier id'>instance</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
190
190
  <span class='rubyid_end end kw'>end</span>
191
191
  </pre>
192
192
  </td>
@@ -199,7 +199,7 @@
199
199
  </div>
200
200
 
201
201
  <div id="footer">
202
- Generated on Mon Dec 19 13:31:47 2011 by
202
+ Generated on Wed Dec 21 12:25:12 2011 by
203
203
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
204
204
  0.7.4 (ruby-1.8.7).
205
205
  </div>
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Mon Dec 19 13:31:46 2011 by
110
+ Generated on Wed Dec 21 12:25:12 2011 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.7.4 (ruby-1.8.7).
113
113
  </div>
@@ -100,7 +100,7 @@
100
100
  <dt id="SETTING_LIST-constant" class="">SETTING_LIST =
101
101
 
102
102
  </dt>
103
- <dd><pre class="code"><span class='dstring node'>%w{host user password proxy_host proxy_user proxy_password}</span>
103
+ <dd><pre class="code"><span class='dstring node'>%w{server user password proxy_host proxy_user proxy_password}</span>
104
104
  </pre></dd>
105
105
 
106
106
  </dl>
@@ -405,7 +405,7 @@ A new instance of Config
405
405
  </div>
406
406
 
407
407
  <div id="footer">
408
- Generated on Mon Dec 19 13:31:46 2011 by
408
+ Generated on Wed Dec 21 12:25:11 2011 by
409
409
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
410
410
  0.7.4 (ruby-1.8.7).
411
411
  </div>
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Mon Dec 19 13:31:47 2011 by
110
+ Generated on Wed Dec 21 12:25:11 2011 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.7.4 (ruby-1.8.7).
113
113
  </div>
@@ -1316,7 +1316,7 @@ Prepare http object
1316
1316
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_login identifier id'>login</span><span class='lparen token'>(</span><span class='rubyid_config identifier id'>config</span><span class='rparen token'>)</span>
1317
1317
  <span class='rubyid_return return kw'>return</span> <span class='rubyid_@auth ivar id'>@auth</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_@auth ivar id'>@auth</span>
1318
1318
 
1319
- <span class='rubyid_@uri ivar id'>@uri</span> <span class='assign token'>=</span> <span class='rubyid_URI constant id'>URI</span><span class='dot token'>.</span><span class='rubyid_parse identifier id'>parse</span><span class='lparen token'>(</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_host identifier id'>host</span><span class='rparen token'>)</span>
1319
+ <span class='rubyid_@uri ivar id'>@uri</span> <span class='assign token'>=</span> <span class='rubyid_URI constant id'>URI</span><span class='dot token'>.</span><span class='rubyid_parse identifier id'>parse</span><span class='lparen token'>(</span><span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_server identifier id'>server</span><span class='rparen token'>)</span>
1320
1320
  <span class='rubyid_@user ivar id'>@user</span> <span class='assign token'>=</span> <span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_user identifier id'>user</span>
1321
1321
  <span class='rubyid_@password ivar id'>@password</span> <span class='assign token'>=</span> <span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_password identifier id'>password</span>
1322
1322
  <span class='rubyid_if if kw'>if</span> <span class='rubyid_config identifier id'>config</span><span class='dot token'>.</span><span class='rubyid_proxy_host identifier id'>proxy_host</span>
@@ -1502,7 +1502,7 @@ Prepare http object
1502
1502
  <span class='rubyid_response identifier id'>response</span> <span class='assign token'>=</span> <span class='rubyid_http identifier id'>http</span><span class='dot token'>.</span><span class='rubyid_request identifier id'>request</span><span class='lparen token'>(</span><span class='rubyid_request identifier id'>request</span><span class='lparen token'>(</span><span class='rubyid_message identifier id'>message</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
1503
1503
 
1504
1504
  <span class='rubyid_if if kw'>if</span> <span class='rubyid_response identifier id'>response</span><span class='dot token'>.</span><span class='rubyid_code identifier id'>code</span> <span class='neq op'>!=</span> <span class='string val'>&quot;200&quot;</span> <span class='rubyid_then then kw'>then</span>
1505
- <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_ResponseCodeError constant id'>ResponseCodeError</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='dstring node'>&quot;Response code from [#{@api_url}] is #{response.code})&quot;</span><span class='rparen token'>)</span>
1505
+ <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_ResponseCodeError constant id'>ResponseCodeError</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='dstring node'>&quot;Response code from [#{@uri}] is #{response.code}): #{response.body}&quot;</span><span class='rparen token'>)</span>
1506
1506
  <span class='rubyid_end end kw'>end</span>
1507
1507
 
1508
1508
  <span class='rubyid_zabbix_response identifier id'>zabbix_response</span> <span class='assign token'>=</span> <span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_parse identifier id'>parse</span><span class='lparen token'>(</span><span class='rubyid_response identifier id'>response</span><span class='dot token'>.</span><span class='rubyid_body identifier id'>body</span><span class='rparen token'>)</span>
@@ -1608,7 +1608,7 @@ Prepare http object
1608
1608
  </div>
1609
1609
 
1610
1610
  <div id="footer">
1611
- Generated on Mon Dec 19 13:31:46 2011 by
1611
+ Generated on Wed Dec 21 12:25:12 2011 by
1612
1612
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1613
1613
  0.7.4 (ruby-1.8.7).
1614
1614
  </div>
@@ -107,7 +107,7 @@
107
107
  </div>
108
108
 
109
109
  <div id="footer">
110
- Generated on Mon Dec 19 13:31:46 2011 by
110
+ Generated on Wed Dec 21 12:25:12 2011 by
111
111
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
112
112
  0.7.4 (ruby-1.8.7).
113
113
  </div>
@@ -83,17 +83,22 @@
83
83
 
84
84
 
85
85
 
86
+ <dt class="r2">Includes:</dt>
87
+ <dd class="r2">Singleton</dd>
88
+
89
+
86
90
 
87
91
 
88
92
 
89
- <dt class="r2 last">Defined in:</dt>
90
- <dd class="r2 last">lib/zabby/runner.rb</dd>
93
+ <dt class="r1 last">Defined in:</dt>
94
+ <dd class="r1 last">lib/zabby/runner.rb</dd>
91
95
 
92
96
  </dl>
93
97
  <div class="clear"></div>
94
98
 
95
99
 
96
100
 
101
+
97
102
  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
98
103
  <ul class="summary">
99
104
 
@@ -155,10 +160,11 @@ Returns the value of attribute connection.
155
160
 
156
161
 
157
162
 
163
+
158
164
 
159
165
 
160
166
  <h2>
161
- Instance Method Summary
167
+ Class Method Summary
162
168
  <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
163
169
  </h2>
164
170
 
@@ -167,7 +173,7 @@ Returns the value of attribute connection.
167
173
  <li class="public ">
168
174
  <span class="summary_signature">
169
175
 
170
- <a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(args) </a>
176
+ <a href="#create_zobject-class_method" title="create_zobject (class method)">+ (Object) <strong>create_zobject</strong>(name, zmethods) </a>
171
177
 
172
178
 
173
179
 
@@ -180,31 +186,22 @@ Returns the value of attribute connection.
180
186
 
181
187
 
182
188
 
183
- <span class="summary_desc"><div class='inline'></div></span>
189
+ <span class="summary_desc"><div class='inline'><p>
190
+ Create a method mapping a Zabbix object.
191
+ </p>
192
+ </div></span>
184
193
 
185
194
  </li>
186
195
 
187
196
 
188
- <li class="public ">
189
- <span class="summary_signature">
190
-
191
- <a href="#host-instance_method" title="#host (instance method)">- (Object) <strong>host</strong>(args) </a>
192
-
193
-
194
-
195
- </span>
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
- <span class="summary_desc"><div class='inline'></div></span>
197
+ </ul>
205
198
 
206
- </li>
199
+ <h2>
200
+ Instance Method Summary
201
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
202
+ </h2>
207
203
 
204
+ <ul class="summary">
208
205
 
209
206
  <li class="public ">
210
207
  <span class="summary_signature">
@@ -406,7 +403,8 @@ Execute an irb like shell in which we can type Zabby commands.
406
403
  </ul>
407
404
 
408
405
 
409
- <div id="constructor_details" class="method_details_list">
406
+
407
+ <div id="constructor_details" class="method_details_list">
410
408
  <h2>Constructor Details</h2>
411
409
 
412
410
  <div class="method_details first">
@@ -434,30 +432,32 @@ A new instance of Runner
434
432
  <pre class="lines">
435
433
 
436
434
 
437
- 37
438
- 38
439
- 39
440
- 40
441
- 41
442
- 42
443
- 43
444
- 44
445
- 45
446
- 46
447
- 47
448
- 48
449
- 49
450
- 50
451
- 51
452
- 52</pre>
435
+ 75
436
+ 76
437
+ 77
438
+ 78
439
+ 79
440
+ 80
441
+ 81
442
+ 82
443
+ 83
444
+ 84
445
+ 85
446
+ 86
447
+ 87
448
+ 88
449
+ 89
450
+ 90
451
+ 91</pre>
453
452
  </td>
454
453
  <td>
455
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 37</span>
454
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 75</span>
456
455
 
457
456
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
458
457
  <span class='rubyid_@config ivar id'>@config</span> <span class='assign token'>=</span> <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_Config constant id'>Config</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
459
458
  <span class='rubyid_@connection ivar id'>@connection</span> <span class='assign token'>=</span> <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_Connection constant id'>Connection</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span>
460
459
  <span class='rubyid_@pure_binding ivar id'>@pure_binding</span> <span class='assign token'>=</span> <span class='rubyid_instance_eval identifier id'>instance_eval</span> <span class='string val'>&quot;binding&quot;</span>
460
+ <span class='rubyid_@zobject ivar id'>@zobject</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span> <span class='comment val'># List of Zabbix Object</span>
461
461
 
462
462
  <span class='rubyid_if if kw'>if</span> <span class='rubyid_Object constant id'>Object</span><span class='dot token'>.</span><span class='rubyid_const_defined? fid id'>const_defined?</span><span class='lparen token'>(</span><span class='symbol val'>:Readline</span><span class='rparen token'>)</span>
463
463
  <span class='rubyid_@readline ivar id'>@readline</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span>
@@ -509,12 +509,12 @@ Returns the value of attribute config
509
509
  <pre class="lines">
510
510
 
511
511
 
512
- 15
513
- 16
514
- 17</pre>
512
+ 18
513
+ 19
514
+ 20</pre>
515
515
  </td>
516
516
  <td>
517
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 15</span>
517
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 18</span>
518
518
 
519
519
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_config identifier id'>config</span>
520
520
  <span class='rubyid_@config ivar id'>@config</span>
@@ -553,12 +553,12 @@ Returns the value of attribute connection
553
553
  <pre class="lines">
554
554
 
555
555
 
556
- 15
557
- 16
558
- 17</pre>
556
+ 18
557
+ 19
558
+ 20</pre>
559
559
  </td>
560
560
  <td>
561
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 15</span>
561
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 18</span>
562
562
 
563
563
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_connection identifier id'>connection</span>
564
564
  <span class='rubyid_@connection ivar id'>@connection</span>
@@ -572,20 +572,23 @@ Returns the value of attribute connection
572
572
  </div>
573
573
 
574
574
 
575
- <div id="instance_method_details" class="method_details_list">
576
- <h2>Instance Method Details</h2>
575
+ <div id="class_method_details" class="method_details_list">
576
+ <h2>Class Method Details</h2>
577
577
 
578
578
 
579
579
  <div class="method_details first">
580
- <p class="signature first" id="get-instance_method">
580
+ <p class="signature first" id="create_zobject-class_method">
581
581
 
582
- - (<tt>Object</tt>) <strong>get</strong>(args)
582
+ + (<tt>Object</tt>) <strong>create_zobject</strong>(name, zmethods)
583
583
 
584
584
 
585
585
 
586
586
  </p><div class="docstring">
587
587
  <div class="discussion">
588
-
588
+ <p>
589
+ Create a method mapping a Zabbix object.
590
+ </p>
591
+
589
592
 
590
593
  </div>
591
594
  </div>
@@ -595,90 +598,33 @@ Returns the value of attribute connection
595
598
 
596
599
  <li>
597
600
 
598
- <span class='name'>args</span>
601
+ <span class='name'>name</span>
599
602
 
600
603
 
601
- <span class='type'>(<tt>Hash</tt>)</span>
604
+ <span class='type'>(<tt>Symbol</tt>)</span>
602
605
 
603
606
 
604
607
 
605
608
  &mdash;
606
609
  <div class='inline'><p>
607
- Argument list for the Zabbix API.
610
+ Zabbix Object name (:item, :host, etc.)
608
611
  </p>
609
612
  </div>
610
613
 
611
614
  </li>
612
615
 
613
- </ul>
614
-
615
- <h3>Raises:</h3>
616
- <ul class="raise">
617
-
618
- <li>
619
-
620
-
621
- <span class='type'>(<tt>ArgumentError</tt>)</span>
622
-
623
-
624
-
625
- </li>
626
-
627
- </ul>
628
-
629
- </div><table class="source_code">
630
- <tr>
631
- <td>
632
- <pre class="lines">
633
-
634
-
635
- 87
636
- 88
637
- 89
638
- 90</pre>
639
- </td>
640
- <td>
641
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 87</span>
642
-
643
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_get identifier id'>get</span><span class='lparen token'>(</span><span class='rubyid_args identifier id'>args</span><span class='rparen token'>)</span>
644
- <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_ArgumentError constant id'>ArgumentError</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='string val'>&quot;Expected a hash&quot;</span><span class='rparen token'>)</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_kind_of? fid id'>kind_of?</span> <span class='rubyid_Hash constant id'>Hash</span>
645
- <span class='lbrace token'>{</span> <span class='symbol val'>:get</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='rubyid_args identifier id'>args</span> <span class='rbrace token'>}</span>
646
- <span class='rubyid_end end kw'>end</span>
647
- </pre>
648
- </td>
649
- </tr>
650
- </table>
651
- </div>
652
-
653
- <div class="method_details ">
654
- <p class="signature " id="host-instance_method">
655
-
656
- - (<tt>Object</tt>) <strong>host</strong>(args)
657
-
658
-
659
-
660
- </p><div class="docstring">
661
- <div class="discussion">
662
-
663
-
664
- </div>
665
- </div>
666
- <div class="tags">
667
- <h3>Parameters:</h3>
668
- <ul class="param">
669
-
670
616
  <li>
671
617
 
672
- <span class='name'>args</span>
618
+ <span class='name'>zmethods</span>
673
619
 
674
620
 
675
- <span class='type'>(<tt>Hash</tt>)</span>
621
+ <span class='type'>(<tt>Array</tt>)</span>
676
622
 
677
623
 
678
624
 
679
625
  &mdash;
680
626
  <div class='inline'><p>
681
- Function name and parameters for the Zabbix &quot;host&quot; type.
627
+ The list of supported verbs
682
628
  </p>
683
629
  </div>
684
630
 
@@ -686,19 +632,6 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
686
632
 
687
633
  </ul>
688
634
 
689
- <h3>Raises:</h3>
690
- <ul class="raise">
691
-
692
- <li>
693
-
694
-
695
- <span class='type'>(<tt>ArgumentError</tt>)</span>
696
-
697
-
698
-
699
- </li>
700
-
701
- </ul>
702
635
 
703
636
  </div><table class="source_code">
704
637
  <tr>
@@ -706,21 +639,19 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
706
639
  <pre class="lines">
707
640
 
708
641
 
709
- 93
710
- 94
711
- 95
712
- 96
713
- 97
714
- 98</pre>
642
+ 43
643
+ 44
644
+ 45
645
+ 46
646
+ 47</pre>
715
647
  </td>
716
648
  <td>
717
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 93</span>
649
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 43</span>
718
650
 
719
- <span class='rubyid_def def kw'>def</span> <span class='rubyid_host identifier id'>host</span><span class='lparen token'>(</span><span class='rubyid_args identifier id'>args</span><span class='rparen token'>)</span>
720
- <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_ArgumentError constant id'>ArgumentError</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='string val'>&quot;Expected a hash&quot;</span><span class='rparen token'>)</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_kind_of? fid id'>kind_of?</span> <span class='rubyid_Hash constant id'>Hash</span>
721
- <span class='rubyid_meth identifier id'>meth</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_keys identifier id'>keys</span><span class='dot token'>.</span><span class='rubyid_first identifier id'>first</span>
722
- <span class='rubyid_params identifier id'>params</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='lbrack token'>[</span><span class='rubyid_meth identifier id'>meth</span><span class='rbrack token'>]</span>
723
- <span class='rubyid_puts identifier id'>puts</span> <span class='dstring node'>&quot;Calling method 'host.#{meth}' with arguments #{params.to_json}&quot;</span>
651
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_create_zobject identifier id'>create_zobject</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span><span class='comma token'>,</span> <span class='rubyid_zmethods identifier id'>zmethods</span><span class='rparen token'>)</span>
652
+ <span class='rubyid_define_method identifier id'>define_method</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
653
+ <span class='rubyid_@zobject ivar id'>@zobject</span><span class='lbrack token'>[</span><span class='rubyid_name identifier id'>name</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_ZObject constant id'>ZObject</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span><span class='comma token'>,</span> <span class='rubyid_zmethods identifier id'>zmethods</span><span class='rparen token'>)</span>
654
+ <span class='rubyid_end end kw'>end</span>
724
655
  <span class='rubyid_end end kw'>end</span>
725
656
  </pre>
726
657
  </td>
@@ -728,8 +659,14 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
728
659
  </table>
729
660
  </div>
730
661
 
731
- <div class="method_details ">
732
- <p class="signature " id="logged_in?-instance_method">
662
+ </div>
663
+
664
+ <div id="instance_method_details" class="method_details_list">
665
+ <h2>Instance Method Details</h2>
666
+
667
+
668
+ <div class="method_details first">
669
+ <p class="signature first" id="logged_in?-instance_method">
733
670
 
734
671
  - (<tt>Boolean</tt>) <strong>logged_in?</strong>
735
672
 
@@ -763,12 +700,12 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
763
700
  <pre class="lines">
764
701
 
765
702
 
766
- 78
767
- 79
768
- 80</pre>
703
+ 117
704
+ 118
705
+ 119</pre>
769
706
  </td>
770
707
  <td>
771
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 78</span>
708
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 117</span>
772
709
 
773
710
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_logged_in? fid id'>logged_in?</span>
774
711
  <span class='rubyid_@connection ivar id'>@connection</span><span class='dot token'>.</span><span class='rubyid_logged_in? fid id'>logged_in?</span>
@@ -792,12 +729,12 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
792
729
  <pre class="lines">
793
730
 
794
731
 
795
- 70
796
- 71
797
- 72</pre>
732
+ 109
733
+ 110
734
+ 111</pre>
798
735
  </td>
799
736
  <td>
800
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 70</span>
737
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 109</span>
801
738
 
802
739
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_login identifier id'>login</span>
803
740
  <span class='rubyid_@connection ivar id'>@connection</span><span class='dot token'>.</span><span class='rubyid_login identifier id'>login</span><span class='lparen token'>(</span><span class='rubyid_@config ivar id'>@config</span><span class='rparen token'>)</span>
@@ -821,12 +758,12 @@ Function name and parameters for the Zabbix &quot;host&quot; type.
821
758
  <pre class="lines">
822
759
 
823
760
 
824
- 74
825
- 75
826
- 76</pre>
761
+ 113
762
+ 114
763
+ 115</pre>
827
764
  </td>
828
765
  <td>
829
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 74</span>
766
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 113</span>
830
767
 
831
768
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_logout identifier id'>logout</span>
832
769
  <span class='rubyid_@connection ivar id'>@connection</span><span class='dot token'>.</span><span class='rubyid_logout identifier id'>logout</span>
@@ -899,16 +836,16 @@ A block containing commands to execute.
899
836
  <pre class="lines">
900
837
 
901
838
 
902
- 102
903
- 103
904
- 104
905
- 105
906
- 106
907
- 107
908
- 108</pre>
839
+ 127
840
+ 128
841
+ 129
842
+ 130
843
+ 131
844
+ 132
845
+ 133</pre>
909
846
  </td>
910
847
  <td>
911
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 102</span>
848
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 127</span>
912
849
 
913
850
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_run identifier id'>run</span><span class='lparen token'>(</span><span class='rubyid_command_file identifier id'>command_file</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
914
851
  <span class='rubyid_unless unless kw'>unless</span> <span class='rubyid_command_file identifier id'>command_file</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
@@ -936,20 +873,20 @@ A block containing commands to execute.
936
873
  <pre class="lines">
937
874
 
938
875
 
939
- 58
940
- 59
941
- 60
942
- 61
943
- 62
944
- 63
945
- 64
946
- 65
947
- 66
948
- 67
949
- 68</pre>
876
+ 97
877
+ 98
878
+ 99
879
+ 100
880
+ 101
881
+ 102
882
+ 103
883
+ 104
884
+ 105
885
+ 106
886
+ 107</pre>
950
887
  </td>
951
888
  <td>
952
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 58</span>
889
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 97</span>
953
890
 
954
891
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_set identifier id'>set</span><span class='lparen token'>(</span><span class='rubyid_key_value identifier id'>key_value</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
955
892
  <span class='rubyid_if if kw'>if</span> <span class='rubyid_key_value identifier id'>key_value</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
@@ -981,12 +918,12 @@ A block containing commands to execute.
981
918
  <pre class="lines">
982
919
 
983
920
 
984
- 54
985
- 55
986
- 56</pre>
921
+ 93
922
+ 94
923
+ 95</pre>
987
924
  </td>
988
925
  <td>
989
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 54</span>
926
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 93</span>
990
927
 
991
928
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_setup identifier id'>setup</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
992
929
  <span class='rubyid_@config ivar id'>@config</span><span class='dot token'>.</span><span class='rubyid_setup identifier id'>setup</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span>
@@ -1035,28 +972,32 @@ Execute an irb like shell in which we can type Zabby commands.
1035
972
  <pre class="lines">
1036
973
 
1037
974
 
1038
- 111
1039
- 112
1040
- 113
1041
- 114
1042
- 115
1043
- 116
1044
- 117
1045
- 118
1046
- 119
1047
- 120
1048
- 121
1049
- 122
1050
- 123
1051
- 124</pre>
975
+ 136
976
+ 137
977
+ 138
978
+ 139
979
+ 140
980
+ 141
981
+ 142
982
+ 143
983
+ 144
984
+ 145
985
+ 146
986
+ 147
987
+ 148
988
+ 149
989
+ 150
990
+ 151</pre>
1052
991
  </td>
1053
992
  <td>
1054
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 111</span>
993
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 136</span>
1055
994
 
1056
995
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_shell identifier id'>shell</span>
1057
996
  <span class='rubyid_raise identifier id'>raise</span> <span class='rubyid_RuntimeError constant id'>RuntimeError</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='string val'>&quot;Shell cannot run because 'readline' is missing.&quot;</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_@readline ivar id'>@readline</span>
1058
997
 
1059
- <span class='rubyid_puts identifier id'>puts</span> <span class='string val'>&quot;** This is an experimental Zabbix Shell. Multiline commands do not work for e.g. **&quot;</span>
998
+ <span class='rubyid_puts identifier id'>puts</span> <span class='dstring node'>&quot;Zabby Shell #{Zabby::VERSION}&quot;</span>
999
+ <span class='rubyid_puts identifier id'>puts</span>
1000
+ <span class='rubyid_puts identifier id'>puts</span> <span class='string val'>&quot;** This is a simple irb like Zabbix Shell. Multiline commands do not work for e.g. **&quot;</span>
1060
1001
  <span class='rubyid_loop identifier id'>loop</span> <span class='rubyid_do do kw'>do</span>
1061
1002
  <span class='rubyid_cmd identifier id'>cmd</span> <span class='assign token'>=</span> <span class='rubyid_Readline constant id'>Readline</span><span class='dot token'>.</span><span class='rubyid_readline identifier id'>readline</span><span class='lparen token'>(</span><span class='string val'>'zabby&gt; '</span><span class='rparen token'>)</span>
1062
1003
 
@@ -1086,12 +1027,12 @@ Execute an irb like shell in which we can type Zabby commands.
1086
1027
  <pre class="lines">
1087
1028
 
1088
1029
 
1089
- 82
1090
- 83
1091
- 84</pre>
1030
+ 121
1031
+ 122
1032
+ 123</pre>
1092
1033
  </td>
1093
1034
  <td>
1094
- <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 82</span>
1035
+ <pre class="code"><span class="info file"># File 'lib/zabby/runner.rb', line 121</span>
1095
1036
 
1096
1037
  <span class='rubyid_def def kw'>def</span> <span class='rubyid_version identifier id'>version</span>
1097
1038
  <span class='rubyid_Zabby constant id'>Zabby</span><span class='colon2 op'>::</span><span class='rubyid_VERSION constant id'>VERSION</span>
@@ -1107,7 +1048,7 @@ Execute an irb like shell in which we can type Zabby commands.
1107
1048
  </div>
1108
1049
 
1109
1050
  <div id="footer">
1110
- Generated on Mon Dec 19 13:31:47 2011 by
1051
+ Generated on Wed Dec 21 12:25:13 2011 by
1111
1052
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1112
1053
  0.7.4 (ruby-1.8.7).
1113
1054
  </div>