zabbix_sender_api 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,461 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Zabbix::Sender::Pipe
8
+
9
+ &mdash; Documentation by YARD 0.9.26
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Zabbix::Sender::Pipe";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (P)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Zabbix.html" title="Zabbix (module)">Zabbix</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Sender.html" title="Zabbix::Sender (module)">Sender</a></span></span>
41
+ &raquo;
42
+ <span class="title">Pipe</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Zabbix::Sender::Pipe
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span></li>
78
+
79
+ <li class="next">Zabbix::Sender::Pipe</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/zabbix_sender_api/api.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Pipe instances utilize communication to a running instance of zabbix_sender via a pipe to STDIN. If you want your program to send data itself (as opposed to say printing stdin lines that you can then pipe to zabbix_sender yourself), you&#39;ll want to make an instance of this</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary</h2>
122
+
123
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span></h3>
124
+ <p class="inherited"><span class='object_link'><a href="Connection.html#pipe-instance_method" title="Zabbix::Sender::Connection#pipe (method)">#pipe</a></span>, <span class='object_link'><a href="Connection.html#targetHost-instance_method" title="Zabbix::Sender::Connection#targetHost (method)">#targetHost</a></span></p>
125
+
126
+
127
+
128
+ <h2>
129
+ Instance Method Summary
130
+ <small><a href="#" class="summary_toggle">collapse</a></small>
131
+ </h2>
132
+
133
+ <ul class="summary">
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#flush-instance_method" title="#flush (instance method)">#<strong>flush</strong> &#x21d2; Object </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>Closes the open3 pipe stuff.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(proxy: Zabbix::AgentConfiguration.zabbixProxy, path: &#39;zabbix_sender&#39;) &#x21d2; Pipe </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+ <span class="note title constructor">constructor</span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+ <span class="summary_desc"><div class='inline'>
179
+ <p>Create a new Pipe object.</p>
180
+ </div></span>
181
+
182
+ </li>
183
+
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#open-instance_method" title="#open (instance method)">#<strong>open</strong> &#x21d2; Object </a>
189
+
190
+
191
+
192
+ </span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'>
203
+ <p>Opens a pipe to the zabbix_sender command with appropriate options specified.</p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#sendBatch-instance_method" title="#sendBatch (instance method)">#<strong>sendBatch</strong>(aBatch) &#x21d2; Object </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'>
227
+ <p>Send a Batch instance to zabbix (via zabbix_sender).</p>
228
+ </div></span>
229
+
230
+ </li>
231
+
232
+
233
+ </ul>
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span></h3>
246
+ <p class="inherited"><span class='object_link'><a href="Connection.html#sendBatchAtomic-instance_method" title="Zabbix::Sender::Connection#sendBatchAtomic (method)">#sendBatchAtomic</a></span></p>
247
+ <div id="constructor_details" class="method_details_list">
248
+ <h2>Constructor Details</h2>
249
+
250
+ <div class="method_details first">
251
+ <h3 class="signature first" id="initialize-instance_method">
252
+
253
+ #<strong>initialize</strong>(proxy: Zabbix::AgentConfiguration.zabbixProxy, path: &#39;zabbix_sender&#39;) &#x21d2; <tt><span class='object_link'><a href="" title="Zabbix::Sender::Pipe (class)">Pipe</a></span></tt>
254
+
255
+
256
+
257
+
258
+
259
+ </h3><div class="docstring">
260
+ <div class="discussion">
261
+
262
+ <p>Create a new Pipe object. Both proxy: and path: are optional.</p>
263
+
264
+ <p>An attempt is made to provide sane default values. If you have a zabbix_agentd.conf file in one of the usual places and zabbix_sender is on your path, it&#39;ll probably just work</p>
265
+
266
+
267
+ </div>
268
+ </div>
269
+ <div class="tags">
270
+
271
+
272
+ </div><table class="source_code">
273
+ <tr>
274
+ <td>
275
+ <pre class="lines">
276
+
277
+
278
+ 192
279
+ 193
280
+ 194
281
+ 195
282
+ 196</pre>
283
+ </td>
284
+ <td>
285
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 192</span>
286
+
287
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>proxy:</span> <span class='const'><span class='object_link'><a href="../../Zabbix.html" title="Zabbix (module)">Zabbix</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../AgentConfiguration.html" title="Zabbix::AgentConfiguration (class)">AgentConfiguration</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zabbixProxy'><span class='object_link'><a href="../AgentConfiguration.html#zabbixProxy-class_method" title="Zabbix::AgentConfiguration.zabbixProxy (method)">zabbixProxy</a></span></span><span class='comma'>,</span> <span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>zabbix_sender</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
288
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='label'>proxy:</span> <span class='id identifier rubyid_proxy'>proxy</span><span class='rparen'>)</span>
289
+ <span class='ivar'>@wait_thr</span> <span class='op'>=</span> <span class='ivar'>@stdout</span> <span class='op'>=</span> <span class='ivar'>@stderr</span> <span class='op'>=</span> <span class='kw'>nil</span>
290
+ <span class='ivar'>@exePath</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
291
+ <span class='kw'>end</span></pre>
292
+ </td>
293
+ </tr>
294
+ </table>
295
+ </div>
296
+
297
+ </div>
298
+
299
+
300
+ <div id="instance_method_details" class="method_details_list">
301
+ <h2>Instance Method Details</h2>
302
+
303
+
304
+ <div class="method_details first">
305
+ <h3 class="signature first" id="flush-instance_method">
306
+
307
+ #<strong>flush</strong> &#x21d2; <tt>Object</tt>
308
+
309
+
310
+
311
+
312
+
313
+ </h3><div class="docstring">
314
+ <div class="discussion">
315
+
316
+ <p>Closes the open3 pipe stuff. We need this override method as closing an open3 pipe requires some extra work.</p>
317
+
318
+
319
+ </div>
320
+ </div>
321
+ <div class="tags">
322
+
323
+
324
+ </div><table class="source_code">
325
+ <tr>
326
+ <td>
327
+ <pre class="lines">
328
+
329
+
330
+ 213
331
+ 214
332
+ 215
333
+ 216
334
+ 217
335
+ 218
336
+ 219
337
+ 220
338
+ 221
339
+ 222</pre>
340
+ </td>
341
+ <td>
342
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 213</span>
343
+
344
+ <span class='kw'>def</span> <span class='id identifier rubyid_flush'>flush</span>
345
+ <span class='kw'>if</span> <span class='ivar'>@pipe</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='ivar'>@pipe</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
346
+ <span class='ivar'>@pipe</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
347
+ <span class='id identifier rubyid_stdout'>stdout</span> <span class='op'>=</span> <span class='ivar'>@stdout</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
348
+ <span class='id identifier rubyid_stderr'>stderr</span> <span class='op'>=</span> <span class='ivar'>@stderr</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
349
+ <span class='ivar'>@stdout</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
350
+ <span class='ivar'>@stderr</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
351
+ <span class='kw'>return</span> <span class='lbrace'>{</span><span class='label'>stdout:</span> <span class='id identifier rubyid_stdout'>stdout</span><span class='comma'>,</span> <span class='label'>stderr:</span> <span class='id identifier rubyid_stderr'>stderr</span><span class='comma'>,</span> <span class='label'>success:</span> <span class='ivar'>@wait_thr</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_success?'>success?</span><span class='rbrace'>}</span>
352
+ <span class='kw'>end</span>
353
+ <span class='kw'>end</span></pre>
354
+ </td>
355
+ </tr>
356
+ </table>
357
+ </div>
358
+
359
+ <div class="method_details ">
360
+ <h3 class="signature " id="open-instance_method">
361
+
362
+ #<strong>open</strong> &#x21d2; <tt>Object</tt>
363
+
364
+
365
+
366
+
367
+
368
+ </h3><div class="docstring">
369
+ <div class="discussion">
370
+
371
+ <p>Opens a pipe to the zabbix_sender command with appropriate options specified. If the pipe is already opened when this command is called, it is first closed via a call to flush</p>
372
+
373
+
374
+ </div>
375
+ </div>
376
+ <div class="tags">
377
+
378
+
379
+ </div><table class="source_code">
380
+ <tr>
381
+ <td>
382
+ <pre class="lines">
383
+
384
+
385
+ 203
386
+ 204
387
+ 205
388
+ 206
389
+ 207
390
+ 208</pre>
391
+ </td>
392
+ <td>
393
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 203</span>
394
+
395
+ <span class='kw'>def</span> <span class='id identifier rubyid_open'>open</span>
396
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
397
+ <span class='comment'>#@pipe = IO.popen(%Q(#{@exePath} -z #{@targetHost} -vv -T -i-),&#39;w&#39;)
398
+ </span> <span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>%Q(</span><span class='embexpr_beg'>#{</span><span class='ivar'>@exePath</span><span class='embexpr_end'>}</span><span class='tstring_content'> -z </span><span class='embexpr_beg'>#{</span><span class='ivar'>@targetHost</span><span class='embexpr_end'>}</span><span class='tstring_content'> -vv -T -i-</span><span class='tstring_end'>)</span></span>
399
+ <span class='ivar'>@pipe</span><span class='comma'>,</span><span class='ivar'>@stdout</span><span class='comma'>,</span><span class='ivar'>@stderr</span><span class='comma'>,</span><span class='ivar'>@wait_thr</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_popen3'>popen3</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rparen'>)</span>
400
+ <span class='kw'>end</span></pre>
401
+ </td>
402
+ </tr>
403
+ </table>
404
+ </div>
405
+
406
+ <div class="method_details ">
407
+ <h3 class="signature " id="sendBatch-instance_method">
408
+
409
+ #<strong>sendBatch</strong>(aBatch) &#x21d2; <tt>Object</tt>
410
+
411
+
412
+
413
+
414
+
415
+ </h3><div class="docstring">
416
+ <div class="discussion">
417
+
418
+ <p>Send a Batch instance to zabbix (via zabbix_sender). This assumes that the pipe is already open.</p>
419
+
420
+
421
+ </div>
422
+ </div>
423
+ <div class="tags">
424
+
425
+
426
+ </div><table class="source_code">
427
+ <tr>
428
+ <td>
429
+ <pre class="lines">
430
+
431
+
432
+ 227
433
+ 228
434
+ 229
435
+ 230</pre>
436
+ </td>
437
+ <td>
438
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 227</span>
439
+
440
+ <span class='kw'>def</span> <span class='id identifier rubyid_sendBatch'>sendBatch</span><span class='lparen'>(</span><span class='id identifier rubyid_aBatch'>aBatch</span><span class='rparen'>)</span>
441
+ <span class='comment'># Assumes that the pipe is open
442
+ </span> <span class='ivar'>@pipe</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span><span class='lparen'>(</span><span class='id identifier rubyid_aBatch'>aBatch</span><span class='period'>.</span><span class='id identifier rubyid_to_senderline'>to_senderline</span><span class='rparen'>)</span>
443
+ <span class='kw'>end</span></pre>
444
+ </td>
445
+ </tr>
446
+ </table>
447
+ </div>
448
+
449
+ </div>
450
+
451
+ </div>
452
+
453
+ <div id="footer">
454
+ Generated on Sat Sep 11 00:00:06 2021 by
455
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
456
+ 0.9.26 (ruby-2.7.4).
457
+ </div>
458
+
459
+ </div>
460
+ </body>
461
+ </html>