riemann-bacula 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 8259d6fb194ccf10cd5acb756a66b2a22e1f310ed75a081f54cadcf8f7e80e99
4
- data.tar.gz: 7ea103923b9966074450861224946190f52cdabc766f0dcb2a4fd76f5f3c8de1
3
+ metadata.gz: '0499f815167711cba4183d48892adaac79f6e4e85f93afc98bff39d0dbd150a3'
4
+ data.tar.gz: e3fc084ea69056b5ac40ee69a85688ce22cc41594838092fbcf7e7cedcc0a763
5
5
  SHA512:
6
- metadata.gz: c8dff17ef2cb421f7a799755247190edfdfe39242bd55a0ce9f268109f157b7a94acc138252ea0a3e20c00d7f8b9e9be9f212e5708a0ba5464087e1aa457fb25
7
- data.tar.gz: 03b0c38ded3a57c297435ec6f16c1b766303eee451311b3c29c141d81b70d184ac616fe8f91171663a0f1b3cfbe753e439e1044123cf4fd5ee99d76f36a04633
6
+ metadata.gz: 60ab698e159a288be2417ad6e04e34c144d8865422b9eb841b6691679a232a9e83adaf50539cd70f67d4bfa8f53c9d5b4653f9c866db61d93fae41de3c054622
7
+ data.tar.gz: 07b689de3b9e91c88ce565adbb3c3ac4f7b4e6d42f9b3fc2b8b963f6a0f277f5ba59f17ff4b5f78cac71a92c0d1d1d56319ca940ad19dac18b3947a89e68bb63
@@ -44,7 +44,7 @@ jobs:
44
44
  run: bundle exec rake
45
45
  - name: Run tests and upload coverage to Code Climate
46
46
  if: ${{ matrix.ruby == '3.0' }}
47
- uses: paambaati/codeclimate-action@v3.0.0
47
+ uses: paambaati/codeclimate-action@v3.1.1
48
48
  env:
49
49
  CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
50
50
  with:
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## [1.1.0](https://github.com/opus-codium/riemann-bacula/tree/1.1.0) (2022-10-20)
4
+
5
+ [Full Changelog](https://github.com/opus-codium/riemann-bacula/compare/v1.0.0...1.1.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Join wrapped lines [\#3](https://github.com/opus-codium/riemann-bacula/pull/3) ([smortex](https://github.com/smortex))
10
+ - Add support for parsing restore reports [\#1](https://github.com/opus-codium/riemann-bacula/pull/1) ([smortex](https://github.com/smortex))
11
+
12
+ **Fixed bugs:**
13
+
14
+ - Fix parsing of backups of TB of data [\#2](https://github.com/opus-codium/riemann-bacula/pull/2) ([smortex](https://github.com/smortex))
15
+
16
+
17
+
18
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # riemann-bacula
2
2
 
3
+ [![CI](https://github.com/opus-codium/riemann-bacula/actions/workflows/ci.yml/badge.svg)](https://github.com/opus-codium/riemann-bacula/actions/workflows/ci.yml)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d4206bbc680dc822194b/maintainability)](https://codeclimate.com/github/opus-codium/riemann-bacula/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d4206bbc680dc822194b/test_coverage)](https://codeclimate.com/github/opus-codium/riemann-bacula/test_coverage)
6
+
3
7
  Submits bacula information to riemann.
4
8
 
5
9
  ## Get started
data/Rakefile CHANGED
@@ -16,4 +16,5 @@ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
16
16
  config.project = 'riemann-bacula'
17
17
  config.exclude_labels = ['skip-changelog']
18
18
  config.future_release = Riemann::Tools::Bacula::VERSION
19
+ config.since_tag = 'v1.0.0'
19
20
  end
@@ -3,7 +3,7 @@
3
3
  module Riemann
4
4
  module Tools # :nodoc:
5
5
  class Bacula
6
- VERSION = '1.0.0'
6
+ VERSION = '1.1.0'
7
7
  end
8
8
  end
9
9
  end
@@ -23,16 +23,24 @@ module Riemann
23
23
 
24
24
  def parse(text)
25
25
  data = {}
26
+ line_continuation = nil
26
27
 
27
28
  text.each_line do |line|
28
29
  line.chomp!
29
30
 
30
- next unless line =~ /\A ([^:]+):[[:blank:]]+(.*)/
31
+ if line =~ /\A ([^:]+):[[:blank:]]+(.*)/
32
+ key = Regexp.last_match(1)
33
+ raw_value = Regexp.last_match(2)
31
34
 
32
- key = Regexp.last_match(1)
33
- raw_value = Regexp.last_match(2)
35
+ data[key] = raw_value
36
+ elsif line_continuation
37
+ key = line_continuation
38
+ data[key] += ".#{line}"
39
+ else
40
+ next
41
+ end
34
42
 
35
- data[key] = raw_value
43
+ line_continuation = (key if line.length == 998)
36
44
  end
37
45
 
38
46
  return nil unless valid?(data)
@@ -53,16 +61,20 @@ module Riemann
53
61
  'FD Bytes Written',
54
62
  'SD Bytes Written',
55
63
  'Last Volume Bytes',
64
+ 'Bytes Restored',
56
65
  ],
57
66
  parse_integer: [
58
67
  'JobId',
59
68
  'Priority',
60
69
  'Non-fatal FD errors',
61
70
  'FD Files Written',
71
+ 'FD Errors',
62
72
  'SD Files Written',
63
73
  'SD Errors',
64
74
  'Volume Session Id',
65
75
  'Volume Session Time',
76
+ 'Files Expected',
77
+ 'Files Restored',
66
78
  ],
67
79
  parse_duration: [
68
80
  'Elapsed time',
@@ -108,7 +120,7 @@ module Riemann
108
120
  end
109
121
 
110
122
  def extract_client_info(data)
111
- /\A"([^"]+)" ([^ ]+)/.match(data['Client'])
123
+ return unless /\A"([^"]+)" ([^ ]+)/.match(data['Client'])
112
124
 
113
125
  data['Client'] = Regexp.last_match(1)
114
126
  data['Client Version'] = Regexp.last_match(2)
@@ -119,14 +131,14 @@ module Riemann
119
131
  end
120
132
 
121
133
  def extract_source(item, data)
122
- /\A"([^"]+)" \(From (Client|Job|Pool) resource\)\z/.match(data[item])
134
+ return unless /\A"([^"]+)" \(From (Client|Job|Pool) resource\)\z/.match(data[item])
123
135
 
124
136
  data[item] = Regexp.last_match(1)
125
137
  data["#{item} Source"] = Regexp.last_match(2)
126
138
  end
127
139
 
128
140
  def extract_time(item, data)
129
- /\A"([^"]+)" (.*)\z/.match(data[item])
141
+ return unless /\A"([^"]+)" (.*)\z/.match(data[item])
130
142
 
131
143
  data[item] = Regexp.last_match(1)
132
144
  data["#{item} time"] = Regexp.last_match(2)
@@ -168,7 +180,8 @@ module Riemann
168
180
  end
169
181
 
170
182
  def parse_size(value)
171
- /\A([\d,]+) \([\d.]+ [KMG]?B\)\z/.match(value)
183
+ raise ArgumentError, %(Cannot parse size "#{value}") unless /\A([\d,]+) \([\d.]+ [KMGT]?B\)\z/.match(value)
184
+
172
185
  parse_integer(Regexp.last_match(1))
173
186
  end
174
187
 
@@ -180,7 +193,7 @@ module Riemann
180
193
  event = {}
181
194
  event[:service] = "bacula backup #{data['Job Name']}"
182
195
  event[:state] = case data['Termination']
183
- when 'Backup OK' then 'ok'
196
+ when /\A(Backup|Restore) OK\z/ then 'ok'
184
197
  when 'Backup OK -- with warnings' then 'warning'
185
198
  else
186
199
  'critical'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-bacula
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
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: 2022-10-14 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools
@@ -136,6 +136,7 @@ files:
136
136
  - ".rspec"
137
137
  - ".rubocop.yml"
138
138
  - ".simplecov"
139
+ - CHANGELOG.md
139
140
  - Gemfile
140
141
  - README.md
141
142
  - Rakefile