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,678 @@
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::ItemData
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::ItemData";
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 (I)</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">ItemData</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::ItemData
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Zabbix::Sender::ItemData</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/zabbix_sender_api/api.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>ItemData instances hold the k-v pair of a value and its timestamp along with the hostname to which the data belongs. It handles formatting that data appropriately as input to zabbix_sender</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div><div id="subclasses">
114
+ <h2>Direct Known Subclasses</h2>
115
+ <p class="children"><span class='object_link'><a href="Discovery.html" title="Zabbix::Sender::Discovery (class)">Discovery</a></span></p>
116
+ </div>
117
+
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
122
+ <ul class="summary">
123
+
124
+ <li class="public ">
125
+ <span class="summary_signature">
126
+
127
+ <a href="#hostname-instance_method" title="#hostname (instance method)">#<strong>hostname</strong> &#x21d2; Object </a>
128
+
129
+
130
+
131
+ </span>
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ <span class="summary_desc"><div class='inline'>
145
+ <p>The name of the zabbix host that owns the item key.</p>
146
+ </div></span>
147
+
148
+ </li>
149
+
150
+
151
+ <li class="public ">
152
+ <span class="summary_signature">
153
+
154
+ <a href="#key-instance_method" title="#key (instance method)">#<strong>key</strong> &#x21d2; Object </a>
155
+
156
+
157
+
158
+ </span>
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'>
172
+ <p>The item key that&#39;ll get the new value.</p>
173
+ </div></span>
174
+
175
+ </li>
176
+
177
+
178
+ <li class="public ">
179
+ <span class="summary_signature">
180
+
181
+ <a href="#timestamp-instance_method" title="#timestamp (instance method)">#<strong>timestamp</strong> &#x21d2; Object </a>
182
+
183
+
184
+
185
+ </span>
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <span class="summary_desc"><div class='inline'>
199
+ <p>The timestamp for this datapoint.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="public ">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#value-instance_method" title="#value (instance method)">#<strong>value</strong> &#x21d2; Object </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ <span class="summary_desc"><div class='inline'>
226
+ <p>The value that the item will get.</p>
227
+ </div></span>
228
+
229
+ </li>
230
+
231
+
232
+ </ul>
233
+
234
+
235
+
236
+
237
+
238
+ <h2>
239
+ Instance Method Summary
240
+ <small><a href="#" class="summary_toggle">collapse</a></small>
241
+ </h2>
242
+
243
+ <ul class="summary">
244
+
245
+ <li class="public ">
246
+ <span class="summary_signature">
247
+
248
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(key: nil, value: nil, timestamp: nil, hostname: nil) &#x21d2; ItemData </a>
249
+
250
+
251
+
252
+ </span>
253
+
254
+
255
+ <span class="note title constructor">constructor</span>
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+ <span class="summary_desc"><div class='inline'>
265
+ <p>All values must be provided.</p>
266
+ </div></span>
267
+
268
+ </li>
269
+
270
+
271
+ <li class="public ">
272
+ <span class="summary_signature">
273
+
274
+ <a href="#to_senderline-instance_method" title="#to_senderline (instance method)">#<strong>to_senderline</strong> &#x21d2; Object </a>
275
+
276
+
277
+
278
+ </span>
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+ <span class="summary_desc"><div class='inline'>
289
+ <p>Render the ItemData instance as a line of text that can be piped into zabbix_sender.</p>
290
+ </div></span>
291
+
292
+ </li>
293
+
294
+
295
+ <li class="public ">
296
+ <span class="summary_signature">
297
+
298
+ <a href="#to_senderstruct-instance_method" title="#to_senderstruct (instance method)">#<strong>to_senderstruct</strong> &#x21d2; Object </a>
299
+
300
+
301
+
302
+ </span>
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+ <span class="summary_desc"><div class='inline'>
313
+ <p>Render the ItemData instance as an object suitable for conversion to json, for socket transmission.</p>
314
+ </div></span>
315
+
316
+ </li>
317
+
318
+
319
+ </ul>
320
+
321
+
322
+ <div id="constructor_details" class="method_details_list">
323
+ <h2>Constructor Details</h2>
324
+
325
+ <div class="method_details first">
326
+ <h3 class="signature first" id="initialize-instance_method">
327
+
328
+ #<strong>initialize</strong>(key: nil, value: nil, timestamp: nil, hostname: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Zabbix::Sender::ItemData (class)">ItemData</a></span></tt>
329
+
330
+
331
+
332
+
333
+
334
+ </h3><div class="docstring">
335
+ <div class="discussion">
336
+
337
+ <p>All values must be provided.</p>
338
+
339
+
340
+ </div>
341
+ </div>
342
+ <div class="tags">
343
+
344
+
345
+ </div><table class="source_code">
346
+ <tr>
347
+ <td>
348
+ <pre class="lines">
349
+
350
+
351
+ 255
352
+ 256
353
+ 257
354
+ 258
355
+ 259
356
+ 260</pre>
357
+ </td>
358
+ <td>
359
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 255</span>
360
+
361
+ <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>
362
+ <span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
363
+ <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
364
+ <span class='ivar'>@timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_timestamp'>timestamp</span>
365
+ <span class='ivar'>@hostname</span> <span class='op'>=</span> <span class='id identifier rubyid_hostname'>hostname</span>
366
+ <span class='kw'>end</span></pre>
367
+ </td>
368
+ </tr>
369
+ </table>
370
+ </div>
371
+
372
+ </div>
373
+
374
+ <div id="instance_attr_details" class="attr_details">
375
+ <h2>Instance Attribute Details</h2>
376
+
377
+
378
+ <span id="hostname=-instance_method"></span>
379
+ <div class="method_details first">
380
+ <h3 class="signature first" id="hostname-instance_method">
381
+
382
+ #<strong>hostname</strong> &#x21d2; <tt>Object</tt>
383
+
384
+
385
+
386
+
387
+
388
+ </h3><div class="docstring">
389
+ <div class="discussion">
390
+
391
+ <p>The name of the zabbix host that owns the item key</p>
392
+
393
+
394
+ </div>
395
+ </div>
396
+ <div class="tags">
397
+
398
+
399
+ </div><table class="source_code">
400
+ <tr>
401
+ <td>
402
+ <pre class="lines">
403
+
404
+
405
+ 248
406
+ 249
407
+ 250</pre>
408
+ </td>
409
+ <td>
410
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 248</span>
411
+
412
+ <span class='kw'>def</span> <span class='id identifier rubyid_hostname'>hostname</span>
413
+ <span class='ivar'>@hostname</span>
414
+ <span class='kw'>end</span></pre>
415
+ </td>
416
+ </tr>
417
+ </table>
418
+ </div>
419
+
420
+
421
+ <span id="key=-instance_method"></span>
422
+ <div class="method_details ">
423
+ <h3 class="signature " id="key-instance_method">
424
+
425
+ #<strong>key</strong> &#x21d2; <tt>Object</tt>
426
+
427
+
428
+
429
+
430
+
431
+ </h3><div class="docstring">
432
+ <div class="discussion">
433
+
434
+ <p>The item key that&#39;ll get the new value</p>
435
+
436
+
437
+ </div>
438
+ </div>
439
+ <div class="tags">
440
+
441
+
442
+ </div><table class="source_code">
443
+ <tr>
444
+ <td>
445
+ <pre class="lines">
446
+
447
+
448
+ 242
449
+ 243
450
+ 244</pre>
451
+ </td>
452
+ <td>
453
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 242</span>
454
+
455
+ <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
456
+ <span class='ivar'>@key</span>
457
+ <span class='kw'>end</span></pre>
458
+ </td>
459
+ </tr>
460
+ </table>
461
+ </div>
462
+
463
+
464
+ <span id="timestamp=-instance_method"></span>
465
+ <div class="method_details ">
466
+ <h3 class="signature " id="timestamp-instance_method">
467
+
468
+ #<strong>timestamp</strong> &#x21d2; <tt>Object</tt>
469
+
470
+
471
+
472
+
473
+
474
+ </h3><div class="docstring">
475
+ <div class="discussion">
476
+
477
+ <p>The timestamp for this datapoint</p>
478
+
479
+
480
+ </div>
481
+ </div>
482
+ <div class="tags">
483
+
484
+
485
+ </div><table class="source_code">
486
+ <tr>
487
+ <td>
488
+ <pre class="lines">
489
+
490
+
491
+ 251
492
+ 252
493
+ 253</pre>
494
+ </td>
495
+ <td>
496
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 251</span>
497
+
498
+ <span class='kw'>def</span> <span class='id identifier rubyid_timestamp'>timestamp</span>
499
+ <span class='ivar'>@timestamp</span>
500
+ <span class='kw'>end</span></pre>
501
+ </td>
502
+ </tr>
503
+ </table>
504
+ </div>
505
+
506
+
507
+ <span id="value=-instance_method"></span>
508
+ <div class="method_details ">
509
+ <h3 class="signature " id="value-instance_method">
510
+
511
+ #<strong>value</strong> &#x21d2; <tt>Object</tt>
512
+
513
+
514
+
515
+
516
+
517
+ </h3><div class="docstring">
518
+ <div class="discussion">
519
+
520
+ <p>The value that the item will get</p>
521
+
522
+
523
+ </div>
524
+ </div>
525
+ <div class="tags">
526
+
527
+
528
+ </div><table class="source_code">
529
+ <tr>
530
+ <td>
531
+ <pre class="lines">
532
+
533
+
534
+ 245
535
+ 246
536
+ 247</pre>
537
+ </td>
538
+ <td>
539
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 245</span>
540
+
541
+ <span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
542
+ <span class='ivar'>@value</span>
543
+ <span class='kw'>end</span></pre>
544
+ </td>
545
+ </tr>
546
+ </table>
547
+ </div>
548
+
549
+ </div>
550
+
551
+
552
+ <div id="instance_method_details" class="method_details_list">
553
+ <h2>Instance Method Details</h2>
554
+
555
+
556
+ <div class="method_details first">
557
+ <h3 class="signature first" id="to_senderline-instance_method">
558
+
559
+ #<strong>to_senderline</strong> &#x21d2; <tt>Object</tt>
560
+
561
+
562
+
563
+
564
+
565
+ </h3><div class="docstring">
566
+ <div class="discussion">
567
+
568
+ <p>Render the ItemData instance as a line of text that can be piped into zabbix_sender</p>
569
+
570
+
571
+ </div>
572
+ </div>
573
+ <div class="tags">
574
+
575
+
576
+ </div><table class="source_code">
577
+ <tr>
578
+ <td>
579
+ <pre class="lines">
580
+
581
+
582
+ 264
583
+ 265
584
+ 266
585
+ 267
586
+ 268
587
+ 269
588
+ 270</pre>
589
+ </td>
590
+ <td>
591
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 264</span>
592
+
593
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_senderline'>to_senderline</span>
594
+ <span class='kw'>if</span> <span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>==</span> <span class='int'>0</span>
595
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>%Q(</span><span class='tstring_content'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@hostname</span><span class='embexpr_end'>}</span><span class='tstring_content'>&quot; </span><span class='embexpr_beg'>#{</span><span class='ivar'>@key</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@value</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>)</span></span>
596
+ <span class='id identifier rubyid_abort'>abort</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attempt was made to render a timestamp of zero. You DO NOT want this - it can kill db performance. Fix it.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
597
+ <span class='kw'>end</span>
598
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>%Q(</span><span class='tstring_content'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@hostname</span><span class='embexpr_end'>}</span><span class='tstring_content'>&quot; </span><span class='embexpr_beg'>#{</span><span class='ivar'>@key</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@value</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>)</span></span>
599
+ <span class='kw'>end</span></pre>
600
+ </td>
601
+ </tr>
602
+ </table>
603
+ </div>
604
+
605
+ <div class="method_details ">
606
+ <h3 class="signature " id="to_senderstruct-instance_method">
607
+
608
+ #<strong>to_senderstruct</strong> &#x21d2; <tt>Object</tt>
609
+
610
+
611
+
612
+
613
+
614
+ </h3><div class="docstring">
615
+ <div class="discussion">
616
+
617
+ <p>Render the ItemData instance as an object suitable for conversion to json, for socket transmission</p>
618
+
619
+
620
+ </div>
621
+ </div>
622
+ <div class="tags">
623
+
624
+
625
+ </div><table class="source_code">
626
+ <tr>
627
+ <td>
628
+ <pre class="lines">
629
+
630
+
631
+ 273
632
+ 274
633
+ 275
634
+ 276
635
+ 277
636
+ 278
637
+ 279
638
+ 280
639
+ 281
640
+ 282
641
+ 283
642
+ 284
643
+ 285</pre>
644
+ </td>
645
+ <td>
646
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 273</span>
647
+
648
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_senderstruct'>to_senderstruct</span>
649
+ <span class='kw'>if</span> <span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>==</span> <span class='int'>0</span>
650
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>%Q(</span><span class='tstring_content'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@hostname</span><span class='embexpr_end'>}</span><span class='tstring_content'>&quot; </span><span class='embexpr_beg'>#{</span><span class='ivar'>@key</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@value</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>)</span></span>
651
+ <span class='id identifier rubyid_abort'>abort</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attempt was made to render a timestamp of zero. You DO NOT want this - it can kill db performance. Fix it.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
652
+ <span class='kw'>else</span>
653
+ <span class='kw'>return</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='lbrace'>{</span>
654
+ <span class='label'>host:</span> <span class='ivar'>@hostname</span><span class='comma'>,</span>
655
+ <span class='label'>key:</span> <span class='ivar'>@key</span><span class='comma'>,</span>
656
+ <span class='label'>value:</span> <span class='ivar'>@value</span><span class='comma'>,</span>
657
+ <span class='label'>clock:</span> <span class='ivar'>@timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
658
+ <span class='rbrace'>}</span>
659
+ <span class='kw'>end</span>
660
+ <span class='kw'>end</span></pre>
661
+ </td>
662
+ </tr>
663
+ </table>
664
+ </div>
665
+
666
+ </div>
667
+
668
+ </div>
669
+
670
+ <div id="footer">
671
+ Generated on Sat Sep 11 00:00:06 2021 by
672
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
673
+ 0.9.26 (ruby-2.7.4).
674
+ </div>
675
+
676
+ </div>
677
+ </body>
678
+ </html>