zabbix-ruby-client 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Zabbbix Ruby Client Changelog
2
2
  -----------------------------
3
3
 
4
+ ### v0.0.13 - 2013-10-08
5
+
6
+ * added an nginx plugin
7
+
4
8
  ### v0.0.12 - 2013-10-07
5
9
 
6
10
  * bugfix on memory calculation
data/README.md CHANGED
@@ -69,8 +69,9 @@ There are a set of standart plugins included in the package, aimed at linux syst
69
69
  * sysinfo (uses uname -a) is populating the host info in the inventory, and should be ran at setup and/or monthly [sysinfo_tpl](master/zabbix-templates/sysinfo_tpl.xml)
70
70
  * apache (depends on mod_status with status_extended on) [apache_tpl](master/zabbix-templates/apache_tpl.xml)
71
71
  * mysql (uses mysqladmin extended-status) [mysql_tpl](master/zabbix-templates/mysql_tpl.xml)
72
+ * nginx (requires httpStubStatus nginx module) [nginx_tpl](master/zabbix-templates/nginx_tpl.xml)
72
73
 
73
- You can add extra plugin directories in the configuration file.
74
+ You can add extra plugins in a plugins/ dir in the working dir, just by copying one of the existing plugins in the repo and change to your need. All plugins present in plugins/ will be loaded if present in the config file you use. That can be convenient to test by using the -t flag, for example `bundle exec zrc -t testplugin.yml` where testplugin.yml only contains the name and args for yoiur plugin.
74
75
 
75
76
  ## Todo
76
77
 
@@ -0,0 +1,44 @@
1
+ # uses http://wiki.nginx.org/HttpStubStatusModule
2
+
3
+ class ZabbixRubyClient
4
+ module Plugins
5
+ module Nginx
6
+ extend self
7
+
8
+ def collect(*args)
9
+ host = args[0]
10
+ info = get_status
11
+
12
+ time = Time.now.to_i
13
+ back = []
14
+ back << "#{host} nginx[total] #{time} #{info[:total]}"
15
+ back << "#{host} nginx[reading] #{time} #{info[:reading]}"
16
+ back << "#{host} nginx[writing] #{time} #{info[:writing]}"
17
+ back << "#{host} nginx[waiting] #{time} #{info[:waiting]}"
18
+ back << "#{host} nginx[accepted] #{time} #{info[:accepted]}"
19
+ back << "#{host} nginx[handled] #{time} #{info[:handled]}"
20
+ back << "#{host} nginx[requests] #{time} #{info[:requests]}"
21
+ return back
22
+ end
23
+
24
+ def get_status
25
+ ret = {}
26
+ open "http://127.0.0.1:8090/nginx_status" do |f|
27
+ f.each_line do |line|
28
+ ret[:total] = $1 if line =~ /^Active connections:\s+(\d+)/
29
+ if line =~ /^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/
30
+ ret[:reading] = $1
31
+ ret[:writing] = $2
32
+ ret[:waiting] = $3
33
+ end
34
+ ret[:accepted], ret[:handled], ret[:requests] = [$1, $2, $3] if line =~ /^\s+(\d+)\s+(\d+)\s+(\d+)/
35
+ end
36
+ end
37
+ ret
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+
44
+ ZabbixRubyClient::Plugins.register('nginx', ZabbixRubyClient::Plugins::Nginx)
@@ -1,3 +1,3 @@
1
1
  class ZabbixRubyClient
2
- VERSION ||= "0.0.12"
2
+ VERSION ||= "0.0.13"
3
3
  end
@@ -0,0 +1,388 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <zabbix_export>
3
+ <version>2.0</version>
4
+ <date>2013-10-08T11:40:24Z</date>
5
+ <groups>
6
+ <group>
7
+ <name>3. Service Nginx</name>
8
+ </group>
9
+ </groups>
10
+ <templates>
11
+ <template>
12
+ <template>Nginx</template>
13
+ <name>Nginx (zrc)</name>
14
+ <groups>
15
+ <group>
16
+ <name>3. Service Nginx</name>
17
+ </group>
18
+ </groups>
19
+ <applications>
20
+ <application>
21
+ <name>Nginx</name>
22
+ </application>
23
+ </applications>
24
+ <items>
25
+ <item>
26
+ <name>Connections per second</name>
27
+ <type>2</type>
28
+ <snmp_community/>
29
+ <multiplier>0</multiplier>
30
+ <snmp_oid/>
31
+ <key>nginx[accpeted]</key>
32
+ <delay>0</delay>
33
+ <history>90</history>
34
+ <trends>365</trends>
35
+ <status>0</status>
36
+ <value_type>3</value_type>
37
+ <allowed_hosts/>
38
+ <units>qps</units>
39
+ <delta>1</delta>
40
+ <snmpv3_securityname/>
41
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
42
+ <snmpv3_authpassphrase/>
43
+ <snmpv3_privpassphrase/>
44
+ <formula>1</formula>
45
+ <delay_flex/>
46
+ <params/>
47
+ <ipmi_sensor/>
48
+ <data_type>0</data_type>
49
+ <authtype>0</authtype>
50
+ <username/>
51
+ <password/>
52
+ <publickey/>
53
+ <privatekey/>
54
+ <port/>
55
+ <description/>
56
+ <inventory_link>0</inventory_link>
57
+ <applications>
58
+ <application>
59
+ <name>Nginx</name>
60
+ </application>
61
+ </applications>
62
+ <valuemap/>
63
+ </item>
64
+ <item>
65
+ <name>Connections reading</name>
66
+ <type>2</type>
67
+ <snmp_community/>
68
+ <multiplier>0</multiplier>
69
+ <snmp_oid/>
70
+ <key>nginx[reading]</key>
71
+ <delay>0</delay>
72
+ <history>90</history>
73
+ <trends>365</trends>
74
+ <status>0</status>
75
+ <value_type>3</value_type>
76
+ <allowed_hosts/>
77
+ <units/>
78
+ <delta>0</delta>
79
+ <snmpv3_securityname/>
80
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
81
+ <snmpv3_authpassphrase/>
82
+ <snmpv3_privpassphrase/>
83
+ <formula>1</formula>
84
+ <delay_flex/>
85
+ <params/>
86
+ <ipmi_sensor/>
87
+ <data_type>0</data_type>
88
+ <authtype>0</authtype>
89
+ <username/>
90
+ <password/>
91
+ <publickey/>
92
+ <privatekey/>
93
+ <port/>
94
+ <description/>
95
+ <inventory_link>0</inventory_link>
96
+ <applications>
97
+ <application>
98
+ <name>Nginx</name>
99
+ </application>
100
+ </applications>
101
+ <valuemap/>
102
+ </item>
103
+ <item>
104
+ <name>Connections total</name>
105
+ <type>2</type>
106
+ <snmp_community/>
107
+ <multiplier>0</multiplier>
108
+ <snmp_oid/>
109
+ <key>nginx[total]</key>
110
+ <delay>0</delay>
111
+ <history>90</history>
112
+ <trends>365</trends>
113
+ <status>0</status>
114
+ <value_type>3</value_type>
115
+ <allowed_hosts/>
116
+ <units/>
117
+ <delta>0</delta>
118
+ <snmpv3_securityname/>
119
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
120
+ <snmpv3_authpassphrase/>
121
+ <snmpv3_privpassphrase/>
122
+ <formula>1</formula>
123
+ <delay_flex/>
124
+ <params/>
125
+ <ipmi_sensor/>
126
+ <data_type>0</data_type>
127
+ <authtype>0</authtype>
128
+ <username/>
129
+ <password/>
130
+ <publickey/>
131
+ <privatekey/>
132
+ <port/>
133
+ <description/>
134
+ <inventory_link>0</inventory_link>
135
+ <applications>
136
+ <application>
137
+ <name>Nginx</name>
138
+ </application>
139
+ </applications>
140
+ <valuemap/>
141
+ </item>
142
+ <item>
143
+ <name>Connections waiting</name>
144
+ <type>2</type>
145
+ <snmp_community/>
146
+ <multiplier>0</multiplier>
147
+ <snmp_oid/>
148
+ <key>nginx[waiting]</key>
149
+ <delay>0</delay>
150
+ <history>90</history>
151
+ <trends>365</trends>
152
+ <status>0</status>
153
+ <value_type>3</value_type>
154
+ <allowed_hosts/>
155
+ <units/>
156
+ <delta>0</delta>
157
+ <snmpv3_securityname/>
158
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
159
+ <snmpv3_authpassphrase/>
160
+ <snmpv3_privpassphrase/>
161
+ <formula>1</formula>
162
+ <delay_flex/>
163
+ <params/>
164
+ <ipmi_sensor/>
165
+ <data_type>0</data_type>
166
+ <authtype>0</authtype>
167
+ <username/>
168
+ <password/>
169
+ <publickey/>
170
+ <privatekey/>
171
+ <port/>
172
+ <description/>
173
+ <inventory_link>0</inventory_link>
174
+ <applications>
175
+ <application>
176
+ <name>Nginx</name>
177
+ </application>
178
+ </applications>
179
+ <valuemap/>
180
+ </item>
181
+ <item>
182
+ <name>Connections writing</name>
183
+ <type>2</type>
184
+ <snmp_community/>
185
+ <multiplier>0</multiplier>
186
+ <snmp_oid/>
187
+ <key>nginx[writing]</key>
188
+ <delay>0</delay>
189
+ <history>90</history>
190
+ <trends>365</trends>
191
+ <status>0</status>
192
+ <value_type>3</value_type>
193
+ <allowed_hosts/>
194
+ <units/>
195
+ <delta>0</delta>
196
+ <snmpv3_securityname/>
197
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
198
+ <snmpv3_authpassphrase/>
199
+ <snmpv3_privpassphrase/>
200
+ <formula>1</formula>
201
+ <delay_flex/>
202
+ <params/>
203
+ <ipmi_sensor/>
204
+ <data_type>0</data_type>
205
+ <authtype>0</authtype>
206
+ <username/>
207
+ <password/>
208
+ <publickey/>
209
+ <privatekey/>
210
+ <port/>
211
+ <description/>
212
+ <inventory_link>0</inventory_link>
213
+ <applications>
214
+ <application>
215
+ <name>Nginx</name>
216
+ </application>
217
+ </applications>
218
+ <valuemap/>
219
+ </item>
220
+ <item>
221
+ <name>Requests per second</name>
222
+ <type>2</type>
223
+ <snmp_community/>
224
+ <multiplier>0</multiplier>
225
+ <snmp_oid/>
226
+ <key>nginx[requests]</key>
227
+ <delay>0</delay>
228
+ <history>90</history>
229
+ <trends>365</trends>
230
+ <status>0</status>
231
+ <value_type>0</value_type>
232
+ <allowed_hosts/>
233
+ <units>qps</units>
234
+ <delta>1</delta>
235
+ <snmpv3_securityname/>
236
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
237
+ <snmpv3_authpassphrase/>
238
+ <snmpv3_privpassphrase/>
239
+ <formula>1</formula>
240
+ <delay_flex/>
241
+ <params/>
242
+ <ipmi_sensor/>
243
+ <data_type>0</data_type>
244
+ <authtype>0</authtype>
245
+ <username/>
246
+ <password/>
247
+ <publickey/>
248
+ <privatekey/>
249
+ <port/>
250
+ <description/>
251
+ <inventory_link>0</inventory_link>
252
+ <applications>
253
+ <application>
254
+ <name>Nginx</name>
255
+ </application>
256
+ </applications>
257
+ <valuemap/>
258
+ </item>
259
+ </items>
260
+ <discovery_rules/>
261
+ <macros/>
262
+ <templates/>
263
+ <screens/>
264
+ </template>
265
+ </templates>
266
+ <graphs>
267
+ <graph>
268
+ <name>Nginx Connections</name>
269
+ <width>900</width>
270
+ <height>200</height>
271
+ <yaxismin>0.0000</yaxismin>
272
+ <yaxismax>100.0000</yaxismax>
273
+ <show_work_period>1</show_work_period>
274
+ <show_triggers>1</show_triggers>
275
+ <type>1</type>
276
+ <show_legend>1</show_legend>
277
+ <show_3d>0</show_3d>
278
+ <percent_left>0.0000</percent_left>
279
+ <percent_right>0.0000</percent_right>
280
+ <ymin_type_1>0</ymin_type_1>
281
+ <ymax_type_1>0</ymax_type_1>
282
+ <ymin_item_1>0</ymin_item_1>
283
+ <ymax_item_1>0</ymax_item_1>
284
+ <graph_items>
285
+ <graph_item>
286
+ <sortorder>0</sortorder>
287
+ <drawtype>0</drawtype>
288
+ <color>66FF66</color>
289
+ <yaxisside>0</yaxisside>
290
+ <calc_fnc>2</calc_fnc>
291
+ <type>0</type>
292
+ <item>
293
+ <host>Nginx</host>
294
+ <key>nginx[reading]</key>
295
+ </item>
296
+ </graph_item>
297
+ <graph_item>
298
+ <sortorder>1</sortorder>
299
+ <drawtype>0</drawtype>
300
+ <color>6666FF</color>
301
+ <yaxisside>0</yaxisside>
302
+ <calc_fnc>2</calc_fnc>
303
+ <type>0</type>
304
+ <item>
305
+ <host>Nginx</host>
306
+ <key>nginx[writing]</key>
307
+ </item>
308
+ </graph_item>
309
+ <graph_item>
310
+ <sortorder>2</sortorder>
311
+ <drawtype>0</drawtype>
312
+ <color>FFFFCC</color>
313
+ <yaxisside>0</yaxisside>
314
+ <calc_fnc>2</calc_fnc>
315
+ <type>0</type>
316
+ <item>
317
+ <host>Nginx</host>
318
+ <key>nginx[waiting]</key>
319
+ </item>
320
+ </graph_item>
321
+ </graph_items>
322
+ </graph>
323
+ <graph>
324
+ <name>Nginx Requests</name>
325
+ <width>900</width>
326
+ <height>200</height>
327
+ <yaxismin>0.0000</yaxismin>
328
+ <yaxismax>100.0000</yaxismax>
329
+ <show_work_period>1</show_work_period>
330
+ <show_triggers>1</show_triggers>
331
+ <type>0</type>
332
+ <show_legend>1</show_legend>
333
+ <show_3d>0</show_3d>
334
+ <percent_left>0.0000</percent_left>
335
+ <percent_right>0.0000</percent_right>
336
+ <ymin_type_1>0</ymin_type_1>
337
+ <ymax_type_1>0</ymax_type_1>
338
+ <ymin_item_1>0</ymin_item_1>
339
+ <ymax_item_1>0</ymax_item_1>
340
+ <graph_items>
341
+ <graph_item>
342
+ <sortorder>0</sortorder>
343
+ <drawtype>5</drawtype>
344
+ <color>FF6666</color>
345
+ <yaxisside>0</yaxisside>
346
+ <calc_fnc>7</calc_fnc>
347
+ <type>0</type>
348
+ <item>
349
+ <host>Nginx</host>
350
+ <key>nginx[requests]</key>
351
+ </item>
352
+ </graph_item>
353
+ </graph_items>
354
+ </graph>
355
+ <graph>
356
+ <name>s. Nginx Requests</name>
357
+ <width>900</width>
358
+ <height>200</height>
359
+ <yaxismin>0.0000</yaxismin>
360
+ <yaxismax>100.0000</yaxismax>
361
+ <show_work_period>1</show_work_period>
362
+ <show_triggers>0</show_triggers>
363
+ <type>0</type>
364
+ <show_legend>0</show_legend>
365
+ <show_3d>0</show_3d>
366
+ <percent_left>0.0000</percent_left>
367
+ <percent_right>0.0000</percent_right>
368
+ <ymin_type_1>0</ymin_type_1>
369
+ <ymax_type_1>0</ymax_type_1>
370
+ <ymin_item_1>0</ymin_item_1>
371
+ <ymax_item_1>0</ymax_item_1>
372
+ <graph_items>
373
+ <graph_item>
374
+ <sortorder>0</sortorder>
375
+ <drawtype>5</drawtype>
376
+ <color>FF6666</color>
377
+ <yaxisside>0</yaxisside>
378
+ <calc_fnc>7</calc_fnc>
379
+ <type>0</type>
380
+ <item>
381
+ <host>Nginx</host>
382
+ <key>nginx[requests]</key>
383
+ </item>
384
+ </graph_item>
385
+ </graph_items>
386
+ </graph>
387
+ </graphs>
388
+ </zabbix_export>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -102,6 +102,7 @@ files:
102
102
  - lib/zabbix-ruby-client/plugins/memory.rb
103
103
  - lib/zabbix-ruby-client/plugins/mysql.rb
104
104
  - lib/zabbix-ruby-client/plugins/network.rb
105
+ - lib/zabbix-ruby-client/plugins/nginx.rb
105
106
  - lib/zabbix-ruby-client/plugins/sysinfo.rb
106
107
  - lib/zabbix-ruby-client/plugins/who.rb
107
108
  - lib/zabbix-ruby-client/version.rb
@@ -136,6 +137,7 @@ files:
136
137
  - zabbix-templates/memory_tpl.xml
137
138
  - zabbix-templates/mysql_tpl.xml
138
139
  - zabbix-templates/network_tpl.xml
140
+ - zabbix-templates/nginx_tpl.xml
139
141
  - zabbix-templates/sysinfo_tpl.xml
140
142
  - zabbix-templates/system_tpl.xml
141
143
  homepage: https://github.com/eduvo/zabbix-ruby-client
@@ -153,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
155
  version: '0'
154
156
  segments:
155
157
  - 0
156
- hash: -2344962165856229527
158
+ hash: 349719088865258310
157
159
  required_rubygems_version: !ruby/object:Gem::Requirement
158
160
  none: false
159
161
  requirements:
@@ -162,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  version: '0'
163
165
  segments:
164
166
  - 0
165
- hash: -2344962165856229527
167
+ hash: 349719088865258310
166
168
  requirements: []
167
169
  rubyforge_project:
168
170
  rubygems_version: 1.8.23