fluent-plugin-zabbix-agent 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95b4a81abb2b8f9c15ead559177ffb99af51bee5
4
- data.tar.gz: 3ff836e8e4f56e616c77824871a3f04232bae5b7
3
+ metadata.gz: 9e9e82ae6acd85c0a2bd78d03fdf9cc6b370f3b0
4
+ data.tar.gz: e68f51a774ec59b03a533d0563454a2c7fe9806d
5
5
  SHA512:
6
- metadata.gz: 8c93b0599c818262bbe41605d4d5d6d466dbc2757bee0e11b58e7057e89ecaf31136cf1695ee65f983f36171e7162c003a82abfd9ba7d32b5e9407b99ead5703
7
- data.tar.gz: d8694cd8bf37d8301d5279a485ce63927264b576189452d9868b2f9720bca4afe9f732cc03bd2a8dbef387fb195aa3497d8c473a0907956c1e6173c1495d660b
6
+ metadata.gz: 47709b31852db97f53584c4722b7b64c226fd972de41f25d6e77893fc430a14cbff2d249c14819505e47f415911c5931bb75636177e3f52abaac7e5051d09593
7
+ data.tar.gz: e87acc4edf7640e60012f8044dd9f00af15efe6ef6e81ce28708b8ac6b6930458733484175df661d494850bbc0496b176fb072e12b825d01d5c06a57272b081c
data/README.md CHANGED
@@ -41,6 +41,8 @@ Or install it yourself as:
41
41
  "system.cpu.load[all,avg5]": "load_avg5",
42
42
  ...
43
43
  }
44
+ # or
45
+ #items_file /path/to/items.json
44
46
  </source>
45
47
 
46
48
  ```
@@ -11,21 +11,12 @@ class Fluent::ZabbixAgentInput < Fluent::Input
11
11
  define_method('router') { Fluent::Engine }
12
12
  end
13
13
 
14
- def initialize
15
- super
16
- require 'csv'
17
- require 'fileutils'
18
- require 'logger'
19
- require 'time'
20
- require 'addressable/uri'
21
- require 'aws-sdk'
22
- end
23
-
24
14
  config_param :agent_host, :string, :default => '127.0.0.1'
25
15
  config_param :agent_port, :integer, :default => 10050
26
16
  config_param :interval, :time, :default => 60
27
17
  config_param :tag, :string, :default => 'zabbix.item'
28
- config_param :items, :hash
18
+ config_param :items, :hash, :default => nil
19
+ config_param :items_file, :string, :default => nil
29
20
  config_param :extra, :hash, :default => {}
30
21
  config_param :bulk, :bool, :default => false
31
22
 
@@ -33,11 +24,23 @@ class Fluent::ZabbixAgentInput < Fluent::Input
33
24
  super
34
25
  require 'socket'
35
26
  require 'zabbix_protocol'
27
+ require 'json'
36
28
  end
37
29
 
38
30
  def configure(conf)
39
31
  super
40
32
 
33
+ if @items.nil? and @items_file.nil?
34
+ raise Fluent::ConfigError, 'One of "items" or "items_file" is required'
35
+ elsif @items and @items_file
36
+ raise %!It isn't possible to specify both of items" and "items_file"!
37
+ end
38
+
39
+ if @items_file
40
+ @items = File.read(@items_file)
41
+ @items = JSON.load(@items)
42
+ end
43
+
41
44
  @items.keys.each do |key|
42
45
  value = @items[key]
43
46
  @items[key] = key if value.nil?
@@ -1,3 +1,3 @@
1
1
  module FluentPluginZabbixAgent
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara