Commit graph

25 commits

Author SHA1 Message Date
Konstantin Shalygin
7489f4f7aa
Add support for device types and predictable device paths (rebased) (#257)
* Add better error logging on smartctl exec failure

We will now log a warning if smartctl path passed via command line is invalid.

Signed-off-by: Piotr Dobrowolski <admin@tastycode.pl>
(cherry picked from commit 1c9c6943e8)

* Add support for autoscan device types and predictable device paths

This adds a new command line option allowing for customization of
autodetected device types and enables use of special "by-id" device type
that forces use of predictable device paths (/dev/disk/by-id/...)

Relevant change to device name parsing regular expression is included
now, so predictable device paths are now also usable when directly
specified.

Signed-off-by: Piotr Dobrowolski <admin@tastycode.pl>
(cherry picked from commit 4c5f721e11)

Conflicts:
  - file: 'readjson.go'
    comment: 'manually resolve new logger issues'

* Rework device label, fix SATA discovery, per-device type specification

Signed-off-by: Piotr Dobrowolski <admin@tastycode.pl>
(cherry picked from commit 319184ce66)

Conflicts:
  - file: 'main.go'
    comment: 'manually resolve new logger issues'
  - file: 'readjson.go'
    comment: 'manually resolve new logger issues'

---------

Co-authored-by: Piotr Dobrowolski <admin@tastycode.pl>
2024-12-19 11:02:09 +01:00
nathanlcarlson
3fa5ea5a5d
Accomodate a smartmontools pre-7.3 bug (#238)
* Accomodate a smartmontools pre-7.3 bug

https://www.smartmontools.org/changeset/5283
---------

Signed-off-by: Nathan Carlson <carl4403@umn.edu>
2024-11-08 09:02:29 +01:00
TJ Hoplock
2c043b7fcb
chore!: adopt slog, drop go-kit/log (#246)
The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

Other changes include:
- bumping prometheus/{common,client_golang,exporter-toolkit}
- bump minimum go version to go1.22
- remove old go-kit/log linter configs, add sloglint

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-10-18 09:18:48 +02:00
David Randall
391aae38e4 Use long option and move the device name to the end
Signed-off-by: David Randall <David@NiceGuyIT.biz>
2024-05-05 10:29:02 -04:00
mort
3a012b5bb1 Implemented new features - extract raid member disk name.
Modified smartctl.device param - now you can set it as sda, megaraid_disk_01, etc.

Signed-off-by: Denys <zxzharmlesszxz@gmail.com>
2024-03-08 15:40:11 +01:00
Ben Kochie
77e6b075fa
Update json reading logging (#198)
Update the smartctl command reading and parsing of json logging to make
for easier debugging of slow devices by adding a duration to the debug
logging.

For https://github.com/prometheus-community/smartctl_exporter/issues/197

Signed-off-by: SuperQ <superq@gmail.com>
2024-01-25 17:52:05 +01:00
David Randall
17207c7b4b
Merge pull request #141 from k0ste/help2
Added device name to logger rc code parser
2023-08-10 08:47:22 -04:00
Konstantin Shalygin
75ab833fd0
Added device name to logger rc code parser
Signed-off-by: Konstantin Shalygin <k0ste@k0ste.ru>
2023-08-08 12:42:50 +03:00
John Thiltges
b333d3f2f0 Include SCSI error counters in smartctl JSON output
Signed-off-by: John Thiltges <jthiltges2@unl.edu>
2023-06-29 15:34:57 -05:00
SuperQ
5bd7420ca8
Update build
* Update Go to 1.20.
* Update CI orb.
* Update golangci-lint.
* Update Go modules.
* Use new landing page function.

Signed-off-by: SuperQ <superq@gmail.com>
2023-04-12 09:36:11 +02:00
Jakub Klinkovský
6e2143ca62 Remove useless error message
All errors are already logged from the called functions: readSMARTctl,
resultCodeIsOk, jsonIsOk. Logging twice due to the same error is useless
and the "smartctl returned bad data for device" message is confusing
since that condition may happen when a device is in a low-power mode.

Signed-off-by: Jakub Klinkovský <j.l.k@gmx.com>
2022-11-06 11:56:41 +01:00
David Randall
18b5b8d57e Fixes #23: Race condition with maps and goroutines
Signed-off-by: David Randall <David@NiceGuyIT.biz>
2022-11-05 08:55:14 -04:00
赵栩彬
daf1182285 FIX: remove os.stat in order to fit in windows
Signed-off-by: 赵栩彬 <zhaoxubin2016@mail.com>
2022-10-15 11:46:28 +08:00
Ben Kochie
e88442081c
Adjust smartctl command args (#74)
Update smartctl command arguments to reduce device wakeup from
standby/idle.
* Ignore exit code of 2 for sleeping devices.

Fixes: https://github.com/prometheus-community/smartctl_exporter/issues/61

Signed-off-by: SuperQ <superq@gmail.com>

Signed-off-by: SuperQ <superq@gmail.com>
2022-10-03 14:49:32 +02:00
Ben Kochie
c8d3e48f3d
Refactor exporter config (#68)
Switch exporter over to standard Prometheus exporter flags and logging.
This eliminates the need for a configuraion file.

Signed-off-by: SuperQ <superq@gmail.com>
2022-10-03 11:16:00 +02:00
Ben Kochie
920c3429b1
Release 0.7.0 (#50)
First prometheus-community release.

* [FEATURE] Add various new metrics #14
* [BUGFIX] Fix exit code bit parsing #37

Signed-off-by: SuperQ <superq@gmail.com>
2022-08-05 03:37:13 +02:00
Andreas Fuchs
d33d18e535
Return the cached value if it's not time to scan again yet (#18)
* Return the cached value if it's not time to scan again yet

This should ensure that if we have a valid value cached (which ought
to be every time after the first scan), we return it as metrics.

This fixes the crashes that would happen if queries happened earlier
than the re-scan interval allowed.

* Address review feedback: Shorten the time-to-scan logic

We can express this in a single if statement, so it takes fewer lines
to do the "should we check again" check.
2022-08-05 03:09:55 +02:00
Ben Kochie
1625848c5d
Merge pull request #37 from singron/fix-reversed-bits
Fix exit code bit parsing
2022-07-17 15:22:32 +02:00
SuperQ
c0e4746c80
Update build for prometheus-community
Use standard Prometheus Community build infra.
* Update Go modules for new location
* Update references to github URLs
* Update for Go 1.17+

Signed-off-by: SuperQ <superq@gmail.com>
2022-06-17 12:04:48 +02:00
Eric Culp
6b6fd628d2 Fix exit code bit parsing
The previous code was parsing left-to-right, but the bits are actually
numbered right-to-left (least to most significant). Instead of
converting to strings, just use bitmasks.

Fixes https://github.com/prometheus-community/smartctl_exporter/issues/22

Signed-off-by: Eric Culp <eculperic@gmail.com>
2022-03-17 16:57:34 -06:00
Горлов Максим
e27581d56a apply merges 2020-11-14 18:36:34 +03:00
Горлов Максим
cbc437fea9 Parsing smartctl error code; parsing resulting json for smartctl errors; docker moved to subfolder 2020-10-30 00:35:49 +03:00
Christian Pedersen
593ca96a99 Automatically load the available devices 2020-10-06 13:05:00 +02:00
Горлов Максим
beb765eb1a option for set minimum time period between run smartctl; smartctl info metric 2019-08-16 00:01:16 +03:00
Горлов Максим
9e6e240e85 First commit 2019-08-14 23:34:49 +03:00