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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c23c9561bca313a86ed0bbd449c45214ace6db1053214867759dfe131fdf1721
4
- data.tar.gz: 47a7b93f97b811e81b705c58d93dbb8090cf6266f6866e3daa700de0b3891096
3
+ metadata.gz: b1bb42ed344a48f3aa83f04739a41ad388eb59ca3beb2819636255d3a5cd6ce7
4
+ data.tar.gz: 9039d00b328b41b2ad5462a3632a6834319fe027f672084352a707d8c1d3e5a5
5
5
  SHA512:
6
- metadata.gz: 71bfc54efbc387979ebf53e033863e3c3f9a72e8e6580def7dedf3e46f65107f13472fbf03cbf9e74271358edd2d3c1fff4aca474d8dd7519e0db531dd090bfc
7
- data.tar.gz: 6ffb54e8ae9fb8069865b2b748e605948cf4f3f8e53451b4499f959714a735ee3b57c9fd00e7accdcc65df2f894818cf5564610d9ff0e97ecfdc6cf21102252f
6
+ metadata.gz: 7df9cceb6e1a5d0836c6bc410a7ab444cd6cab38b9948ba688aaf5daac971c164a88a8d21a6fd629f3841492c9c8f8257c802c25bf8219929421eb3ff31fcdc8
7
+ data.tar.gz: 9a7b38fc6ae72efabcfa7bfda7b2c503aee772ebf0f3442c8e63ab5391c812a47572dd5ef2143ba33c3c6f591191749b8b34ffb051567d2023240272b4d03d6b
data/.gitignore CHANGED
@@ -3,7 +3,6 @@ Gemfile.lock
3
3
  /.yardoc
4
4
  /_yardoc/
5
5
  /coverage/
6
- /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
8
  /tmp/
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,12 @@
1
+ image: alpine:latest
2
+
3
+ pages:
4
+ stage: deploy
5
+ script:
6
+ - echo 'Nothing to do...'
7
+ artifacts:
8
+ paths:
9
+ - public
10
+ expire_in: never
11
+ only:
12
+ - master
data/CHANGELOG.md CHANGED
@@ -5,3 +5,5 @@
5
5
  # 1.1.1
6
6
  - added ability to override Zabbix::AgentConfiguration search path
7
7
  - cleaned up a few issues + the docs
8
+ # 1.1.2
9
+ - This is just a documentation fix. rubydoc.info wasn't generating docs from the gem properly so docs are now in a gitlab "pages" site.
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # zabbix_sender_api
2
2
 
3
- This gem provides a model for assembling and sending data to Zabbix via its sender/trapper mechanism. I works both with the zabbix_sender command line utility by itself using a socket connection to a trapper port direct from Ruby.
3
+ This gem provides a model for assembling and sending data to Zabbix via its sender/trapper mechanism. It works both with the zabbix_sender command line utility, or by itself using a socket connection to a trapper port direct from Ruby.
4
4
 
5
- **Detailed documentation for this library is at [rubydoc.info](https://rubydoc.info/gems/zabbix_sender_api)**
5
+ **Detailed documentation for this library is [>>HERE<<](https://svdasein.gitlab.io/zabbix_sender_api)**
6
6
 
7
7
  Look at [the source for the zfstozab gem](https://gitlab.com/svdasein/zfstozab/-/blob/master/exe/zabbix-zfs.rb) for a practical example how to use this api.
8
8
 
@@ -8,14 +8,12 @@ require 'open3'
8
8
  # initialized when the gem is required. You may optionally re-initialize the
9
9
  # class with your own list of paths to search. If it finds configuration you can
10
10
  # access it with class methods. This is not meant to be instantiated.
11
- #
12
11
  class AgentConfiguration
13
12
  ##
14
13
  # You may optionally pass an array of full paths to agent conf files to look for
15
14
  # during initialization. By default some common places are checked, but
16
15
  # you can specify your own. If you call this you'll re-initialize the class, which
17
16
  # will scan for values in any of the listed files it happens to find.
18
- #
19
17
  def self.initialize(paths: [
20
18
  '/etc/zabbix/zabbix_agentd.conf',
21
19
  '/usr/local/etc/zabbix/zabbix_agentd.conf',
@@ -1,3 +1,3 @@
1
1
  module ZabbixSenderApi
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -0,0 +1,413 @@
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::AgentConfiguration
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::AgentConfiguration";
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 (A)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Zabbix.html" title="Zabbix (module)">Zabbix</a></span></span>
41
+ &raquo;
42
+ <span class="title">AgentConfiguration</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::AgentConfiguration
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::AgentConfiguration</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>AgentConfiguration holds data that&#39;s scraped from a zabbix_agentd config file. It&#39;s initialized when the gem is required. You may optionally re-initialize the class with your own list of paths to search. If it finds configuration you can access it with class methods. This is not meant to be instantiated.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ <h2>
122
+ Class Method Summary
123
+ <small><a href="#" class="summary_toggle">collapse</a></small>
124
+ </h2>
125
+
126
+ <ul class="summary">
127
+
128
+ <li class="public ">
129
+ <span class="summary_signature">
130
+
131
+ <a href="#initialize-class_method" title="initialize (class method)">.<strong>initialize</strong>(paths: [ &#39;/etc/zabbix/zabbix_agentd.conf&#39;, &#39;/usr/local/etc/zabbix/zabbix_agentd.conf&#39;, &#39;/opt/zabbix/etc/zabbix_agentd.conf&#39;, &#39;/opt/zabbix/conf/zabbix_agentd.conf&#39; ]) &#x21d2; Object </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>You may optionally pass an array of full paths to agent conf files to look for during initialization.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#zabbixHostname-class_method" title="zabbixHostname (class method)">.<strong>zabbixHostname</strong> &#x21d2; Object </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'>
170
+ <p>Returns the value of the Hostname= asignment in zabbix_agentd.conf (if any).</p>
171
+ </div></span>
172
+
173
+ </li>
174
+
175
+
176
+ <li class="public ">
177
+ <span class="summary_signature">
178
+
179
+ <a href="#zabbixProxy-class_method" title="zabbixProxy (class method)">.<strong>zabbixProxy</strong> &#x21d2; Object </a>
180
+
181
+
182
+
183
+ </span>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Returns the value of the Server= assignment in zabbix_agentd.conf (if any).</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ </ul>
201
+
202
+
203
+
204
+
205
+ <div id="class_method_details" class="method_details_list">
206
+ <h2>Class Method Details</h2>
207
+
208
+
209
+ <div class="method_details first">
210
+ <h3 class="signature first" id="initialize-class_method">
211
+
212
+ .<strong>initialize</strong>(paths: [
213
+ &#39;/etc/zabbix/zabbix_agentd.conf&#39;,
214
+ &#39;/usr/local/etc/zabbix/zabbix_agentd.conf&#39;,
215
+ &#39;/opt/zabbix/etc/zabbix_agentd.conf&#39;,
216
+ &#39;/opt/zabbix/conf/zabbix_agentd.conf&#39;
217
+ ]) &#x21d2; <tt>Object</tt>
218
+
219
+
220
+
221
+
222
+
223
+ </h3><div class="docstring">
224
+ <div class="discussion">
225
+
226
+ <p>You may optionally pass an array of full paths to agent conf files to look for during initialization. By default some common places are checked, but you can specify your own. If you call this you&#39;ll re-initialize the class, which will scan for values in any of the listed files it happens to find.</p>
227
+
228
+
229
+ </div>
230
+ </div>
231
+ <div class="tags">
232
+
233
+
234
+ </div><table class="source_code">
235
+ <tr>
236
+ <td>
237
+ <pre class="lines">
238
+
239
+
240
+ 17
241
+ 18
242
+ 19
243
+ 20
244
+ 21
245
+ 22
246
+ 23
247
+ 24
248
+ 25
249
+ 26
250
+ 27
251
+ 28
252
+ 29
253
+ 30
254
+ 31
255
+ 32
256
+ 33
257
+ 34
258
+ 35
259
+ 36
260
+ 37
261
+ 38
262
+ 39
263
+ 40
264
+ 41
265
+ 42
266
+ 43
267
+ 44
268
+ 45
269
+ 46
270
+ 47
271
+ 48
272
+ 49
273
+ 50
274
+ 51</pre>
275
+ </td>
276
+ <td>
277
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 17</span>
278
+
279
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>paths:</span> <span class='lbracket'>[</span>
280
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/etc/zabbix/zabbix_agentd.conf</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
281
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/usr/local/etc/zabbix/zabbix_agentd.conf</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
282
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/opt/zabbix/etc/zabbix_agentd.conf</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
283
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/opt/zabbix/conf/zabbix_agentd.conf</span><span class='tstring_end'>&#39;</span></span>
284
+ <span class='rbracket'>]</span><span class='rparen'>)</span>
285
+ <span class='ivar'>@agentConfPaths</span> <span class='op'>=</span> <span class='id identifier rubyid_paths'>paths</span>
286
+
287
+ <span class='ivar'>@proxy</span> <span class='op'>=</span> <span class='kw'>nil</span>
288
+ <span class='ivar'>@hostname</span> <span class='op'>=</span> <span class='kw'>nil</span>
289
+
290
+ <span class='ivar'>@agentConfPaths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
291
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
292
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_line'>each_line</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
293
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@proxy</span>
294
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^Server=?(.*)</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
295
+ <span class='kw'>if</span> <span class='id identifier rubyid_match'>match</span>
296
+ <span class='ivar'>@proxy</span> <span class='op'>=</span> <span class='id identifier rubyid_match'>match</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>,</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
297
+ <span class='kw'>end</span>
298
+ <span class='kw'>end</span>
299
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@hostname</span>
300
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^Hostname=?(.*)</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
301
+ <span class='kw'>if</span> <span class='id identifier rubyid_match'>match</span>
302
+ <span class='ivar'>@hostname</span> <span class='op'>=</span> <span class='id identifier rubyid_match'>match</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
303
+ <span class='kw'>end</span>
304
+ <span class='kw'>end</span>
305
+ <span class='kw'>break</span> <span class='kw'>if</span> <span class='ivar'>@proxy</span> <span class='kw'>and</span> <span class='ivar'>@hostname</span>
306
+ <span class='rbrace'>}</span>
307
+ <span class='kw'>end</span>
308
+ <span class='kw'>break</span> <span class='kw'>if</span> <span class='ivar'>@proxy</span> <span class='kw'>and</span> <span class='ivar'>@host</span>
309
+ <span class='rbrace'>}</span>
310
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@host</span>
311
+ <span class='ivar'>@host</span> <span class='op'>=</span> <span class='const'>Socket</span><span class='period'>.</span><span class='id identifier rubyid_gethostname'>gethostname</span>
312
+ <span class='kw'>end</span>
313
+ <span class='kw'>end</span></pre>
314
+ </td>
315
+ </tr>
316
+ </table>
317
+ </div>
318
+
319
+ <div class="method_details ">
320
+ <h3 class="signature " id="zabbixHostname-class_method">
321
+
322
+ .<strong>zabbixHostname</strong> &#x21d2; <tt>Object</tt>
323
+
324
+
325
+
326
+
327
+
328
+ </h3><div class="docstring">
329
+ <div class="discussion">
330
+
331
+ <p>Returns the value of the Hostname= asignment in zabbix_agentd.conf (if any)</p>
332
+
333
+
334
+ </div>
335
+ </div>
336
+ <div class="tags">
337
+
338
+
339
+ </div><table class="source_code">
340
+ <tr>
341
+ <td>
342
+ <pre class="lines">
343
+
344
+
345
+ 63
346
+ 64
347
+ 65</pre>
348
+ </td>
349
+ <td>
350
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 63</span>
351
+
352
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_zabbixHostname'>zabbixHostname</span>
353
+ <span class='ivar'>@hostname</span>
354
+ <span class='kw'>end</span></pre>
355
+ </td>
356
+ </tr>
357
+ </table>
358
+ </div>
359
+
360
+ <div class="method_details ">
361
+ <h3 class="signature " id="zabbixProxy-class_method">
362
+
363
+ .<strong>zabbixProxy</strong> &#x21d2; <tt>Object</tt>
364
+
365
+
366
+
367
+
368
+
369
+ </h3><div class="docstring">
370
+ <div class="discussion">
371
+
372
+ <p>Returns the value of the Server= assignment in zabbix_agentd.conf (if any)</p>
373
+
374
+
375
+ </div>
376
+ </div>
377
+ <div class="tags">
378
+
379
+
380
+ </div><table class="source_code">
381
+ <tr>
382
+ <td>
383
+ <pre class="lines">
384
+
385
+
386
+ 56
387
+ 57
388
+ 58</pre>
389
+ </td>
390
+ <td>
391
+ <pre class="code"><span class="info file"># File 'lib/zabbix_sender_api/api.rb', line 56</span>
392
+
393
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_zabbixProxy'>zabbixProxy</span>
394
+ <span class='ivar'>@proxy</span>
395
+ <span class='kw'>end</span></pre>
396
+ </td>
397
+ </tr>
398
+ </table>
399
+ </div>
400
+
401
+ </div>
402
+
403
+ </div>
404
+
405
+ <div id="footer">
406
+ Generated on Sat Sep 11 00:00:06 2021 by
407
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
408
+ 0.9.26 (ruby-2.7.4).
409
+ </div>
410
+
411
+ </div>
412
+ </body>
413
+ </html>