zabbix-ruby-client 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1ee64f86d9fde1c3c037e228c7b1210063de95a4
4
+ data.tar.gz: cb9818f7a8a2a52c2b86be6210eae24c9d454908
5
+ SHA512:
6
+ metadata.gz: 37097420a266843b8c5d3beb7747debcbf197117d62b3f5a0a15fec8ffe34d14f2820ccddebfb9f9ab2fe9335e231ec51fd9c920f11ac0d03d08543f4f31040e
7
+ data.tar.gz: 29485fb483e432aeb8458dc083f6e4ef1eee11c071e488b6ca554568802d693486c588945c95530c975d5468b5d7c15c6701bfad070b372d449cc3134b852925
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  Zabbbix Ruby Client Changelog
2
2
  -----------------------------
3
3
 
4
+ ### v0.0.15 - 2013-10-23
5
+
6
+ * prototype of a way to keep data when sending fails and sending it again at next iteration
7
+ * refactoring in several classes for better testability and nicer code
8
+ * add port in the zabbix-sender command that was forgotten there
9
+ * fix disk template alarm subject
10
+ * fix datafile naming for when you get different task files ran at same time
11
+ * improve cpu and disk triggers with dependencies (but waiting for ZBXNEXT-1229)
12
+
4
13
  ### v0.0.14 - 2013-10-14
5
14
 
6
15
  * better explanation about how to make custom plugins
data/README.md CHANGED
@@ -10,6 +10,23 @@ The development is still in progress but it produces results and works in my cas
10
10
 
11
11
  Check the [Changelog](CHANGELOG.md) for recent changes, code is still under huge development and is likely to move a lot until version 0.1.
12
12
 
13
+ ## Why ?
14
+
15
+ Yes why use zabbix ruby client with zabbix-sender rather than zabbix-agent ?
16
+
17
+ There are various reasons for that. But the purpose of this tool ultimately is to fulfill the functions of the zabbix-sender, reducing the requirement of installation to only the zabbix ruby client.
18
+
19
+ There are compromises that make this use of the sender with zabbix ruby client pertinent:
20
+
21
+ * you prefer to rely on a cronjob rather than on a daemon for data collection
22
+ * you don't mind having a minimum time between data collection of 1 minute (cron don't handle seconds)
23
+ * you want to specify your discovery at client level rather than at server level. When I first used auto discovery for interfaces or file systems, it was discovering such a huge number of things with such a wide inconsistency of naming that it was pretty hard to think about a regexp to limit what was pertinent or not. Sometimes a discovery rule would need to have a regexp per host, which zabbix don't permit, or it gets very complicated. In a very diverse context, declarative discovery is much simpler.
24
+ * you already have ruby installed on all your servers (which is the case if you use chef or puppet)
25
+
26
+ The objectives for version 0.1 of zabbix ruby client are to be able to handle dropping connection by buffering the data collection and send all what was not sent the next time it's possible. So there should be no real difference on that feature with the agent.
27
+
28
+ At some point all zabbix ruby client plugins will be usable by the agent as well, actually, so it should not make any difference. But the initial setup I have in my infrastructure led me to chose the sender rather than the agent. But that will be later on when the code will get better abstraction. For now I just want it to work and collect my data. Which it does. The full compatibility for use by the agent would probably be a target for version 0.2.
29
+
13
30
  ## Installation
14
31
 
15
32
  Install it yourself as:
@@ -53,7 +70,7 @@ Here is an example setup using the files generated by the init:
53
70
  0 * * * * /bin/zsh -c ". $HOME/.rvm/scripts/rvm && cd $HOME/zrc && bundle exec zrc upload -t hourly.yml"
54
71
  0 0 1 * * /bin/zsh -c ". $HOME/.rvm/scripts/rvm && cd $HOME/zrc && bundle exec zrc upload -t monthly.yml"
55
72
 
56
- ## plugins
73
+ ## Plugins
57
74
 
58
75
  There are a set of standart plugins included in the package, aimed at linux systems.
59
76
 
@@ -70,7 +87,7 @@ There are a set of standart plugins included in the package, aimed at linux syst
70
87
  * apache (depends on mod_status with status_extended on) [apache_tpl](master/zabbix-templates/apache_tpl.xml)
71
88
  * mysql (uses mysqladmin extended-status) [mysql_tpl](master/zabbix-templates/mysql_tpl.xml)
72
89
  * nginx (requires httpStubStatus nginx module) [nginx_tpl](master/zabbix-templates/nginx_tpl.xml)
73
- * redis (uses redis-cli info) [redis_tpl](master/zabbix-templates/redis_tpl.xml) (unfinished)
90
+ * redis (uses redis-cli info) [redis_tpl](master/zabbix-templates/redis_tpl.xml)
74
91
  * args [ "/path/to/redis-cli", "options to connect" ]
75
92
 
76
93
  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.
@@ -121,6 +138,10 @@ $ bundle exec zrc show -t myplugin.yml
121
138
  myhost myplugin[item] 1381669455 something 42
122
139
  ```
123
140
 
141
+ ## What is server or network goes down ?
142
+
143
+ The zabbix ruby client has a pending system, that keeps the data if it was not sent, for sending it in the next iteration. Data is kept at each iteration until it's delivered (experimental feature).
144
+
124
145
  ## Note about security
125
146
 
126
147
  As you may already know, Zabbix is not very concerned about securing exchanges between agent and server, or sender and server. A cautious sysadmin will then properly manage his setup using ssh tunneling.
@@ -1,11 +1,13 @@
1
1
  require "zabbix-ruby-client/version"
2
2
  require "zabbix-ruby-client/logger"
3
3
  require "zabbix-ruby-client/plugins"
4
+ require "zabbix-ruby-client/store"
5
+ require "zabbix-ruby-client/data"
4
6
  require "yaml"
5
7
 
6
8
  class ZabbixRubyClient
7
9
 
8
- def initialize(config_file,task_file)
10
+ def initialize(config_file, task_file)
9
11
  begin
10
12
  @config ||= YAML::load_file(config_file)
11
13
  if File.exists? task_file
@@ -18,87 +20,56 @@ class ZabbixRubyClient
18
20
  puts e.message
19
21
  return
20
22
  end
23
+
24
+ @store = Store.new(
25
+ @config['datadir'],
26
+ @config['zabbix']['host'],
27
+ File.basename(task_file,'.yml'),
28
+ @config['keepdata']
29
+ )
30
+
31
+ @data = Data.new(@config['host'])
32
+
33
+ @config["server"] = File.basename(config_file,'.yml')
21
34
  @logsdir = makedir(@config['logsdir'],'logs')
22
- @datadir = makedir(@config['datadir'],'data')
23
35
  @plugindirs = [ File.expand_path("../zabbix-ruby-client/plugins", __FILE__) ]
24
36
  if @config["plugindirs"]
25
37
  @plugindirs = @plugindirs + @config["plugindirs"]
26
38
  end
27
- @discover = {}
28
- @data = []
29
39
  Plugins.load_dirs @plugindirs
30
40
  logger.debug @config.inspect
31
41
  end
32
42
 
33
- def datafile
34
- now = Time.now
35
- @datafile ||= if @config['keepdata']
36
- unless Dir.exists? File.join(@datadir,Time.now.strftime("%Y-%m-%d"))
37
- FileUtils.mkdir File.join(@datadir,Time.now.strftime("%Y-%m-%d"))
38
- end
39
- File.join(@datadir,Time.now.strftime("%Y-%m-%d"),"data_"+Time.now.strftime("%H%M%S"))
40
- else
41
- File.join(@datadir,"data")
42
- end
43
- end
44
-
45
- def run_plugin(plugin, args = nil)
46
- Plugins.load(plugin) || logger.error( "Plugin #{plugin} not found.")
47
- if Plugins.loaded[plugin]
48
- begin
49
- @data = @data + Plugins.loaded[plugin].send(:collect, @config['host'], *args)
50
- if Plugins.loaded[plugin].respond_to?(:discover)
51
- key, value = Plugins.loaded[plugin].send(:discover, *args)
52
- @discover[key] ||= []
53
- @discover[key] << [ value ]
54
- end
55
- rescue Exception => e
56
- logger.fatal "Oops"
57
- logger.fatal e.message
58
- end
59
- end
60
- end
61
-
62
43
  def collect
63
44
  @tasks.each do |plugin|
64
- run_plugin(plugin['name'], plugin['args'])
45
+ @data.run_plugin(plugin['name'], plugin['args'])
65
46
  end
66
47
  end
67
48
 
68
49
  def show
69
- merge_discover
70
- @data.each do |line|
50
+ @data.merge.each do |line|
71
51
  puts line
72
52
  end
73
53
  end
74
54
 
75
- def store
76
- File.open(datafile, "w") do |f|
77
- @data.each do |d|
78
- f.puts d
79
- end
80
- end
81
- end
82
-
83
- def merge_discover
84
- time = Time.now.to_i
85
- @data = @discover.reduce([]) do |a,(k,v)|
86
- a << "#{@config['host']} #{k} #{time} { \"data\": [ #{v.join(', ')} ] }"
87
- a
88
- end + @data
89
- end
90
-
91
55
  def upload
92
- merge_discover
93
- store
56
+ file = @store.record(@data.merge)
94
57
  begin
95
- res = `#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -T -i #{datafile}`
58
+ res = `#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}`
59
+ if $?.to_i != 0
60
+ @store.keepdata(file)
61
+ end
96
62
  rescue Exception => e
63
+ @store.keepdata(file)
97
64
  logger.error "Sending failed."
98
65
  logger.error e.message
99
66
  end
100
67
  end
101
68
 
69
+ def logger
70
+ @logger ||= Logger.get_logger(@logsdir, @config["loglevel"])
71
+ end
72
+
102
73
  private
103
74
 
104
75
  def makedir(configdir, defaultdir)
@@ -107,8 +78,4 @@ class ZabbixRubyClient
107
78
  dir
108
79
  end
109
80
 
110
- def logger
111
- @logger ||= Logger.get_logger(@logsdir, @config["loglevel"])
112
- end
113
-
114
81
  end
@@ -0,0 +1,36 @@
1
+ class ZabbixRubyClient
2
+ class Data
3
+
4
+ def initialize(host)
5
+ @discover = {}
6
+ @items = []
7
+ @host = host
8
+ end
9
+
10
+ def run_plugin(plugin, args = nil)
11
+ Plugins.load(plugin) || logger.error( "Plugin #{plugin} not found.")
12
+ if Plugins.loaded[plugin]
13
+ begin
14
+ @items += Plugins.loaded[plugin].send(:collect, @host, *args)
15
+ if Plugins.loaded[plugin].respond_to?(:discover)
16
+ key, value = Plugins.loaded[plugin].send(:discover, *args)
17
+ @discover[key] ||= []
18
+ @discover[key] << [ value ]
19
+ end
20
+ rescue Exception => e
21
+ logger.fatal "Oops"
22
+ logger.fatal e.message
23
+ end
24
+ end
25
+ end
26
+
27
+ def merge
28
+ time = Time.now.to_i
29
+ @discover.reduce([]) do |a,(k,v)|
30
+ a << "#{@host} #{k} #{time} { \"data\": [ #{v.join(', ')} ] }"
31
+ a
32
+ end + @items
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,55 @@
1
+ class ZabbixRubyClient
2
+ class Store
3
+
4
+ def initialize(dir, server, task, keepdata=false)
5
+ @dir = dir
6
+ @server = server
7
+ @task = task
8
+ @keepdata = keepdata
9
+ @basename = "#{@server}-#{@task}-data"
10
+ end
11
+
12
+ def datafile
13
+ @datafile ||= if @keepdata
14
+ unless Dir.exists? File.join(@dir, Time.now.strftime("%Y-%m-%d"))
15
+ FileUtils.mkdir File.join(@dir, Time.now.strftime("%Y-%m-%d"))
16
+ end
17
+ File.join(@dir, Time.now.strftime("%Y-%m-%d"),"#{@basename}_"+Time.now.strftime("%H%M%S"))
18
+ else
19
+ File.join(@dir, @basename)
20
+ end
21
+ end
22
+
23
+ def record(data)
24
+ write(data, datafile, pending_content)
25
+ end
26
+
27
+ def keepdata(file)
28
+ FileUtils.mv(file, pendingfile)
29
+ end
30
+
31
+ def pendingfile
32
+ @pendingfile ||= File.join(@dir, "#{@server}-pending")
33
+ end
34
+
35
+ def pending_content
36
+ pending = ""
37
+ if File.exists? pendingfile
38
+ pending = File.open(pendingfile,'r').read
39
+ File.delete(pendingfile)
40
+ end
41
+ pending
42
+ end
43
+
44
+ def write(data, file, prepend = "")
45
+ File.open(file, "w") do |f|
46
+ f.write(prepend)
47
+ data.each do |d|
48
+ f.puts d
49
+ end
50
+ end
51
+ file
52
+ end
53
+
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  class ZabbixRubyClient
2
- VERSION ||= "0.0.14"
2
+ VERSION ||= "0.0.15"
3
3
  end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require "zabbix-ruby-client/data"
5
+
6
+ describe ZabbixRubyClient::Data do
7
+
8
+ end
@@ -0,0 +1,80 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require "zabbix-ruby-client/store"
5
+
6
+ describe ZabbixRubyClient::Store do
7
+
8
+ before :all do
9
+ @datadir = File.expand_path("../../files/data", __FILE__)
10
+ @data = [ "1", "2" ]
11
+ @file = File.join(@datadir,"test")
12
+ end
13
+
14
+ before :each do
15
+ @store = ZabbixRubyClient::Store.new(@datadir, "server", "task")
16
+ end
17
+
18
+ after :each do
19
+ File.unlink(@file) if File.exists?(@file)
20
+ File.unlink(@store.pendingfile) if File.exists?(@store.pendingfile)
21
+ end
22
+
23
+ describe "write method" do
24
+
25
+ it ".write really writes a file" do
26
+ @store.write(@data,@file)
27
+ expect(File.exists?(@file)).to be true
28
+ end
29
+
30
+ it ".write record the data" do
31
+ file = File.join(@datadir,"test")
32
+ @store.write(@data,@file)
33
+ expect(File.read(@file)).to eq "1\n2\n"
34
+ end
35
+
36
+ it ".write record the data prepended if any" do
37
+ file = File.join(@datadir,"test")
38
+ @store.write(@data,@file, "something\n")
39
+ expect(File.read(@file)).to eq "something\n1\n2\n"
40
+ end
41
+
42
+ it ".write returns the name of the file" do
43
+ file = File.join(@datadir,"test")
44
+ expect(@store.write(@data,@file)).to eq @file
45
+ end
46
+
47
+ end
48
+
49
+ it "knows about pendingfile" do
50
+ expect(@store.pendingfile).to eq File.join(@datadir, "server-pending")
51
+ end
52
+
53
+ it "find no pending content if pending file is not here" do
54
+ expect(@store.pending_content).to eq ""
55
+ end
56
+
57
+ it "finds a pending content if there is a file" do
58
+ File.write(@store.pendingfile,"ha\n")
59
+ expect(@store.pending_content).to eq "ha\n"
60
+ end
61
+
62
+ it "erase the pendingfile if found" do
63
+ File.write(@store.pendingfile,"ha\n")
64
+ @store.pending_content
65
+ expect(File.exists?(@store.pendingfile)).to be false
66
+ end
67
+
68
+ it "keepdata moves the datafile" do
69
+ File.write(@file,"ha\n")
70
+ @store.keepdata(@file)
71
+ expect(File.exists?(@store.pendingfile)).to be true
72
+ expect(File.exists?(@file)).to be false
73
+ end
74
+
75
+ it "records data using the write method" do
76
+ expect(@store).to receive(:write).with(@data, @store.datafile, @store.pending_content)
77
+ @store.record(@data)
78
+ end
79
+
80
+ end
@@ -13,4 +13,4 @@ describe ZabbixRubyClient do
13
13
  pending "runs list of plugins according to config"
14
14
  pending "issues the upload command according to config"
15
15
 
16
- end
16
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,4 +7,4 @@ RSpec.configure do |config|
7
7
  config.expect_with :rspec do |c|
8
8
  c.syntax = :expect
9
9
  end
10
- end
10
+ end
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <zabbix_export>
3
3
  <version>2.0</version>
4
- <date>2013-10-01T06:29:18Z</date>
4
+ <date>2013-10-17T21:37:42Z</date>
5
5
  <groups>
6
6
  <group>
7
7
  <name>3. Service Apache</name>
@@ -30,7 +30,7 @@
30
30
  <snmp_oid/>
31
31
  <key>apache[BusyWorkers]</key>
32
32
  <delay>0</delay>
33
- <history>7</history>
33
+ <history>90</history>
34
34
  <trends>365</trends>
35
35
  <status>0</status>
36
36
  <value_type>3</value_type>
@@ -69,7 +69,7 @@
69
69
  <snmp_oid/>
70
70
  <key>apache[BytesPerReq]</key>
71
71
  <delay>0</delay>
72
- <history>7</history>
72
+ <history>90</history>
73
73
  <trends>365</trends>
74
74
  <status>0</status>
75
75
  <value_type>0</value_type>
@@ -108,7 +108,7 @@
108
108
  <snmp_oid/>
109
109
  <key>apache[BytesPerSec]</key>
110
110
  <delay>0</delay>
111
- <history>7</history>
111
+ <history>90</history>
112
112
  <trends>365</trends>
113
113
  <status>0</status>
114
114
  <value_type>0</value_type>
@@ -147,7 +147,7 @@
147
147
  <snmp_oid/>
148
148
  <key>apache[c_closing]</key>
149
149
  <delay>0</delay>
150
- <history>7</history>
150
+ <history>90</history>
151
151
  <trends>365</trends>
152
152
  <status>0</status>
153
153
  <value_type>3</value_type>
@@ -186,7 +186,7 @@
186
186
  <snmp_oid/>
187
187
  <key>apache[CPULoad]</key>
188
188
  <delay>0</delay>
189
- <history>7</history>
189
+ <history>90</history>
190
190
  <trends>365</trends>
191
191
  <status>0</status>
192
192
  <value_type>0</value_type>
@@ -225,7 +225,7 @@
225
225
  <snmp_oid/>
226
226
  <key>apache[c_dns]</key>
227
227
  <delay>0</delay>
228
- <history>7</history>
228
+ <history>90</history>
229
229
  <trends>365</trends>
230
230
  <status>0</status>
231
231
  <value_type>3</value_type>
@@ -264,7 +264,7 @@
264
264
  <snmp_oid/>
265
265
  <key>apache[FreeWorkers]</key>
266
266
  <delay>60</delay>
267
- <history>7</history>
267
+ <history>90</history>
268
268
  <trends>365</trends>
269
269
  <status>0</status>
270
270
  <value_type>0</value_type>
@@ -303,7 +303,7 @@
303
303
  <snmp_oid/>
304
304
  <key>apache[c_finish]</key>
305
305
  <delay>0</delay>
306
- <history>7</history>
306
+ <history>90</history>
307
307
  <trends>365</trends>
308
308
  <status>0</status>
309
309
  <value_type>3</value_type>
@@ -334,6 +334,47 @@
334
334
  </applications>
335
335
  <valuemap/>
336
336
  </item>
337
+ <item>
338
+ <name>HTTP Check</name>
339
+ <type>3</type>
340
+ <snmp_community/>
341
+ <multiplier>0</multiplier>
342
+ <snmp_oid/>
343
+ <key>net.tcp.service[http]</key>
344
+ <delay>30</delay>
345
+ <history>90</history>
346
+ <trends>365</trends>
347
+ <status>0</status>
348
+ <value_type>3</value_type>
349
+ <allowed_hosts/>
350
+ <units/>
351
+ <delta>0</delta>
352
+ <snmpv3_securityname/>
353
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
354
+ <snmpv3_authpassphrase/>
355
+ <snmpv3_privpassphrase/>
356
+ <formula>1</formula>
357
+ <delay_flex/>
358
+ <params/>
359
+ <ipmi_sensor/>
360
+ <data_type>3</data_type>
361
+ <authtype>0</authtype>
362
+ <username/>
363
+ <password/>
364
+ <publickey/>
365
+ <privatekey/>
366
+ <port/>
367
+ <description/>
368
+ <inventory_link>0</inventory_link>
369
+ <applications>
370
+ <application>
371
+ <name>APACHE</name>
372
+ </application>
373
+ </applications>
374
+ <valuemap>
375
+ <name>Service state</name>
376
+ </valuemap>
377
+ </item>
337
378
  <item>
338
379
  <name>Idle</name>
339
380
  <type>2</type>
@@ -342,7 +383,7 @@
342
383
  <snmp_oid/>
343
384
  <key>apache[c_idle]</key>
344
385
  <delay>0</delay>
345
- <history>7</history>
386
+ <history>90</history>
346
387
  <trends>365</trends>
347
388
  <status>0</status>
348
389
  <value_type>3</value_type>
@@ -381,7 +422,7 @@
381
422
  <snmp_oid/>
382
423
  <key>apache[c_cleanup]</key>
383
424
  <delay>0</delay>
384
- <history>7</history>
425
+ <history>90</history>
385
426
  <trends>365</trends>
386
427
  <status>0</status>
387
428
  <value_type>3</value_type>
@@ -420,7 +461,7 @@
420
461
  <snmp_oid/>
421
462
  <key>apache[IdleWorkers]</key>
422
463
  <delay>0</delay>
423
- <history>7</history>
464
+ <history>90</history>
424
465
  <trends>365</trends>
425
466
  <status>0</status>
426
467
  <value_type>3</value_type>
@@ -459,7 +500,7 @@
459
500
  <snmp_oid/>
460
501
  <key>apache[c_keep]</key>
461
502
  <delay>0</delay>
462
- <history>7</history>
503
+ <history>90</history>
463
504
  <trends>365</trends>
464
505
  <status>0</status>
465
506
  <value_type>3</value_type>
@@ -498,7 +539,7 @@
498
539
  <snmp_oid/>
499
540
  <key>apache[c_log]</key>
500
541
  <delay>0</delay>
501
- <history>7</history>
542
+ <history>90</history>
502
543
  <trends>365</trends>
503
544
  <status>0</status>
504
545
  <value_type>3</value_type>
@@ -537,7 +578,7 @@
537
578
  <snmp_oid/>
538
579
  <key>apache[c_read]</key>
539
580
  <delay>0</delay>
540
- <history>7</history>
581
+ <history>90</history>
541
582
  <trends>365</trends>
542
583
  <status>0</status>
543
584
  <value_type>3</value_type>
@@ -576,7 +617,7 @@
576
617
  <snmp_oid/>
577
618
  <key>apache[ReqPerSec]</key>
578
619
  <delay>0</delay>
579
- <history>7</history>
620
+ <history>90</history>
580
621
  <trends>365</trends>
581
622
  <status>0</status>
582
623
  <value_type>0</value_type>
@@ -615,7 +656,7 @@
615
656
  <snmp_oid/>
616
657
  <key>apache[c_send]</key>
617
658
  <delay>0</delay>
618
- <history>7</history>
659
+ <history>90</history>
619
660
  <trends>365</trends>
620
661
  <status>0</status>
621
662
  <value_type>3</value_type>
@@ -654,7 +695,7 @@
654
695
  <snmp_oid/>
655
696
  <key>apache[c_start]</key>
656
697
  <delay>0</delay>
657
- <history>7</history>
698
+ <history>90</history>
658
699
  <trends>365</trends>
659
700
  <status>0</status>
660
701
  <value_type>3</value_type>
@@ -693,7 +734,7 @@
693
734
  <snmp_oid/>
694
735
  <key>apache[TotalAccesses]</key>
695
736
  <delay>0</delay>
696
- <history>7</history>
737
+ <history>90</history>
697
738
  <trends>365</trends>
698
739
  <status>0</status>
699
740
  <value_type>3</value_type>
@@ -732,7 +773,7 @@
732
773
  <snmp_oid/>
733
774
  <key>apache[TotalKBytes]</key>
734
775
  <delay>0</delay>
735
- <history>7</history>
776
+ <history>90</history>
736
777
  <trends>365</trends>
737
778
  <status>0</status>
738
779
  <value_type>0</value_type>
@@ -771,7 +812,7 @@
771
812
  <snmp_oid/>
772
813
  <key>apache[Uptime]</key>
773
814
  <delay>0</delay>
774
- <history>7</history>
815
+ <history>90</history>
775
816
  <trends>365</trends>
776
817
  <status>0</status>
777
818
  <value_type>0</value_type>
@@ -810,7 +851,7 @@
810
851
  <snmp_oid/>
811
852
  <key>apache[c_waiting]</key>
812
853
  <delay>0</delay>
813
- <history>7</history>
854
+ <history>90</history>
814
855
  <trends>365</trends>
815
856
  <status>0</status>
816
857
  <value_type>3</value_type>
@@ -916,6 +957,18 @@
916
957
  </screens>
917
958
  </template>
918
959
  </templates>
960
+ <triggers>
961
+ <trigger>
962
+ <expression>{Apache Stats:net.tcp.service[http].last(0)}=0</expression>
963
+ <name>Apache Down</name>
964
+ <url/>
965
+ <status>0</status>
966
+ <priority>5</priority>
967
+ <description/>
968
+ <type>0</type>
969
+ <dependencies/>
970
+ </trigger>
971
+ </triggers>
919
972
  <graphs>
920
973
  <graph>
921
974
  <name>Apache connections</name>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <zabbix_export>
3
3
  <version>2.0</version>
4
- <date>2013-10-01T06:29:53Z</date>
4
+ <date>2013-10-19T08:17:55Z</date>
5
5
  <groups>
6
6
  <group>
7
7
  <name>3. Service Ubuntu</name>
@@ -850,7 +850,7 @@
850
850
  </templates>
851
851
  <triggers>
852
852
  <trigger>
853
- <expression>{CPU zrc:cpu[used_percent].max(120)}&gt;90</expression>
853
+ <expression>{CPU zrc:cpu[used_percent].min(120)}&gt;90</expression>
854
854
  <name>extreme CPU use</name>
855
855
  <url/>
856
856
  <status>0</status>
@@ -860,14 +860,19 @@
860
860
  <dependencies/>
861
861
  </trigger>
862
862
  <trigger>
863
- <expression>{CPU zrc:cpu[used_percent].max(120)}&gt;80</expression>
863
+ <expression>{CPU zrc:cpu[used_percent].min(120)}&gt;80</expression>
864
864
  <name>high CPU use</name>
865
865
  <url/>
866
866
  <status>0</status>
867
867
  <priority>2</priority>
868
868
  <description/>
869
869
  <type>0</type>
870
- <dependencies/>
870
+ <dependencies>
871
+ <dependency>
872
+ <name>extreme CPU use</name>
873
+ <expression>{CPU zrc:cpu[used_percent].min(120)}&gt;90</expression>
874
+ </dependency>
875
+ </dependencies>
871
876
  </trigger>
872
877
  </triggers>
873
878
  <graphs>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <zabbix_export>
3
3
  <version>2.0</version>
4
- <date>2013-10-01T06:30:08Z</date>
4
+ <date>2013-10-19T08:26:07Z</date>
5
5
  <groups>
6
6
  <group>
7
7
  <name>3. Service Ubuntu</name>
@@ -598,29 +598,29 @@
598
598
  </item_prototypes>
599
599
  <trigger_prototypes>
600
600
  <trigger_prototype>
601
- <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;80</expression>
602
- <name>{HOST.NAME} Disk (#DISK_MOUNT} full &gt; $1 %</name>
601
+ <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;90 &amp; {Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&lt;95</expression>
602
+ <name>{HOST.NAME} Disk {#DISK_MOUNT} full &gt; $1 %</name>
603
603
  <url/>
604
604
  <status>0</status>
605
- <priority>2</priority>
605
+ <priority>3</priority>
606
606
  <description/>
607
607
  <type>0</type>
608
608
  </trigger_prototype>
609
609
  <trigger_prototype>
610
- <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;95</expression>
611
- <name>{HOST.NAME} Disk (#DISK_MOUNT} full &gt; $1 %</name>
610
+ <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;80 &amp; {Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&lt;90</expression>
611
+ <name>{HOST.NAME} Disk {#DISK_MOUNT} full &gt; $1 %</name>
612
612
  <url/>
613
613
  <status>0</status>
614
- <priority>4</priority>
614
+ <priority>2</priority>
615
615
  <description/>
616
616
  <type>0</type>
617
617
  </trigger_prototype>
618
618
  <trigger_prototype>
619
- <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;90</expression>
620
- <name>{HOST.NAME} Disk (#DISK_MOUNT} full &gt; $1 %</name>
619
+ <expression>{Disk Stats:disk.space[{#DISK_DEVICE},percent_used].last(0)}&gt;95</expression>
620
+ <name>{HOST.NAME} Disk {#DISK_MOUNT} full &gt; $1 %</name>
621
621
  <url/>
622
622
  <status>0</status>
623
- <priority>3</priority>
623
+ <priority>4</priority>
624
624
  <description/>
625
625
  <type>0</type>
626
626
  </trigger_prototype>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <zabbix_export>
3
3
  <version>2.0</version>
4
- <date>2013-10-08T11:40:24Z</date>
4
+ <date>2013-10-17T21:38:16Z</date>
5
5
  <groups>
6
6
  <group>
7
7
  <name>3. Service Nginx</name>
@@ -217,6 +217,47 @@
217
217
  </applications>
218
218
  <valuemap/>
219
219
  </item>
220
+ <item>
221
+ <name>NGINX Check</name>
222
+ <type>3</type>
223
+ <snmp_community/>
224
+ <multiplier>0</multiplier>
225
+ <snmp_oid/>
226
+ <key>net.tcp.service[http]</key>
227
+ <delay>30</delay>
228
+ <history>90</history>
229
+ <trends>365</trends>
230
+ <status>0</status>
231
+ <value_type>3</value_type>
232
+ <allowed_hosts/>
233
+ <units/>
234
+ <delta>0</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>3</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
+ <name>Service state</name>
259
+ </valuemap>
260
+ </item>
220
261
  <item>
221
262
  <name>Requests per second</name>
222
263
  <type>2</type>
@@ -263,6 +304,18 @@
263
304
  <screens/>
264
305
  </template>
265
306
  </templates>
307
+ <triggers>
308
+ <trigger>
309
+ <expression>{Nginx:net.tcp.service[http].last(0)}=0</expression>
310
+ <name>NGINX Down</name>
311
+ <url/>
312
+ <status>0</status>
313
+ <priority>5</priority>
314
+ <description/>
315
+ <type>0</type>
316
+ <dependencies/>
317
+ </trigger>
318
+ </triggers>
266
319
  <graphs>
267
320
  <graph>
268
321
  <name>Nginx Connections</name>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <zabbix_export>
3
3
  <version>2.0</version>
4
- <date>2013-10-14T11:20:44Z</date>
4
+ <date>2013-10-14T11:47:48Z</date>
5
5
  <groups>
6
6
  <group>
7
7
  <name>3. Service Ubuntu</name>
@@ -501,5 +501,37 @@
501
501
  </graph_item>
502
502
  </graph_items>
503
503
  </graph>
504
+ <graph>
505
+ <name>s. Redis Commands</name>
506
+ <width>900</width>
507
+ <height>200</height>
508
+ <yaxismin>0.0000</yaxismin>
509
+ <yaxismax>100.0000</yaxismax>
510
+ <show_work_period>1</show_work_period>
511
+ <show_triggers>0</show_triggers>
512
+ <type>0</type>
513
+ <show_legend>0</show_legend>
514
+ <show_3d>0</show_3d>
515
+ <percent_left>0.0000</percent_left>
516
+ <percent_right>0.0000</percent_right>
517
+ <ymin_type_1>0</ymin_type_1>
518
+ <ymax_type_1>0</ymax_type_1>
519
+ <ymin_item_1>0</ymin_item_1>
520
+ <ymax_item_1>0</ymax_item_1>
521
+ <graph_items>
522
+ <graph_item>
523
+ <sortorder>0</sortorder>
524
+ <drawtype>5</drawtype>
525
+ <color>C80000</color>
526
+ <yaxisside>0</yaxisside>
527
+ <calc_fnc>2</calc_fnc>
528
+ <type>0</type>
529
+ <item>
530
+ <host>Redis</host>
531
+ <key>redis[commands]</key>
532
+ </item>
533
+ </graph_item>
534
+ </graph_items>
535
+ </graph>
504
536
  </graphs>
505
537
  </zabbix_export>
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
5
- prerelease:
4
+ version: 0.0.15
6
5
  platform: ruby
7
6
  authors:
8
7
  - mose
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2013-10-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,33 +41,29 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: A zabbix alternative to zabbix-agent using zabbix-sender.
@@ -92,6 +83,7 @@ files:
92
83
  - bin/zrc
93
84
  - lib/zabbix-ruby-client.rb
94
85
  - lib/zabbix-ruby-client/cli.rb
86
+ - lib/zabbix-ruby-client/data.rb
95
87
  - lib/zabbix-ruby-client/logger.rb
96
88
  - lib/zabbix-ruby-client/plugins.rb
97
89
  - lib/zabbix-ruby-client/plugins/apache.rb
@@ -106,6 +98,7 @@ files:
106
98
  - lib/zabbix-ruby-client/plugins/redis.rb
107
99
  - lib/zabbix-ruby-client/plugins/sysinfo.rb
108
100
  - lib/zabbix-ruby-client/plugins/who.rb
101
+ - lib/zabbix-ruby-client/store.rb
109
102
  - lib/zabbix-ruby-client/version.rb
110
103
  - spec/files/config.yml
111
104
  - spec/files/plugins/apache_status
@@ -114,6 +107,7 @@ files:
114
107
  - spec/files/plugins/netstat
115
108
  - spec/files/plugins/vmstat
116
109
  - spec/lib/cli_spec.rb
110
+ - spec/lib/data_spec.rb
117
111
  - spec/lib/logger_spec.rb
118
112
  - spec/lib/plugins/apache_spec.rb
119
113
  - spec/lib/plugins/cpu_spec.rb
@@ -121,6 +115,7 @@ files:
121
115
  - spec/lib/plugins/memory_spec.rb
122
116
  - spec/lib/plugins/network_spec.rb
123
117
  - spec/lib/plugins_spec.rb
118
+ - spec/lib/store_spec.rb
124
119
  - spec/lib/zabbix-ruby-client_spec.rb
125
120
  - spec/spec_helper.rb
126
121
  - templates/client/Gemfile
@@ -146,33 +141,26 @@ files:
146
141
  homepage: https://github.com/eduvo/zabbix-ruby-client
147
142
  licenses:
148
143
  - MIT
144
+ metadata: {}
149
145
  post_install_message:
150
146
  rdoc_options: []
151
147
  require_paths:
152
148
  - lib
153
149
  required_ruby_version: !ruby/object:Gem::Requirement
154
- none: false
155
150
  requirements:
156
- - - ! '>='
151
+ - - '>='
157
152
  - !ruby/object:Gem::Version
158
153
  version: '0'
159
- segments:
160
- - 0
161
- hash: 2522849002021600929
162
154
  required_rubygems_version: !ruby/object:Gem::Requirement
163
- none: false
164
155
  requirements:
165
- - - ! '>='
156
+ - - '>='
166
157
  - !ruby/object:Gem::Version
167
158
  version: '0'
168
- segments:
169
- - 0
170
- hash: 2522849002021600929
171
159
  requirements: []
172
160
  rubyforge_project:
173
- rubygems_version: 1.8.23
161
+ rubygems_version: 2.0.3
174
162
  signing_key:
175
- specification_version: 3
163
+ specification_version: 4
176
164
  summary: This tool is intended to use zabbix sender to propagate monitoring data for
177
165
  Zabbix server.
178
166
  test_files:
@@ -183,6 +171,7 @@ test_files:
183
171
  - spec/files/plugins/netstat
184
172
  - spec/files/plugins/vmstat
185
173
  - spec/lib/cli_spec.rb
174
+ - spec/lib/data_spec.rb
186
175
  - spec/lib/logger_spec.rb
187
176
  - spec/lib/plugins/apache_spec.rb
188
177
  - spec/lib/plugins/cpu_spec.rb
@@ -190,5 +179,6 @@ test_files:
190
179
  - spec/lib/plugins/memory_spec.rb
191
180
  - spec/lib/plugins/network_spec.rb
192
181
  - spec/lib/plugins_spec.rb
182
+ - spec/lib/store_spec.rb
193
183
  - spec/lib/zabbix-ruby-client_spec.rb
194
184
  - spec/spec_helper.rb