This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
forked from dreyau/bareos_exporter
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set poolInfo expired to
false
when the expression is NULL
.
In case that the volume is freshly created and is being written to currently, `lastwritten` is `NULL`, which propagates through the expiry calculation formula, resulting in a boolean field being `NULL`. This causes an error to be raised, which results in a log line: Jun 30 23:29:24 backup1 bareos_exporter[21509]: time="2021-06-30T23:29:24Z" level=error msg="sql: Scan error on column index 4, name \"expired\": sql/driver: couldn't convert <nil> (<nil>) into type bool" method=PoolInfo When an error occurs while fetching pool info, statistics about pools are not exported to prometheus at all, which may result in missing data. Fixes #9
- Loading branch information
1 parent
e710498
commit 07673a0
Showing
3 changed files
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Reproduction of https://github.com/vierbergenlars/bareos_exporter/issues/9 | ||
|
||
INSERT INTO Media (volumename, mediatype, firstwritten, lastwritten, labeldate, volstatus, poolid) | ||
VALUES | ||
('Pool1-0100', 'NULL', NOW() - interval 1 day + interval 30 second, NULL, NOW() - interval 1 day, 'Full', (SELECT poolid from Pool WHERE name = 'Pool1')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Reproduction of https://github.com/vierbergenlars/bareos_exporter/issues/9 | ||
|
||
INSERT INTO public.media (volumename, mediatype, firstwritten, lastwritten, labeldate, volstatus, poolid) | ||
VALUES | ||
('Pool1-0100', 'NULL', NOW() - interval '1 day' + interval '30s', NULL, NOW() - interval '1 day', 'Full', (SELECT poolid from pool WHERE name = 'Pool1')); |