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.
- 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/ChangeLog.rdoc
ADDED
@@ -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.
|
data/README.rdoc
CHANGED
@@ -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
|
-
|
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
|
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
|
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.
|
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 ]
|
data/TODO.rdoc
ADDED
@@ -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+
|
data/doc/Zabby.html
CHANGED
@@ -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'>"0.0.
|
120
|
+
<dd><pre class="code"><span class='string val'>"0.0.4"</span>
|
121
121
|
</pre></dd>
|
122
122
|
|
123
123
|
</dl>
|
@@ -178,15 +178,15 @@
|
|
178
178
|
<pre class="lines">
|
179
179
|
|
180
180
|
|
181
|
-
|
182
|
-
|
183
|
-
|
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
|
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'>&</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='
|
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'>&</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
|
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
|
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>
|
data/doc/Zabby/Config.html
CHANGED
@@ -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{
|
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
|
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
|
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>
|
data/doc/Zabby/Connection.html
CHANGED
@@ -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='
|
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'>"200"</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'>"Response code from [#{@
|
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'>"Response code from [#{@uri}] is #{response.code}): #{response.body}"</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
|
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
|
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>
|
data/doc/Zabby/Runner.html
CHANGED
@@ -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="
|
90
|
-
<dd class="
|
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
|
-
|
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="#
|
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'
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
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
|
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'>&</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'>&</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'>"binding"</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
|
-
|
513
|
-
|
514
|
-
|
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
|
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
|
-
|
557
|
-
|
558
|
-
|
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
|
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="
|
576
|
-
<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="
|
580
|
+
<p class="signature first" id="create_zobject-class_method">
|
581
581
|
|
582
|
-
|
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'>
|
601
|
+
<span class='name'>name</span>
|
599
602
|
|
600
603
|
|
601
|
-
<span class='type'>(<tt>
|
604
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
602
605
|
|
603
606
|
|
604
607
|
|
605
608
|
—
|
606
609
|
<div class='inline'><p>
|
607
|
-
|
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'>"Expected a hash"</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'>></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'>
|
618
|
+
<span class='name'>zmethods</span>
|
673
619
|
|
674
620
|
|
675
|
-
<span class='type'>(<tt>
|
621
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
676
622
|
|
677
623
|
|
678
624
|
|
679
625
|
—
|
680
626
|
<div class='inline'><p>
|
681
|
-
|
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 "host" 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 "host" type.
|
|
706
639
|
<pre class="lines">
|
707
640
|
|
708
641
|
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
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
|
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='
|
720
|
-
<span class='
|
721
|
-
|
722
|
-
<span class='
|
723
|
-
<span class='rubyid_puts identifier id'>puts</span> <span class='dstring node'>"Calling method 'host.#{meth}' with arguments #{params.to_json}"</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 "host" type.
|
|
728
659
|
</table>
|
729
660
|
</div>
|
730
661
|
|
731
|
-
|
732
|
-
|
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 "host" type.
|
|
763
700
|
<pre class="lines">
|
764
701
|
|
765
702
|
|
766
|
-
|
767
|
-
|
768
|
-
|
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
|
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 "host" type.
|
|
792
729
|
<pre class="lines">
|
793
730
|
|
794
731
|
|
795
|
-
|
796
|
-
|
797
|
-
|
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
|
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 "host" type.
|
|
821
758
|
<pre class="lines">
|
822
759
|
|
823
760
|
|
824
|
-
|
825
|
-
|
826
|
-
|
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
|
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
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
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
|
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'>&</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
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
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
|
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
|
-
|
985
|
-
|
986
|
-
|
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
|
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'>&</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'>&</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
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
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
|
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'>"Shell cannot run because 'readline' is missing."</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='
|
998
|
+
<span class='rubyid_puts identifier id'>puts</span> <span class='dstring node'>"Zabby Shell #{Zabby::VERSION}"</span>
|
999
|
+
<span class='rubyid_puts identifier id'>puts</span>
|
1000
|
+
<span class='rubyid_puts identifier id'>puts</span> <span class='string val'>"** This is a simple irb like Zabbix Shell. Multiline commands do not work for e.g. **"</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> '</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
|
-
|
1090
|
-
|
1091
|
-
|
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
|
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
|
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>
|