zabbix-ruby-client 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Zabbbix Ruby Client Changelog
2
2
  -----------------------------
3
3
 
4
+ ### v0.0.20 - 2013-12-25
5
+
6
+ * fix network plugin
7
+ * fix new return code handling from zabbix_sender 2.2.x
8
+ * more debugging info when loglevel: debug
9
+
4
10
  ### v0.0.19 - 2013-12-24
5
11
 
6
12
  * fix on logger when zabbix-sender command fails
@@ -14,14 +14,14 @@ module ZabbixRubyClient
14
14
  if info
15
15
  time = Time.now.to_i
16
16
  back = []
17
- back << "#{host} net.rx_ok[#{interface}] #{time} #{info[2]}"
18
- back << "#{host} net.rx_packets[#{interface}] #{time} #{info[3]}"
19
- back << "#{host} net.rx_err[#{interface}] #{time} #{info[4]}"
20
- back << "#{host} net.rx_drop[#{interface}] #{time} #{info[5]}"
21
- back << "#{host} net.tx_ok[#{interface}] #{time} #{info[10]}"
22
- back << "#{host} net.tx_packets[#{interface}] #{time} #{info[11]}"
23
- back << "#{host} net.tx_err[#{interface}] #{time} #{info[12]}"
24
- back << "#{host} net.tx_drop[#{interface}] #{time} #{info[13]}"
17
+ back << "#{host} net.rx_ok[#{interface}] #{time} #{info[1]}"
18
+ back << "#{host} net.rx_packets[#{interface}] #{time} #{info[2]}"
19
+ back << "#{host} net.rx_err[#{interface}] #{time} #{info[3]}"
20
+ back << "#{host} net.rx_drop[#{interface}] #{time} #{info[4]}"
21
+ back << "#{host} net.tx_ok[#{interface}] #{time} #{info[9]}"
22
+ back << "#{host} net.tx_packets[#{interface}] #{time} #{info[10]}"
23
+ back << "#{host} net.tx_err[#{interface}] #{time} #{info[11]}"
24
+ back << "#{host} net.tx_drop[#{interface}] #{time} #{info[12]}"
25
25
  return back
26
26
  else
27
27
  return []
@@ -43,7 +43,7 @@ module ZabbixRubyClient
43
43
  false
44
44
  end
45
45
  end
46
-
46
+
47
47
  end
48
48
  end
49
49
  end
@@ -21,8 +21,10 @@ module ZabbixRubyClient
21
21
  @data = ZabbixRubyClient::Data.new(@config['host'])
22
22
  @logsdir = makedir(@config['logsdir'], 'logs')
23
23
  ZabbixRubyClient::Plugins.scan_dirs([ PLUGINDIR ] + @config['plugindirs'])
24
- ZabbixRubyClient::Log.set_logger(File.join(@logsdir, 'zrc.log'), 'info')
24
+ ZabbixRubyClient::Log.set_logger(File.join(@logsdir, 'zrc.log'), @config['loglevel'])
25
25
  ZabbixRubyClient::Log.debug @config.inspect
26
+ zabbix_sender_version = `zabbix_sender -V | head -1`.split(/\s/)[2]
27
+ @is_22 = /v2\.2\./.match zabbix_sender_version
26
28
  end
27
29
 
28
30
  def collect
@@ -39,14 +41,37 @@ module ZabbixRubyClient
39
41
 
40
42
  def upload
41
43
  file = @store.record(@data.merge)
44
+ command = "#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}"
45
+ ZabbixRubyClient::Log.debug command
42
46
  begin
43
- res = `#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}`
44
- if $?.to_i != 0
45
- @store.keepdata(file)
47
+ res = `#{command}`
48
+ if @is_22
49
+ case $?.to_i
50
+ when 0
51
+ ZabbixRubyClient::Log.debug "zabbix-sender: Data Sent"
52
+ when 1
53
+ @store.keepdata(file)
54
+ ZabbixRubyClient::Log.error "zabbix-sender: Sending failed"
55
+ ZabbixRubyClient::Log.error res
56
+ when 512
57
+ ZabbixRubyClient::Log.warn "zabbix-sender: Some values failed"
58
+ ZabbixRubyClient::Log.warn res
59
+ else
60
+ ZabbixRubyClient::Log.error "zabbix-sender: Something failed. #{$i}. code #{$?.to_i} was returned"
61
+ ZabbixRubyClient::Log.error res
62
+ end
63
+ else
64
+ if $?.to_i != 0
65
+ @store.keepdata(file)
66
+ ZabbixRubyClient::Log.error "zabbix-sender: Sending failed"
67
+ ZabbixRubyClient::Log.error res
68
+ else
69
+ ZabbixRubyClient::Log.debug "zabbix-sender: Data Sent"
70
+ end
46
71
  end
47
72
  rescue Exception => e
48
73
  @store.keepdata(file)
49
- ZabbixRubyClient::Log.error "Sending failed."
74
+ ZabbixRubyClient::Log.error "zabbix-sender: broken."
50
75
  ZabbixRubyClient::Log.error e.message
51
76
  end
52
77
  end
@@ -1,3 +1,3 @@
1
1
  module ZabbixRubyClient
2
- VERSION ||= "0.0.19"
2
+ VERSION ||= "0.0.20"
3
3
  end
metadata CHANGED
@@ -1,32 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - mose
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-12-23 00:00:00.000000000 Z
12
+ date: 2013-12-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: bundler
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,57 +46,65 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: webmock
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: coveralls
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  description: A zabbix alternative to zabbix-agent using zabbix-sender.
@@ -193,26 +206,33 @@ files:
193
206
  homepage: https://github.com/eduvo/zabbix-ruby-client
194
207
  licenses:
195
208
  - MIT
196
- metadata: {}
197
209
  post_install_message:
198
210
  rdoc_options: []
199
211
  require_paths:
200
212
  - lib
201
213
  required_ruby_version: !ruby/object:Gem::Requirement
214
+ none: false
202
215
  requirements:
203
- - - '>='
216
+ - - ! '>='
204
217
  - !ruby/object:Gem::Version
205
218
  version: '0'
219
+ segments:
220
+ - 0
221
+ hash: 2258474499150129505
206
222
  required_rubygems_version: !ruby/object:Gem::Requirement
223
+ none: false
207
224
  requirements:
208
- - - '>='
225
+ - - ! '>='
209
226
  - !ruby/object:Gem::Version
210
227
  version: '0'
228
+ segments:
229
+ - 0
230
+ hash: 2258474499150129505
211
231
  requirements: []
212
232
  rubyforge_project:
213
- rubygems_version: 2.1.11
233
+ rubygems_version: 1.8.23
214
234
  signing_key:
215
- specification_version: 4
235
+ specification_version: 3
216
236
  summary: This tool is intended to use zabbix sender to propagate monitoring data for
217
237
  Zabbix server.
218
238
  test_files:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 93d282dcf0d5f02de0b8cf3ba0dd16c5a90d0950
4
- data.tar.gz: 6318e9b04b8eb7fb601ba2311d0b02f504606889
5
- SHA512:
6
- metadata.gz: 4492448212c466a3a7b655a01333a7b6869f8ec3ef4f000c5a9a25f13a465ce893990200cce6a74256de6be52d81b09f408bcadd50e5e1acf620a962dad3ca44
7
- data.tar.gz: 810b5853b3ec99b09a1f203b79645414e225f753a62300aad5b5633cfc9865d1bbba80cc076e1adf74ceab10282c97f267bd07d7fae422366b037ec46e3b1ada