fluent-plugin-zabbix-agent 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/fluent/plugin/in_zabbix_agent.rb +18 -12
- data/lib/fluent_plugin_zabbix_agent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27049880904ec28d2e2159623747826e6fac0b43
|
4
|
+
data.tar.gz: 534b50053c659cd512c11e0f651a3006116ca7ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2aee511111ea3bd9ecfc9fa1a862a797cb276b78680b191fc673af4b48353bdcedc05feb378c8c322d5730c7a473f530cab49f5fe51c24d9b40df2240954c7
|
7
|
+
data.tar.gz: 861a09d4bdca8ad495923f36d49c9b007ec857fb27b13f1eef34ab548940f14e53b6f513d5967aed9f85729af86dcd64541e52c62a1d46f501dfe97e9efd0882
|
data/README.md
CHANGED
@@ -33,6 +33,8 @@ Or install it yourself as:
|
|
33
33
|
#agent_port 10050
|
34
34
|
#interval 60
|
35
35
|
#tag zabbix.item
|
36
|
+
#item_key_key key
|
37
|
+
#item_value_key value
|
36
38
|
#extra {}
|
37
39
|
#bulk false
|
38
40
|
|
@@ -66,8 +68,8 @@ Or install it yourself as:
|
|
66
68
|
```
|
67
69
|
|
68
70
|
```
|
69
|
-
2015-01-02 12:30:40 +0000 zabbix.item: {"load_avg1":0.0,"hostname":"my-host"}
|
70
|
-
2015-01-02 12:30:40 +0000 zabbix.item: {"system.cpu.load[all,avg5]":0.01,"hostname":"my-host"}
|
71
|
+
2015-01-02 12:30:40 +0000 zabbix.item: {"key":"load_avg1","value":0.0,"hostname":"my-host"}
|
72
|
+
2015-01-02 12:30:40 +0000 zabbix.item: {"key":"system.cpu.load[all,avg5]","value":0.01,"hostname":"my-host"}
|
71
73
|
```
|
72
74
|
|
73
75
|
## Get zabbix items as a single record
|
@@ -11,14 +11,16 @@ class Fluent::ZabbixAgentInput < Fluent::Input
|
|
11
11
|
define_method('router') { Fluent::Engine }
|
12
12
|
end
|
13
13
|
|
14
|
-
config_param :agent_host,
|
15
|
-
config_param :agent_port,
|
16
|
-
config_param :interval,
|
17
|
-
config_param :tag,
|
18
|
-
config_param :
|
19
|
-
config_param :
|
20
|
-
config_param :
|
21
|
-
config_param :
|
14
|
+
config_param :agent_host, :string, :default => '127.0.0.1'
|
15
|
+
config_param :agent_port, :integer, :default => 10050
|
16
|
+
config_param :interval, :time, :default => 60
|
17
|
+
config_param :tag, :string, :default => 'zabbix.item'
|
18
|
+
config_param :item_key_key, :string, :default => 'key'
|
19
|
+
config_param :item_value_key, :string, :default => 'value'
|
20
|
+
config_param :items, :hash, :default => nil
|
21
|
+
config_param :items_file, :string, :default => nil
|
22
|
+
config_param :extra, :hash, :default => {}
|
23
|
+
config_param :bulk, :bool, :default => false
|
22
24
|
|
23
25
|
def initialize
|
24
26
|
super
|
@@ -119,14 +121,18 @@ class Fluent::ZabbixAgentInput < Fluent::Input
|
|
119
121
|
def emit_items(value_by_item)
|
120
122
|
time = Time.now
|
121
123
|
|
122
|
-
records = value_by_item.map do |key, value|
|
123
|
-
{key => value}
|
124
|
-
end
|
125
|
-
|
126
124
|
if @bulk
|
125
|
+
records = value_by_item.map do |key, value|
|
126
|
+
{key => value}
|
127
|
+
end
|
128
|
+
|
127
129
|
bulk_record = records.inject({}) {|r, i| r.merge(i) }
|
128
130
|
router.emit(@tag, time.to_i, bulk_record.merge(extra))
|
129
131
|
else
|
132
|
+
records = value_by_item.map do |key, value|
|
133
|
+
{@item_key_key => key, @item_value_key => value}
|
134
|
+
end
|
135
|
+
|
130
136
|
records.each do |rcrd|
|
131
137
|
router.emit(@tag, time.to_i, rcrd.merge(extra))
|
132
138
|
end
|