fluent-plugin-zabbix 0.3.0 → 0.3.1

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
- SHA1:
3
- metadata.gz: 35423c2cf732ed7048b36bb6c4c5882fb2526110
4
- data.tar.gz: 46dbb7031bfb41f3ea4d7a9acd87dcef14714f3b
2
+ SHA256:
3
+ metadata.gz: 97c7b621772f409af613b565d2b734e55786b00618297de55a53ece1949caf9e
4
+ data.tar.gz: a1e9d865a2bade7536f5c4ba886706640616f3a794066a267bf75971d4da1b38
5
5
  SHA512:
6
- metadata.gz: 33cfd15134ba66af5163ec247b4696708d89960b86fb3a5a67f9ec9dffb33c7db8eabba8b8c8f55542f22e0601452af684fd27e6d134ad640949f955dddaf29e
7
- data.tar.gz: bab731439abad3a3a7242ff35840d29a305ab9d529aa83f7fe75ba4ee9b5ee5fc811368bebf0b5117478b81987f5d552b2c2c9bd6fe022588ec63588b040318f
6
+ metadata.gz: 36a71a4ea7e3b9f3188d976f301b7fbde974d5ccd7580a234332f7f8b0d93cb8848d52b5700cb7bb786539a869daedf617f5b1e4e8f18601cf814b8dea063cfd
7
+ data.tar.gz: 598ac514f14971ae29a3e7f3d548806dcf7af2649bf8b341fb944a5647b4ead579be81cefd997aaa53c2e706da14e3a9cab57076b3cec45f3684aeebdf3cfd87
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "20:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,23 @@
1
+ name: test
2
+ on: [push]
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
9
+ name: test on Ruby ${{ matrix.ruby }}
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-go@v5
13
+ with:
14
+ go-version: "1.21"
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
19
+ - run: bundle install
20
+ - run: |
21
+ bundle exec rake test
22
+ env:
23
+ LIVE_TEST: 1
data/README.md CHANGED
@@ -67,6 +67,8 @@ v0.0.7~ includes [Fluent::Mixin::ConfigPlaceholders](https://github.com/tagomori
67
67
  </match>
68
68
  ```
69
69
 
70
+ `host` parameter is set by default to Ruby's `Socket.gethostname` if not specified.
71
+
70
72
  # TODO
71
73
 
72
74
  - patches welcome!
@@ -14,12 +14,12 @@ Gem::Specification.new do |gem|
14
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
15
  gem.name = "fluent-plugin-zabbix"
16
16
  gem.require_paths = ["lib"]
17
- gem.version = "0.3.0"
17
+ gem.version = "0.3.1"
18
18
 
19
19
  gem.add_runtime_dependency "fluentd", [">= 0.14.8", "< 2"]
20
20
  gem.add_runtime_dependency "yajl-ruby", "~> 1.0"
21
21
  gem.add_runtime_dependency "fluent-mixin-config-placeholders", "~> 0.3"
22
22
  gem.add_development_dependency "rake", ">= 0.9.2"
23
- gem.add_development_dependency "glint", "= 0.0.2"
23
+ gem.add_development_dependency "glint", "= 0.1.0"
24
24
  gem.add_development_dependency "test-unit", ">= 3.1.0"
25
25
  end
@@ -70,7 +70,7 @@ class Fluent::Plugin::ZabbixOutput < Fluent::Plugin::Output
70
70
  bulk.push({ key: format_key(tag, key, record),
71
71
  value: format_value(record[key]),
72
72
  host: host,
73
- time: time.to_i,
73
+ clock: time.to_i,
74
74
  })
75
75
  end
76
76
  }
@@ -85,7 +85,7 @@ class Fluent::Plugin::ZabbixOutput < Fluent::Plugin::Output
85
85
  bulk.push({ key: format_key(tag, key, record),
86
86
  value: format_value(record[key]),
87
87
  host: host,
88
- time: time.to_i,
88
+ clock: time.to_i,
89
89
  })
90
90
  end
91
91
  }
data/mockserver/go.mod ADDED
@@ -0,0 +1,5 @@
1
+ module github.com/fujiwara/fluent-plugin-zabbix/mockserver
2
+
3
+ go 1.18
4
+
5
+ require github.com/fujiwara/go-zabbix-get v0.1.0
data/mockserver/go.sum ADDED
@@ -0,0 +1,2 @@
1
+ github.com/fujiwara/go-zabbix-get v0.1.0 h1:Aufw3MvWksIc9wCTbHipikkBFX8PD220IrnE9LC7eO8=
2
+ github.com/fujiwara/go-zabbix-get v0.1.0/go.mod h1:1C6hUoBE4tOGZFGqHhhIj3NBfU8BJ+/YDDRGjLQhSdA=
@@ -31,10 +31,11 @@ func main() {
31
31
  func handler(req zabbix.TrapperRequest) (res zabbix.TrapperResponse, err error) {
32
32
  for _, d := range req.Data {
33
33
  line := fmt.Sprintf(
34
- "host:%s\tkey:%s\tvalue:%s\n",
34
+ "host:%s\tkey:%s\tvalue:%s\tclock:%d\n",
35
35
  d.Host,
36
36
  d.Key,
37
37
  d.Value,
38
+ d.Clock,
38
39
  )
39
40
  Output.Write([]byte(line))
40
41
  }
@@ -4,7 +4,7 @@ require 'fluent/test/driver/output'
4
4
  if ENV['LIVE_TEST']
5
5
  require "glint"
6
6
  require "tmpdir"
7
- system "go", "build", "test/mockserver.go"
7
+ system "sh -c 'cd mockserver && go build mockserver.go'"
8
8
  end
9
9
 
10
10
  class ZabbixOutputTest < Test::Unit::TestCase
@@ -13,7 +13,7 @@ class ZabbixOutputTest < Test::Unit::TestCase
13
13
  if ENV['LIVE_TEST']
14
14
  $dir = Dir.mktmpdir
15
15
  $server = Glint::Server.new(10051, { timeout: 3 }) do |port|
16
- exec "./mockserver", $dir.to_s + "/trapper.log"
16
+ exec "./mockserver/mockserver", $dir.to_s + "/trapper.log"
17
17
  end
18
18
  $server.start
19
19
  end
@@ -32,24 +32,25 @@ class ZabbixOutputTest < Test::Unit::TestCase
32
32
 
33
33
  def test_write
34
34
  d = create_driver
35
+ now = Time.now.to_i
35
36
  if ENV['LIVE_TEST']
36
- d.run(default_tag: 'test') do
37
- d.feed({"foo" => "test value of foo"})
38
- d.feed({"bar" => "test value of bar"})
39
- d.feed({"baz" => 123.4567 })
40
- d.feed({"foo" => "yyy", "zabbix_host" => "alternative-hostname"})
41
- d.feed({"f1" => 0.000001})
42
- d.feed({"f2" => 0.01})
37
+ d.run() do
38
+ d.feed('test', now, {"foo" => "test value of foo"})
39
+ d.feed('test', now, {"bar" => "test value of bar"})
40
+ d.feed('test', now, {"baz" => 123.4567 })
41
+ d.feed('test', now, {"foo" => "yyy", "zabbix_host" => "alternative-hostname"})
42
+ d.feed('test', now, {"f1" => 0.000001})
43
+ d.feed('test', now, {"f2" => 0.01})
43
44
  sleep 1
44
45
  end
45
46
  $server.stop
46
47
  assert_equal open($dir + "/trapper.log").read, <<END
47
- host:test_host key:test.foo value:test value of foo
48
- host:test_host key:test.bar value:test value of bar
49
- host:test_host key:test.baz value:123.4567
50
- host:test_host key:test.foo value:yyy
51
- host:test_host key:test.f1 value:0.0
52
- host:test_host key:test.f2 value:0.01
48
+ host:test_host key:test.foo value:test value of foo clock:#{now}
49
+ host:test_host key:test.bar value:test value of bar clock:#{now}
50
+ host:test_host key:test.baz value:123.4567 clock:#{now}
51
+ host:test_host key:test.foo value:yyy clock:#{now}
52
+ host:test_host key:test.f1 value:0.0 clock:#{now}
53
+ host:test_host key:test.f2 value:0.01 clock:#{now}
53
54
  END
54
55
  end
55
56
  end
@@ -79,32 +80,34 @@ END
79
80
 
80
81
  def test_write_host_key
81
82
  d = create_driver_host_key
83
+ now = Time.now.to_i
82
84
  if ENV['LIVE_TEST']
83
- d.run(default_tag: 'test') do
84
- d.feed({"foo" => "AAA" })
85
- d.feed({"foo" => "BBB", "host" => "alternative-hostname"})
85
+ d.run() do
86
+ d.feed('test', now, {"foo" => "AAA" })
87
+ d.feed('test', now, {"foo" => "BBB", "host" => "alternative-hostname"})
86
88
  sleep 1
87
89
  end
88
90
  $server.stop
89
91
  assert_equal open($dir + "/trapper.log").read, <<END
90
- host:test_host key:test.foo value:AAA
91
- host:alternative-hostname key:test.foo value:BBB
92
+ host:test_host key:test.foo value:AAA clock:#{now}
93
+ host:alternative-hostname key:test.foo value:BBB clock:#{now}
92
94
  END
93
95
  end
94
96
  end
95
97
 
96
98
  def test_write_prefix_key
97
99
  d = create_driver_prefix_key
100
+ now = Time.now.to_i
98
101
  if ENV['LIVE_TEST']
99
- d.run(default_tag: 'test') do
100
- d.feed({"foo" => "AAA"})
101
- d.feed({"foo" => "BBB", "prefix" => "p"})
102
+ d.run() do
103
+ d.feed('test', now, {"foo" => "AAA"})
104
+ d.feed('test', now, {"foo" => "BBB", "prefix" => "p"})
102
105
  sleep 1
103
106
  end
104
107
  $server.stop
105
108
  assert_equal open($dir + "/trapper.log").read, <<END
106
- host:test_host key:foo value:AAA
107
- host:test_host key:p.foo value:BBB
109
+ host:test_host key:foo value:AAA clock:#{now}
110
+ host:test_host key:p.foo value:BBB clock:#{now}
108
111
  END
109
112
  end
110
113
  end
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FUJIWARA Shunichiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-15 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 0.0.2
81
+ version: 0.1.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.0.2
88
+ version: 0.1.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: test-unit
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,8 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
+ - ".github/dependabot.yml"
111
+ - ".github/workflows/test.yml"
110
112
  - ".gitignore"
111
113
  - ".travis.yml"
112
114
  - Gemfile
@@ -115,8 +117,10 @@ files:
115
117
  - Rakefile
116
118
  - fluent-plugin-zabbix.gemspec
117
119
  - lib/fluent/plugin/out_zabbix.rb
120
+ - mockserver/go.mod
121
+ - mockserver/go.sum
122
+ - mockserver/mockserver.go
118
123
  - test/helper.rb
119
- - test/mockserver.go
120
124
  - test/plugin/test_out_zabbix.rb
121
125
  homepage: https://github.com/fujiwara/fluent-plugin-zabbix
122
126
  licenses:
@@ -137,12 +141,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
141
  - !ruby/object:Gem::Version
138
142
  version: '0'
139
143
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.6.11
144
+ rubygems_version: 3.4.10
142
145
  signing_key:
143
146
  specification_version: 4
144
147
  summary: Output data plugin to Zabbix (like zabbix_sender)
145
148
  test_files:
146
149
  - test/helper.rb
147
- - test/mockserver.go
148
150
  - test/plugin/test_out_zabbix.rb