riemann-syslog-ng 1.0.0 → 1.0.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
  SHA256:
3
- metadata.gz: f8296216cfac86bd15e8a9e7c432f515e23baa06bd20120fd589adb5bef0fbff
4
- data.tar.gz: e8f8021b906ceb2192b33c42f1412031271efe1c486cbca40eef0413cce8f537
3
+ metadata.gz: c6a25c3739014d79a0957c7f5baa20ddd8a13880977175b64aef987fcb8ed359
4
+ data.tar.gz: 9695440716ecb4d72de12b5a300cd0df0bfe7e367e949e5b225d420bab02a34a
5
5
  SHA512:
6
- metadata.gz: e5864d1c7796df2aa8defd106231de7ccc016a58c8f6d527935bed9a760d2bd27cf4d0079357637f13093d83f58487564c50bfdb94451dccb3209f45b7622f53
7
- data.tar.gz: bf368924284180e7f2d9c134b7d8d50a577e3890203b88638e8d63cdf5f8e905104cc0fa65debf90fc84338d4a47a026f4412103ebe87d4b38f9789dfda30a86
6
+ metadata.gz: 3f5cdc2e1456974c249d22aeca8a9a160d0ddcdffe0e3a05bc6459d36a0a2b6895946d40417e1237c8ec2f93f5726f8371b7db142938e15f3285e87c0500b5d6
7
+ data.tar.gz: f4699a8c4d2127546ad2995054fee6718cd245367ba942c8fd939b0ef179102b0a4969793348a9307c3f3c79a02541d209da66f00e36e4fa841f9f0ecf2f8c1b
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: github-actions
5
+ directory: "/"
6
+ schedule:
7
+ interval: daily
8
+ time: "13:00"
9
+ open-pull-requests-limit: 10
@@ -13,7 +13,7 @@ jobs:
13
13
  rubocop:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v3
16
+ - uses: actions/checkout@v4
17
17
  - name: Setup ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
@@ -35,7 +35,7 @@ jobs:
35
35
  - "3.3"
36
36
  name: Ruby ${{ matrix.ruby }}
37
37
  steps:
38
- - uses: actions/checkout@v3
38
+ - uses: actions/checkout@v4
39
39
  - name: Setup ruby
40
40
  uses: ruby/setup-ruby@v1
41
41
  with:
@@ -46,7 +46,7 @@ jobs:
46
46
  run: bundle exec rake
47
47
  - name: Run tests and upload coverage to Code Climate
48
48
  if: ${{ matrix.ruby == '3.0' }}
49
- uses: paambaati/codeclimate-action@v3.1.1
49
+ uses: paambaati/codeclimate-action@v5.0.0
50
50
  env:
51
51
  CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
52
52
  with:
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## [v1.0.1](https://github.com/opus-codium/riemann-syslog-ng/tree/v1.0.1) (2024-01-12)
4
+
5
+ [Full Changelog](https://github.com/opus-codium/riemann-syslog-ng/compare/v1.0.0...v1.0.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Recover when syslog-ng is restarted [\#2](https://github.com/opus-codium/riemann-syslog-ng/pull/2) ([smortex](https://github.com/smortex))
10
+
11
+
12
+
13
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ require 'github_changelog_generator/task'
14
14
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
15
15
  config.user = 'opus-codium'
16
16
  config.project = 'riemann-syslog-ng'
17
- config.exclude_labels = ['skip-changelog']
17
+ config.exclude_labels = %w[dependencies skip-changelog]
18
18
  config.future_release = "v#{Riemann::Tools::SyslogNg::VERSION}"
19
19
  config.since_tag = 'v1.0.0'
20
20
  end
@@ -3,7 +3,7 @@
3
3
  module Riemann
4
4
  module Tools # :nodoc:
5
5
  class SyslogNg
6
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
7
7
  end
8
8
  end
9
9
  end
@@ -21,12 +21,12 @@ module Riemann
21
21
  opt :queued_warning, 'Queued messages warning threshold', short: :none, default: 300
22
22
  opt :queued_critical, 'Queued messages critical threshold', short: :none, default: 1000
23
23
 
24
- def self.process_stdin
25
- new.process_stdin
24
+ def socket
25
+ @socket ||= UNIXSocket.new(opts[:socket])
26
26
  end
27
27
 
28
- def initialize
29
- @socket = UNIXSocket.new(opts[:socket])
28
+ def force_reconnect
29
+ @socket = nil
30
30
  end
31
31
 
32
32
  def tick
@@ -37,21 +37,24 @@ module Riemann
37
37
  state: statistic_state(statistic[:type], statistic[:metric]),
38
38
  })
39
39
  end
40
+ rescue Errno::EPIPE
41
+ force_reconnect
42
+ retry
40
43
  end
41
44
 
42
45
  def statistics
43
46
  res = []
44
47
 
45
- @socket.puts 'STATS CSV'
46
- @socket.gets # discard header
47
- while (line = @socket.gets.chomp) != '.'
48
+ socket.puts 'STATS CSV'
49
+ socket.gets # discard header
50
+ while (line = socket.gets.chomp) != '.'
48
51
  source_name, source_id, source_instance, state, type, metric = line.split(';')
49
52
 
50
- next if opts[:source_name] && !opts[:source_name].include?(source_name)
51
- next if opts[:source_id] && !opts[:source_id].include?(source_id)
52
- next if opts[:source_instance] && !opts[:source_instance].include?(source_instance)
53
- next if opts[:state] && !opts[:state].include?(state)
54
- next if opts[:type] && !opts[:type].include?(type)
53
+ next if rejected_source_name?(source_name)
54
+ next if rejected_source_id?(source_id)
55
+ next if rejected_source_instance?(source_instance)
56
+ next if rejected_state?(state)
57
+ next if rejected_type?(type)
55
58
 
56
59
  res << {
57
60
  source_name: source_name,
@@ -66,17 +69,45 @@ module Riemann
66
69
  res
67
70
  end
68
71
 
72
+ def rejected_source_name?(source_name)
73
+ opts[:source_name] && !opts[:source_name].include?(source_name)
74
+ end
75
+
76
+ def rejected_source_id?(source_id)
77
+ opts[:source_id] && !opts[:source_id].include?(source_id)
78
+ end
79
+
80
+ def rejected_source_instance?(source_instance)
81
+ opts[:source_instance] && !opts[:source_instance].include?(source_instance)
82
+ end
83
+
84
+ def rejected_state?(state)
85
+ opts[:state] && !opts[:state].include?(state)
86
+ end
87
+
88
+ def rejected_type?(type)
89
+ opts[:type] && !opts[:type].include?(type)
90
+ end
91
+
69
92
  def statistic_state(type, metric)
70
93
  if type == 'dropped'
71
- metric == 0.0 ? 'ok' : 'critical'
94
+ dropped_statistic_state(metric)
72
95
  elsif type == 'queued'
73
- if metric >= opts[:queued_critical]
74
- 'critical'
75
- elsif metric >= opts[:queued_warning]
76
- 'warning'
77
- else
78
- 'ok'
79
- end
96
+ queued_statistic_state(metric)
97
+ end
98
+ end
99
+
100
+ def dropped_statistic_state(metric)
101
+ metric == 0.0 ? 'ok' : 'critical'
102
+ end
103
+
104
+ def queued_statistic_state(metric)
105
+ if metric >= opts[:queued_critical]
106
+ 'critical'
107
+ elsif metric >= opts[:queued_warning]
108
+ 'warning'
109
+ else
110
+ 'ok'
80
111
  end
81
112
  end
82
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-syslog-ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-11 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools
@@ -33,11 +33,13 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - ".github/CODEOWNERS"
36
+ - ".github/dependabot.yml"
36
37
  - ".github/workflows/ci.yml"
37
38
  - ".gitignore"
38
39
  - ".rspec"
39
40
  - ".rubocop.yml"
40
41
  - ".simplecov"
42
+ - CHANGELOG.md
41
43
  - Gemfile
42
44
  - README.md
43
45
  - Rakefile