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,597 @@
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::Discovery
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::Discovery";
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 (D)</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">Discovery</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::Discovery
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="ItemData.html" title="Zabbix::Sender::ItemData (class)">ItemData</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="ItemData.html" title="Zabbix::Sender::ItemData (class)">ItemData</a></span></li>
78
+
79
+ <li class="next">Zabbix::Sender::Discovery</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>Discovery instances are a special type of ItemData that you will typically create and hang on to as you accumulate (discover) related entities. You then pass the discover instance into a Batch via addDiscovery(), which includes it in the batch of data just like an ordinary ItemData instance.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
120
+ <ul class="summary">
121
+
122
+ <li class="public ">
123
+ <span class="summary_signature">
124
+
125
+ <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Object </a>
126
+
127
+
128
+
129
+ </span>
130
+
131
+
132
+
133
+
134
+ <span class="note title readonly">readonly</span>
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ <span class="summary_desc"><div class='inline'>
145
+ <p>Returns the value of attribute entities.</p>
146
+ </div></span>
147
+
148
+ </li>
149
+
150
+
151
+ </ul>
152
+
153
+
154
+
155
+
156
+
157
+ <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ItemData.html" title="Zabbix::Sender::ItemData (class)">ItemData</a></span></h3>
158
+ <p class="inherited"><span class='object_link'><a href="ItemData.html#hostname-instance_method" title="Zabbix::Sender::ItemData#hostname (method)">#hostname</a></span>, <span class='object_link'><a href="ItemData.html#key-instance_method" title="Zabbix::Sender::ItemData#key (method)">#key</a></span>, <span class='object_link'><a href="ItemData.html#timestamp-instance_method" title="Zabbix::Sender::ItemData#timestamp (method)">#timestamp</a></span>, <span class='object_link'><a href="ItemData.html#value-instance_method" title="Zabbix::Sender::ItemData#value (method)">#value</a></span></p>
159
+
160
+
161
+
162
+ <h2>
163
+ Instance Method Summary
164
+ <small><a href="#" class="summary_toggle">collapse</a></small>
165
+ </h2>
166
+
167
+ <ul class="summary">
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#add_entity-instance_method" title="#add_entity (instance method)">#<strong>add_entity</strong>(aHash) &#x21d2; Object </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>This is how you pass data to zabbix that you use to construct items from item templates.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(key: nil, value: nil, timestamp: nil, hostname: nil) &#x21d2; Discovery </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+ <span class="note title constructor">constructor</span>
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+ <span class="summary_desc"><div class='inline'>
213
+ <p>The only required parameter is key:, which is the discovery rule key.</p>
214
+ </div></span>
215
+
216
+ </li>
217
+
218
+
219
+ <li class="public ">
220
+ <span class="summary_signature">
221
+
222
+ <a href="#to_discodata-instance_method" title="#to_discodata (instance method)">#<strong>to_discodata</strong> &#x21d2; Object </a>
223
+
224
+
225
+
226
+ </span>
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <span class="summary_desc"><div class='inline'>
237
+ <p>Render this discovery as the structure an external discovery script should return.</p>
238
+ </div></span>
239
+
240
+ </li>
241
+
242
+
243
+ <li class="public ">
244
+ <span class="summary_signature">
245
+
246
+ <a href="#to_senderline-instance_method" title="#to_senderline (instance method)">#<strong>to_senderline</strong> &#x21d2; Object </a>
247
+
248
+
249
+
250
+ </span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <span class="summary_desc"><div class='inline'>
261
+ <p>Render this discovery instance as a zabbix_sender line.</p>
262
+ </div></span>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="public ">
268
+ <span class="summary_signature">
269
+
270
+ <a href="#to_senderstruct-instance_method" title="#to_senderstruct (instance method)">#<strong>to_senderstruct</strong> &#x21d2; Object </a>
271
+
272
+
273
+
274
+ </span>
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+ <span class="summary_desc"><div class='inline'>
285
+ <p>Render this discovery instance as an object suitable for conversion to json for socket transmission.</p>
286
+ </div></span>
287
+
288
+ </li>
289
+
290
+
291
+ </ul>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+ <div id="constructor_details" class="method_details_list">
301
+ <h2>Constructor Details</h2>
302
+
303
+ <div class="method_details first">
304
+ <h3 class="signature first" id="initialize-instance_method">
305
+
306
+ #<strong>initialize</strong>(key: nil, value: nil, timestamp: nil, hostname: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Zabbix::Sender::Discovery (class)">Discovery</a></span></tt>
307
+
308
+
309
+
310
+
311
+
312
+ </h3><div class="docstring">
313
+ <div class="discussion">
314
+
315
+ <p>The only required parameter is key:, which is the discovery rule key.</p>
316
+
317
+
318
+ </div>
319
+ </div>
320
+ <div class="tags">
321
+
322
+
323
+ </div><table class="source_code">
324
+ <tr>
325
+ <td>
326
+ <pre class="lines">
327
+
328
+
329
+ 298
330
+ 299
331
+ 300
332
+ 301</pre>
333
+ </td>
334
+ <td>
335
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 298</span>
336
+
337
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>key:</span> <span class='kw'>nil</span><span class='comma'>,</span><span class='label'>value:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>timestamp:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>hostname:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
338
+ <span class='kw'>super</span>
339
+ <span class='ivar'>@entities</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
340
+ <span class='kw'>end</span></pre>
341
+ </td>
342
+ </tr>
343
+ </table>
344
+ </div>
345
+
346
+ </div>
347
+
348
+ <div id="instance_attr_details" class="attr_details">
349
+ <h2>Instance Attribute Details</h2>
350
+
351
+
352
+ <span id=""></span>
353
+ <div class="method_details first">
354
+ <h3 class="signature first" id="entities-instance_method">
355
+
356
+ #<strong>entities</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
357
+
358
+
359
+
360
+
361
+
362
+ </h3><div class="docstring">
363
+ <div class="discussion">
364
+
365
+ <p>Returns the value of attribute entities.</p>
366
+
367
+
368
+ </div>
369
+ </div>
370
+ <div class="tags">
371
+
372
+
373
+ </div><table class="source_code">
374
+ <tr>
375
+ <td>
376
+ <pre class="lines">
377
+
378
+
379
+ 294
380
+ 295
381
+ 296</pre>
382
+ </td>
383
+ <td>
384
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 294</span>
385
+
386
+ <span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span>
387
+ <span class='ivar'>@entities</span>
388
+ <span class='kw'>end</span></pre>
389
+ </td>
390
+ </tr>
391
+ </table>
392
+ </div>
393
+
394
+ </div>
395
+
396
+
397
+ <div id="instance_method_details" class="method_details_list">
398
+ <h2>Instance Method Details</h2>
399
+
400
+
401
+ <div class="method_details first">
402
+ <h3 class="signature first" id="add_entity-instance_method">
403
+
404
+ #<strong>add_entity</strong>(aHash) &#x21d2; <tt>Object</tt>
405
+
406
+
407
+
408
+
409
+
410
+ </h3><div class="docstring">
411
+ <div class="discussion">
412
+
413
+ <p>This is how you pass data to zabbix that you use to construct items from item templates. Pass in as many key-value pairs as you need. You&#39;ll reference these in the item prototype like #MYKEY</p>
414
+
415
+ <p>Note that the keys (which you can pass as symbols if you want) are forced to uppercase. This is here because the author once spent way too much time trying to figure out why discovery wasn&#39;t working right one day. All caps seems to fix the issue.</p>
416
+
417
+
418
+ </div>
419
+ </div>
420
+ <div class="tags">
421
+
422
+
423
+ </div><table class="source_code">
424
+ <tr>
425
+ <td>
426
+ <pre class="lines">
427
+
428
+
429
+ 310
430
+ 311
431
+ 312
432
+ 313
433
+ 314
434
+ 315
435
+ 316
436
+ 317</pre>
437
+ </td>
438
+ <td>
439
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 310</span>
440
+
441
+ <span class='kw'>def</span> <span class='id identifier rubyid_add_entity'>add_entity</span><span class='lparen'>(</span><span class='id identifier rubyid_aHash'>aHash</span><span class='rparen'>)</span>
442
+ <span class='comment'># just send in key value pairs - these will be the variables you can use in the discovery item prototypes
443
+ </span> <span class='id identifier rubyid_zabbified'>zabbified</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
444
+ <span class='id identifier rubyid_aHash'>aHash</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
445
+ <span class='id identifier rubyid_zabbified'>zabbified</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>%Q(</span><span class='tstring_content'>{#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='embexpr_end'>}</span><span class='tstring_content'>}</span><span class='tstring_end'>)</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
446
+ <span class='rbrace'>}</span>
447
+ <span class='ivar'>@entities</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_zabbified'>zabbified</span><span class='rparen'>)</span>
448
+ <span class='kw'>end</span></pre>
449
+ </td>
450
+ </tr>
451
+ </table>
452
+ </div>
453
+
454
+ <div class="method_details ">
455
+ <h3 class="signature " id="to_discodata-instance_method">
456
+
457
+ #<strong>to_discodata</strong> &#x21d2; <tt>Object</tt>
458
+
459
+
460
+
461
+
462
+
463
+ </h3><div class="docstring">
464
+ <div class="discussion">
465
+
466
+ <p>Render this discovery as the structure an external discovery script should return. You can use this if you&#39;re writing custom external discovery logic</p>
467
+
468
+
469
+ </div>
470
+ </div>
471
+ <div class="tags">
472
+
473
+
474
+ </div><table class="source_code">
475
+ <tr>
476
+ <td>
477
+ <pre class="lines">
478
+
479
+
480
+ 322
481
+ 323
482
+ 324
483
+ 325
484
+ 326</pre>
485
+ </td>
486
+ <td>
487
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 322</span>
488
+
489
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_discodata'>to_discodata</span>
490
+ <span class='id identifier rubyid_disco'>disco</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>data</span><span class='tstring_end'>&#39;</span></span><span class='op'>=&gt;</span><span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='rbrace'>}</span>
491
+ <span class='id identifier rubyid_disco'>disco</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>data</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@entities</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
492
+ <span class='kw'>return</span> <span class='id identifier rubyid_disco'>disco</span>
493
+ <span class='kw'>end</span></pre>
494
+ </td>
495
+ </tr>
496
+ </table>
497
+ </div>
498
+
499
+ <div class="method_details ">
500
+ <h3 class="signature " id="to_senderline-instance_method">
501
+
502
+ #<strong>to_senderline</strong> &#x21d2; <tt>Object</tt>
503
+
504
+
505
+
506
+
507
+
508
+ </h3><div class="docstring">
509
+ <div class="discussion">
510
+
511
+ <p>Render this discovery instance as a zabbix_sender line.</p>
512
+
513
+
514
+ </div>
515
+ </div>
516
+ <div class="tags">
517
+
518
+
519
+ </div><table class="source_code">
520
+ <tr>
521
+ <td>
522
+ <pre class="lines">
523
+
524
+
525
+ 330
526
+ 331
527
+ 332
528
+ 333</pre>
529
+ </td>
530
+ <td>
531
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 330</span>
532
+
533
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_senderline'>to_senderline</span>
534
+ <span class='ivar'>@value</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_discodata'>to_discodata</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
535
+ <span class='kw'>super</span>
536
+ <span class='kw'>end</span></pre>
537
+ </td>
538
+ </tr>
539
+ </table>
540
+ </div>
541
+
542
+ <div class="method_details ">
543
+ <h3 class="signature " id="to_senderstruct-instance_method">
544
+
545
+ #<strong>to_senderstruct</strong> &#x21d2; <tt>Object</tt>
546
+
547
+
548
+
549
+
550
+
551
+ </h3><div class="docstring">
552
+ <div class="discussion">
553
+
554
+ <p>Render this discovery instance as an object suitable for conversion to json for socket transmission</p>
555
+
556
+
557
+ </div>
558
+ </div>
559
+ <div class="tags">
560
+
561
+
562
+ </div><table class="source_code">
563
+ <tr>
564
+ <td>
565
+ <pre class="lines">
566
+
567
+
568
+ 336
569
+ 337
570
+ 338
571
+ 339</pre>
572
+ </td>
573
+ <td>
574
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 336</span>
575
+
576
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_senderstruct'>to_senderstruct</span>
577
+ <span class='ivar'>@value</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_discodata'>to_discodata</span>
578
+ <span class='kw'>super</span>
579
+ <span class='kw'>end</span></pre>
580
+ </td>
581
+ </tr>
582
+ </table>
583
+ </div>
584
+
585
+ </div>
586
+
587
+ </div>
588
+
589
+ <div id="footer">
590
+ Generated on Sat Sep 11 00:00:06 2021 by
591
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
592
+ 0.9.26 (ruby-2.7.4).
593
+ </div>
594
+
595
+ </div>
596
+ </body>
597
+ </html>