zabbix_sender_api 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/zabbix_sender_api/api.rb +54 -6
- data/lib/zabbix_sender_api/version.rb +1 -1
- data/public/Zabbix/AgentConfiguration.html +6 -6
- data/public/Zabbix/Sender/Batch.html +133 -57
- data/public/Zabbix/Sender/Connection.html +7 -7
- data/public/Zabbix/Sender/Discovery.html +43 -43
- data/public/Zabbix/Sender/ItemData.html +49 -49
- data/public/Zabbix/Sender/NanosecondItemData.html +333 -0
- data/public/Zabbix/Sender/Pipe.html +43 -39
- data/public/Zabbix/Sender/Socket.html +7 -7
- data/public/Zabbix/Sender.html +5 -5
- data/public/Zabbix.html +4 -4
- data/public/ZabbixSenderApi/Error.html +4 -4
- data/public/ZabbixSenderApi.html +5 -5
- data/public/_index.html +23 -8
- data/public/class_list.html +1 -1
- data/public/file.CHANGELOG.html +17 -23
- data/public/file.LICENSE.html +4 -4
- data/public/file.README.html +76 -66
- data/public/frames.html +10 -5
- data/public/index.html +76 -66
- data/public/method_list.html +41 -17
- data/public/top-level-namespace.html +4 -4
- metadata +4 -3
data/public/ZabbixSenderApi.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: ZabbixSenderApi
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.36
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -107,7 +107,7 @@
|
|
107
107
|
<dt id="VERSION-constant" class="">VERSION =
|
108
108
|
|
109
109
|
</dt>
|
110
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.1.
|
110
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.1.4</span><span class='tstring_end'>"</span></span></pre></dd>
|
111
111
|
|
112
112
|
</dl>
|
113
113
|
|
@@ -123,9 +123,9 @@
|
|
123
123
|
</div>
|
124
124
|
|
125
125
|
<div id="footer">
|
126
|
-
Generated on
|
127
|
-
<a href="
|
128
|
-
0.9.
|
126
|
+
Generated on Fri Jan 3 16:13:55 2025 by
|
127
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
128
|
+
0.9.36 (ruby-3.2.2).
|
129
129
|
</div>
|
130
130
|
|
131
131
|
</div>
|
data/public/_index.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
|
-
Documentation by YARD 0.9.
|
7
|
+
Documentation by YARD 0.9.36
|
8
8
|
|
9
9
|
</title>
|
10
10
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<div class="clear"></div>
|
53
53
|
</div>
|
54
54
|
|
55
|
-
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.
|
55
|
+
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.36</h1>
|
56
56
|
<div id="listing">
|
57
57
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
58
58
|
|
@@ -172,12 +172,12 @@
|
|
172
172
|
</ul>
|
173
173
|
|
174
174
|
|
175
|
-
<ul id="
|
176
|
-
<li class="letter">
|
175
|
+
<ul id="alpha_N" class="alpha">
|
176
|
+
<li class="letter">N</li>
|
177
177
|
<ul>
|
178
178
|
|
179
179
|
<li>
|
180
|
-
<span class='object_link'><a href="Zabbix/Sender/
|
180
|
+
<span class='object_link'><a href="Zabbix/Sender/NanosecondItemData.html" title="Zabbix::Sender::NanosecondItemData (class)">NanosecondItemData</a></span>
|
181
181
|
|
182
182
|
<small>(Zabbix::Sender)</small>
|
183
183
|
|
@@ -190,6 +190,21 @@
|
|
190
190
|
</td><td valign='top' width="33%">
|
191
191
|
|
192
192
|
|
193
|
+
<ul id="alpha_P" class="alpha">
|
194
|
+
<li class="letter">P</li>
|
195
|
+
<ul>
|
196
|
+
|
197
|
+
<li>
|
198
|
+
<span class='object_link'><a href="Zabbix/Sender/Pipe.html" title="Zabbix::Sender::Pipe (class)">Pipe</a></span>
|
199
|
+
|
200
|
+
<small>(Zabbix::Sender)</small>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
</ul>
|
205
|
+
</ul>
|
206
|
+
|
207
|
+
|
193
208
|
<ul id="alpha_S" class="alpha">
|
194
209
|
<li class="letter">S</li>
|
195
210
|
<ul>
|
@@ -238,9 +253,9 @@
|
|
238
253
|
</div>
|
239
254
|
|
240
255
|
<div id="footer">
|
241
|
-
Generated on
|
242
|
-
<a href="
|
243
|
-
0.9.
|
256
|
+
Generated on Fri Jan 3 16:13:55 2025 by
|
257
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
258
|
+
0.9.36 (ruby-3.2.2).
|
244
259
|
</div>
|
245
260
|
|
246
261
|
</div>
|
data/public/class_list.html
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
<ul id="full_list" class="class">
|
45
45
|
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
|
46
|
-
<li id='object_Zabbix' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Zabbix.html" title="Zabbix (module)">Zabbix</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Zabbix::AgentConfiguration' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Zabbix/AgentConfiguration.html" title="Zabbix::AgentConfiguration (class)">AgentConfiguration</a></span> < Object<small class='search_info'>Zabbix</small></div></li><li id='object_Zabbix::Sender' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Zabbix/Sender.html" title="Zabbix::Sender (module)">Sender</a></span><small class='search_info'>Zabbix</small></div><ul><li id='object_Zabbix::Sender::Batch' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Batch.html" title="Zabbix::Sender::Batch (class)">Batch</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Connection' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Discovery' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Discovery.html" title="Zabbix::Sender::Discovery (class)">Discovery</a></span> < ItemData<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::ItemData' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/ItemData.html" title="Zabbix::Sender::ItemData (class)">ItemData</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Pipe' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Pipe.html" title="Zabbix::Sender::Pipe (class)">Pipe</a></span> < Connection<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Socket' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Socket.html" title="Zabbix::Sender::Socket (class)">Socket</a></span> < Connection<small class='search_info'>Zabbix::Sender</small></div></li></ul></li></ul></li><li id='object_ZabbixSenderApi' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="ZabbixSenderApi.html" title="ZabbixSenderApi (module)">ZabbixSenderApi</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_ZabbixSenderApi::Error' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="ZabbixSenderApi/Error.html" title="ZabbixSenderApi::Error (class)">Error</a></span> < StandardError<small class='search_info'>ZabbixSenderApi</small></div></li></ul></li>
|
46
|
+
<li id='object_Zabbix' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Zabbix.html" title="Zabbix (module)">Zabbix</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Zabbix::AgentConfiguration' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Zabbix/AgentConfiguration.html" title="Zabbix::AgentConfiguration (class)">AgentConfiguration</a></span> < Object<small class='search_info'>Zabbix</small></div></li><li id='object_Zabbix::Sender' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Zabbix/Sender.html" title="Zabbix::Sender (module)">Sender</a></span><small class='search_info'>Zabbix</small></div><ul><li id='object_Zabbix::Sender::Batch' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Batch.html" title="Zabbix::Sender::Batch (class)">Batch</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Connection' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Connection.html" title="Zabbix::Sender::Connection (class)">Connection</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Discovery' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Discovery.html" title="Zabbix::Sender::Discovery (class)">Discovery</a></span> < ItemData<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::ItemData' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/ItemData.html" title="Zabbix::Sender::ItemData (class)">ItemData</a></span> < Object<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::NanosecondItemData' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/NanosecondItemData.html" title="Zabbix::Sender::NanosecondItemData (class)">NanosecondItemData</a></span> < ItemData<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Pipe' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Pipe.html" title="Zabbix::Sender::Pipe (class)">Pipe</a></span> < Connection<small class='search_info'>Zabbix::Sender</small></div></li><li id='object_Zabbix::Sender::Socket' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Zabbix/Sender/Socket.html" title="Zabbix::Sender::Socket (class)">Socket</a></span> < Connection<small class='search_info'>Zabbix::Sender</small></div></li></ul></li></ul></li><li id='object_ZabbixSenderApi' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="ZabbixSenderApi.html" title="ZabbixSenderApi (module)">ZabbixSenderApi</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_ZabbixSenderApi::Error' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="ZabbixSenderApi/Error.html" title="ZabbixSenderApi::Error (class)">Error</a></span> < StandardError<small class='search_info'>ZabbixSenderApi</small></div></li></ul></li>
|
47
47
|
|
48
48
|
</ul>
|
49
49
|
</div>
|
data/public/file.CHANGELOG.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: CHANGELOG
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.36
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -57,31 +57,25 @@
|
|
57
57
|
<div class="clear"></div>
|
58
58
|
</div>
|
59
59
|
|
60
|
-
<div id="content"><div id='filecontents'>
|
61
|
-
<
|
62
|
-
<
|
63
|
-
<
|
64
|
-
|
65
|
-
|
66
|
-
</li
|
67
|
-
<
|
68
|
-
|
69
|
-
<
|
70
|
-
</li
|
71
|
-
<
|
72
|
-
</
|
73
|
-
<p>cleaned up a few issues + the docs</p>
|
74
|
-
|
75
|
-
<h1 id="label-1.1.2">1.1.2</h1>
|
76
|
-
</li><li>
|
77
|
-
<p>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.</p>
|
78
|
-
</li></ul>
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="section">1.1.0</h1>
|
61
|
+
<ul>
|
62
|
+
<li>added native (socket based) sender logic (Zabbix::Sender::Socket).</li>
|
63
|
+
<li>changed Zabbix::Sender::Pipe’s open method from popen to Open3::popen3 to allow capture of stdout stderf and exitA</li>
|
64
|
+
<li>the Socket and Pipe .flush method returns status, sendBatchAtomic relays it from its internal call to flush
|
65
|
+
# 1.1.1</li>
|
66
|
+
<li>added ability to override Zabbix::AgentConfiguration search path</li>
|
67
|
+
<li>cleaned up a few issues + the docs
|
68
|
+
# 1.1.2</li>
|
69
|
+
<li>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.
|
70
|
+
# 1.1.3</li>
|
71
|
+
<li>BUG fix for Discovery when using Socket mode.</li>
|
72
|
+
</ul>
|
79
73
|
</div></div>
|
80
74
|
|
81
75
|
<div id="footer">
|
82
|
-
Generated on
|
83
|
-
<a href="
|
84
|
-
0.9.
|
76
|
+
Generated on Fri Jan 3 16:13:55 2025 by
|
77
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
78
|
+
0.9.36 (ruby-3.2.2).
|
85
79
|
</div>
|
86
80
|
|
87
81
|
</div>
|
data/public/file.LICENSE.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: LICENSE
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.36
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -60,9 +60,9 @@
|
|
60
60
|
<div id="content"><div id='filecontents'>The MIT License (MIT)<br/><br/>Copyright (c) 2020 Dave Parker<br/><br/>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>of this software and associated documentation files (the "Software"), to deal<br/>in the Software without restriction, including without limitation the rights<br/>to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>copies of the Software, and to permit persons to whom the Software is<br/>furnished to do so, subject to the following conditions:<br/><br/>The above copyright notice and this permission notice shall be included in<br/>all copies or substantial portions of the Software.<br/><br/>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>THE SOFTWARE.</div></div>
|
61
61
|
|
62
62
|
<div id="footer">
|
63
|
-
Generated on
|
64
|
-
<a href="
|
65
|
-
0.9.
|
63
|
+
Generated on Fri Jan 3 16:13:55 2025 by
|
64
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
65
|
+
0.9.36 (ruby-3.2.2).
|
66
66
|
</div>
|
67
67
|
|
68
68
|
</div>
|
data/public/file.README.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.36
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -57,125 +57,135 @@
|
|
57
57
|
<div class="clear"></div>
|
58
58
|
</div>
|
59
59
|
|
60
|
-
<div id="content"><div id='filecontents'>
|
61
|
-
<h1 id="label-zabbix_sender_api+rdoc-image-3Ahttps-3A-2F-2Fbadge.fury.io-2Frb-2Fzabbix_sender_api.svg">zabbix_sender_api <a href="https://badge.fury.io/rb/zabbix_sender_api"><img src="https://badge.fury.io/rb/zabbix_sender_api.svg"></a></h1>
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="zabbixsenderapi-gem-versionhttpsbadgefuryiorbzabbixsenderapisvghttpsbadgefuryiorbzabbixsenderapi">zabbix_sender_api <a href="https://badge.fury.io/rb/zabbix_sender_api"><img src="https://badge.fury.io/rb/zabbix_sender_api.svg" alt="Gem Version" /></a></h1>
|
62
61
|
|
63
|
-
<p>This gem provides a model for assembling and sending data to Zabbix via its sender/trapper mechanism.
|
62
|
+
<p>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.</p>
|
64
63
|
|
65
|
-
<p><strong>Detailed documentation for this library is <a href="https://svdasein.gitlab.io/zabbix_sender_api"
|
64
|
+
<p><strong>Detailed documentation for this library is <a href="https://svdasein.gitlab.io/zabbix_sender_api">»HERE«</a></strong></p>
|
66
65
|
|
67
|
-
<p><strong>Source repository is <a href="https://gitlab.com/svdasein/zabbix_sender_api"
|
66
|
+
<p><strong>Source repository is <a href="https://gitlab.com/svdasein/zabbix_sender_api">»HERE«</a></strong></p>
|
68
67
|
|
69
68
|
<p>Look at <a href="https://gitlab.com/svdasein/zfstozab/-/blob/master/exe/zabbix-zfs.rb">the source for the zfstozab gem</a> for a practical example how to use this api.</p>
|
70
69
|
|
71
70
|
<p>zabbix_sender_api can send data to zabbix via one of two included connection types:</p>
|
72
|
-
|
73
|
-
<
|
74
|
-
</li
|
75
|
-
<
|
76
|
-
</
|
71
|
+
|
72
|
+
<ul>
|
73
|
+
<li>zabbix_sender (this was the original and for quite some time only mode supported)</li>
|
74
|
+
<li>TCP socket connection directly to a Zabbix “trapper” port (as of vers 1.1.0)</li>
|
75
|
+
</ul>
|
77
76
|
|
78
77
|
<p>If you need to interact with the Zabbix REST API, you might also be interested in <a href="https://svdasein.gitlab.io/zabbix-api/">zabbix-api-simple</a></p>
|
79
78
|
|
80
|
-
<h2 id="
|
79
|
+
<h2 id="installation">Installation</h2>
|
81
80
|
|
82
81
|
<pre class="code ruby"><code class="ruby">$ gem install zabbix_sender_api
|
83
82
|
</code></pre>
|
84
83
|
|
85
|
-
<h2 id="
|
86
|
-
|
87
|
-
<h3 id="label-Synopsis">Synopsis</h3>
|
84
|
+
<h2 id="usage">Usage</h2>
|
88
85
|
|
89
|
-
<
|
90
|
-
|
86
|
+
<h3 id="synopsis">Synopsis</h3>
|
87
|
+
<p>```ruby
|
88
|
+
#!/usr/bin/env ruby
|
89
|
+
require ‘zabbix_sender_api’</p>
|
91
90
|
|
92
|
-
<
|
91
|
+
<p>sender = Zabbix::Sender::Pipe.new</p>
|
93
92
|
|
94
|
-
<
|
93
|
+
<p>rawdata = { :myFirstKey => 0, :mySecondKey => 100 }</p>
|
95
94
|
|
96
|
-
<
|
95
|
+
<p>data = Zabbix::Sender::Batch.new</p>
|
97
96
|
|
98
|
-
<
|
99
|
-
|
100
|
-
|
97
|
+
<p>rawdata.each_pair {|key,value|
|
98
|
+
data.addItemData(key: key,value: value)
|
99
|
+
}</p>
|
101
100
|
|
102
|
-
<
|
103
|
-
|
101
|
+
<p>sender.sendBatchAtomic(data)
|
102
|
+
```</p>
|
104
103
|
|
105
104
|
<p>The above will execute zabbix_sender for you and send data into it as described above.</p>
|
106
105
|
|
107
106
|
<p>Alternatively you can just</p>
|
108
107
|
|
109
|
-
<
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
<p><code>ruby
|
109
|
+
puts data.to_senderline
|
110
|
+
</code>
|
111
|
+
… and do whatever you want w/ the stdout</p>
|
113
112
|
|
114
113
|
<p>To do low level discovery:</p>
|
115
114
|
|
116
|
-
<
|
115
|
+
<p>```ruby
|
116
|
+
disco = Zabbix::Sender::Discovery.new(key: ‘discoveryRuleKey’)</p>
|
117
117
|
|
118
|
-
<
|
118
|
+
<p>disco.add_entity(:SOMEUSEFULVALUE => ‘aValue’, :ANOTHERONE => ‘somethingElse’)</p>
|
119
119
|
|
120
|
-
<
|
121
|
-
</code></pre>
|
120
|
+
<p>data.addDiscovery(disco)</p>
|
122
121
|
|
123
|
-
<
|
122
|
+
<p>```</p>
|
124
123
|
|
125
|
-
<
|
124
|
+
<h3 id="under-the-hood">Under the hood</h3>
|
126
125
|
|
126
|
+
<h4 id="zabbixsenderpipe-method">Zabbix::Sender::Pipe method:</h4>
|
127
127
|
<p>The zabbix-sender cli utility provides a number of methods by which to insert data into zabbix.</p>
|
128
|
-
<ul><li>
|
129
|
-
<p>zabbix-sender … -s zabbixHostName -k keyName -o value (one k-v pair at a time)</p>
|
130
|
-
</li><li>
|
131
|
-
<p>zabbix-sender … -i - (series of kv pairs from stdin using zabbix-sender start time as timestamp)</p>
|
132
|
-
</li><li>
|
133
|
-
<p>zabbix-sender … -T -i - (series of kv pairs with their own embedded timestamps from stdin)</p>
|
134
|
-
</li></ul>
|
135
128
|
|
136
|
-
<
|
129
|
+
<ul>
|
130
|
+
<li>zabbix-sender … -s zabbixHostName -k keyName -o value (one k-v pair at a time)</li>
|
131
|
+
<li>zabbix-sender … -i - (series of kv pairs from stdin using zabbix-sender start time as timestamp)</li>
|
132
|
+
<li>zabbix-sender … -T -i - (series of kv pairs with their own embedded timestamps from stdin)</li>
|
133
|
+
</ul>
|
137
134
|
|
138
|
-
<p>In
|
135
|
+
<p>In the latter two cases, the zabbix host name (the name of the host that zabbix is monitoring) is embedded
|
136
|
+
in the stdin data.</p>
|
137
|
+
|
138
|
+
<p>In all cases it is presumed that the zabbix server or proxy to which data should be sent is specified. This can
|
139
|
+
be done either by specifying it explicitly with the -z switch, or indirectly by pointing it to a zabbix sender configuration
|
140
|
+
file with the -c switch. If you let zabbix_sender_api handle executing zabbix_sender, the target will be specified on the
|
141
|
+
command line via the -z switch.</p>
|
139
142
|
|
140
143
|
<p>zabbix_sender_api utilizes the -T -i - form, so the generated data lines look like this:</p>
|
141
144
|
|
142
|
-
<
|
143
|
-
|
144
|
-
|
145
|
+
<p><code>
|
146
|
+
"theHostBeingMonitored" myFirstKey 1551719379 0
|
147
|
+
"theHostBeingMonitored" mySecondKey 1551719379 100
|
148
|
+
</code></p>
|
145
149
|
|
146
|
-
<p>The above lines will send data to two items associated with the host theHostBeingMonitored: myFirstKey gets the value 0, and mySecondKey gets the value 100.
|
150
|
+
<p>The above lines will send data to two items associated with the host theHostBeingMonitored: myFirstKey gets the value 0, and mySecondKey gets the value 100. In both cases the
|
151
|
+
time stamp is identical but it need not be (see the exe/example.rb for specifics).</p>
|
147
152
|
|
148
153
|
<p>Low level discovery (LLD) is also possible with zabbix-sender; the format of the stdin data is not so pretty but zabbix_sender_api handles all that:</p>
|
149
154
|
|
150
|
-
<
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<p>If you wished to use the above lld to actually do some discovery, you'd set things up in zabbix roughly like this:</p>
|
155
|
+
<p><code>
|
156
|
+
"theHostBeingMonitored" discoveryRuleKey 1551719797 {"data":[{"{#SOMEUSEFULVALUE}":"aValue","{#ANOTHERONE}":"somethingElse"}]}
|
157
|
+
</code>
|
158
|
+
The above line sends an LLD discovery structure (formatted as json) to the <a href="https://www.zabbix.com/documentation/4.0/manual/discovery/low_level_discovery#discovery_rule">discovery rule</a> whose key is discoveryRuleKey. It describes one entity by passing the macro values
|
159
|
+
#SOMEUSEFULVALUE and #ANOTHERONE to the discovery rule. These ‘<a href="https://www.zabbix.com/documentation/4.0/manual/config/macros/lld_macros">lld macros</a>’ are available for use in item,trigger, and graph prototypes.</p>
|
156
160
|
|
157
|
-
<p
|
161
|
+
<p>If you wished to use the above lld to actually do some discovery, you’d set things up in zabbix roughly like this:</p>
|
158
162
|
|
159
|
-
<
|
163
|
+
<p><img src="images/Spectacle.Z29721.png" alt="Discovery rule configuration" />
|
164
|
+
<img src="images/Spectacle.l29721.png" alt="Item prototype configuration" /></p>
|
160
165
|
|
161
|
-
<
|
166
|
+
<h4 id="zabbixsendersocket-method">Zabbix::Sender::Socket method:</h4>
|
162
167
|
|
163
|
-
<
|
164
|
-
</code></pre>
|
168
|
+
<p>You can switch between using the Pipe(zabbix_sender) method and the Socket(direct to zabbix via tcp socket) method very simply. Just change:</p>
|
165
169
|
|
166
|
-
<p
|
170
|
+
<p><code>
|
171
|
+
sender = Zabbix::Sender::Pipe.new
|
172
|
+
</code>
|
173
|
+
to
|
174
|
+
<code>
|
175
|
+
sender = Zabbix::Sender::Socket.new
|
176
|
+
</code></p>
|
167
177
|
|
168
|
-
<p>If you were specifiying a path to zabbix_sender using the Pipe method, remove that.
|
178
|
+
<p>If you were specifiying a path to zabbix_sender using the Pipe method, remove that. If you’re using a socket other than 10051 on your server/proxy, you’ll want to add the port: option</p>
|
169
179
|
|
170
|
-
<p>The socket method doesn
|
180
|
+
<p>The socket method doesn’t support sending multiple batches between flushes, so you should just use sendBatchAtomic(aBatch) with the Socket method.</p>
|
171
181
|
|
172
|
-
<p>You don
|
182
|
+
<p>You don’t have to change anything else - the rest of zabbix_sender_api works exactly the same with the Socket method, save for that it’s arguably more efficient with system resources. The only drawback might be if zabbix changes the sender protocol. At that point until this library is update to support the change you can revert to the Pipe/zabbix_sender method if needed (if they change the command line switches radically there, changes will be required in this library as well).</p>
|
173
183
|
</div></div>
|
174
184
|
|
175
185
|
<div id="footer">
|
176
|
-
Generated on
|
177
|
-
<a href="
|
178
|
-
0.9.
|
186
|
+
Generated on Fri Jan 3 16:13:55 2025 by
|
187
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
188
|
+
0.9.36 (ruby-3.2.2).
|
179
189
|
</div>
|
180
190
|
|
181
191
|
</div>
|
data/public/frames.html
CHANGED
@@ -2,13 +2,18 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Documentation by YARD 0.9.
|
5
|
+
<title>Documentation by YARD 0.9.36</title>
|
6
6
|
</head>
|
7
7
|
<script type="text/javascript">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
var mainUrl = 'index.html';
|
9
|
+
try {
|
10
|
+
var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);
|
11
|
+
var name = match ? match[1] : mainUrl;
|
12
|
+
var url = new URL(name, location.href);
|
13
|
+
window.top.location.replace(url.origin === location.origin ? name : mainUrl);
|
14
|
+
} catch (e) {
|
15
|
+
window.top.location.replace(mainUrl);
|
16
|
+
}
|
12
17
|
</script>
|
13
18
|
<noscript>
|
14
19
|
<h1>Oops!</h1>
|