fluent-plugin-zabbix 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/fluent-plugin-zabbix.gemspec +1 -1
- data/lib/fluent/plugin/out_zabbix.rb +8 -2
- data/test/mockserver.go +21 -0
- data/test/plugin/test_out_zabbix.rb +3 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95041f2ebddbc8198a121ca2aa73dde358737f83
|
4
|
+
data.tar.gz: 72c3d45c786d5137dc8ea8e8a051cb96ee581154
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da34f9201d9dfe8b7d32402d52c775a9ab05cbca7f3bc53b0586e6f7e71ae015bedbb852afe841db684995429355363ea320a4277024c95c46d0b1b9aade8dc4
|
7
|
+
data.tar.gz: efc107c61264121e42986406825fae7d33c3ea6f89a077c188ca2b6aef7af4648c90f1abce0efa491ec3c5d609f50805b36d580f4e505575d9f0e5246d22c5c9
|
data/README.rdoc
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "fluent-plugin-zabbix"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = "0.0.
|
16
|
+
gem.version = "0.0.4"
|
17
17
|
|
18
18
|
gem.add_runtime_dependency "fluentd", "~> 0.10"
|
19
19
|
gem.add_runtime_dependency "zabbix", ">= 0.4"
|
@@ -57,8 +57,14 @@ class Fluent::ZabbixOutput < Fluent::Output
|
|
57
57
|
zbx = Zabbix::Sender.new(:host => @zabbix_server, :port => @port)
|
58
58
|
log.debug("zabbix: #{zbx}, #{name}: #{value}, host: #{host}, ts: #{time}")
|
59
59
|
opts = { :host => host, :ts => time }
|
60
|
-
|
61
|
-
|
60
|
+
if value.kind_of? Float
|
61
|
+
# https://www.zabbix.com/documentation/2.4/manual/config/items/item
|
62
|
+
# > Allowed range (for MySQL): -999999999999.9999 to 999999999999.9999 (double(16,4)).
|
63
|
+
# > Starting with Zabbix 2.2, receiving values in scientific notation is also supported. E.g. 1e+70, 1e-70.
|
64
|
+
status = zbx.send_data(name, value.round(4).to_s, opts)
|
65
|
+
else
|
66
|
+
status = zbx.send_data(name, value.to_s, opts)
|
67
|
+
end
|
62
68
|
rescue IOError, EOFError, SystemCallError
|
63
69
|
# server didn't respond
|
64
70
|
log.warn "plugin-zabbix: Zabbix::Sender.send_data raises exception: #{$!.class}, '#{$!.message}'"
|
data/test/mockserver.go
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"log"
|
5
|
+
|
6
|
+
"github.com/fujiwara/go-zabbix-get/zabbix"
|
7
|
+
)
|
8
|
+
|
9
|
+
func main() {
|
10
|
+
err := zabbix.RunTrapperServer(
|
11
|
+
"127.0.0.1:10051",
|
12
|
+
func(req zabbix.TrapperRequest) (res zabbix.TrapperResponse, err error) {
|
13
|
+
log.Printf("%#v", req)
|
14
|
+
res.Proceeded = len(req.Data)
|
15
|
+
return res, nil
|
16
|
+
},
|
17
|
+
)
|
18
|
+
if err != nil {
|
19
|
+
panic(err)
|
20
|
+
}
|
21
|
+
}
|
@@ -9,7 +9,7 @@ class ZabbixOutputTest < Test::Unit::TestCase
|
|
9
9
|
zabbix_server 127.0.0.1
|
10
10
|
host test_host
|
11
11
|
add_key_prefix test
|
12
|
-
name_keys foo, bar, baz
|
12
|
+
name_keys foo, bar, baz, f1, f2
|
13
13
|
]
|
14
14
|
|
15
15
|
def create_driver(conf = CONFIG, tag='test')
|
@@ -23,11 +23,12 @@ class ZabbixOutputTest < Test::Unit::TestCase
|
|
23
23
|
d.emit({"bar" => "test value of bar"})
|
24
24
|
d.emit({"baz" => rand * 10 })
|
25
25
|
d.emit({"foo" => "yyy", "zabbix_host" => "alternative-hostname"})
|
26
|
+
d.emit({"f1" => 0.000001})
|
27
|
+
d.emit({"f2" => 0.01})
|
26
28
|
d.run
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
32
|
CONFIG_HOST_KEY = %[
|
32
33
|
zabbix_server 127.0.0.1
|
33
34
|
host test_host
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-zabbix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FUJIWARA Shunichiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- fluent-plugin-zabbix.gemspec
|
70
70
|
- lib/fluent/plugin/out_zabbix.rb
|
71
71
|
- test/helper.rb
|
72
|
+
- test/mockserver.go
|
72
73
|
- test/plugin/test_out_zabbix.rb
|
73
74
|
homepage: https://github.com/fujiwara/fluent-plugin-zabbix
|
74
75
|
licenses: []
|
@@ -95,4 +96,5 @@ specification_version: 4
|
|
95
96
|
summary: Output data plugin to Zabbix (like zabbix_sender)
|
96
97
|
test_files:
|
97
98
|
- test/helper.rb
|
99
|
+
- test/mockserver.go
|
98
100
|
- test/plugin/test_out_zabbix.rb
|