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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70ea3efb9f6850bc5baaf5edfd4ba7ceaa5f2727
4
- data.tar.gz: 42e89b3a717f56601aad4ba89ef46f6485ab2abf
3
+ metadata.gz: 27049880904ec28d2e2159623747826e6fac0b43
4
+ data.tar.gz: 534b50053c659cd512c11e0f651a3006116ca7ad
5
5
  SHA512:
6
- metadata.gz: 0cc4ddd43188a5c2d8172e3a13c611a956b7c9f3553ceeb48c406e379e4c7cf91e16cb78667bcbaf072b9774621c8d240c9a368aca9c05bbd865feabbf4d1edd
7
- data.tar.gz: d92ac6db472f9f14b2d391e1e863725349ce9a52186446bbcb5759af98578973f41b6b59f952141a7d61c092a7d18788bc4a05e5d4ba1a43a8976fe5c7338b57
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, :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 :items, :hash, :default => nil
19
- config_param :items_file, :string, :default => nil
20
- config_param :extra, :hash, :default => {}
21
- config_param :bulk, :bool, :default => false
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
@@ -1,3 +1,3 @@
1
1
  module FluentPluginZabbixAgent
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-zabbix-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara