-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hddtemp_smartctl: configure warning and critical temps per device
this is useful if you have a mix of drives in the system (e.g. HDD + SSD) that have different temperature limits
- Loading branch information
Showing
1 changed file
with
27 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,16 +15,20 @@ the harddrive devices. | |
The following environment variables are used | ||
smartctl - path to smartctl executable | ||
drives - List drives to monitor. E.g. "env.drives hda hdc". | ||
type_$dev - device type for one drive, e.g. "env.type_sda 3ware,0" | ||
or more typically "env.type_sda ata" if sda is a SATA disk. | ||
args_$dev - additional arguments to smartctl for one drive, | ||
e.g. "env.args_hda -v 194,10xCelsius". Use this to make | ||
the plugin use the --all or -a option if your disk will | ||
not return its temperature when only the -A option is | ||
used. | ||
dev_$dev - monitoring device for one drive, e.g. twe0 | ||
smartctl - path to smartctl executable | ||
drives - List drives to monitor. E.g. "env.drives hda hdc". | ||
type_$dev - device type for one drive, e.g. "env.type_sda 3ware,0" | ||
or more typically "env.type_sda ata" if sda is a SATA disk. | ||
args_$dev - additional arguments to smartctl for one drive, | ||
e.g. "env.args_hda -v 194,10xCelsius". Use this to make | ||
the plugin use the --all or -a option if your disk will | ||
not return its temperature when only the -A option is | ||
used. | ||
dev_$dev - monitoring device for one drive, e.g. twe0 | ||
$dev.warning - set warning temperature for $dev, default 57 (°C) | ||
e.g. "env.nvme0n1.warning 70" | ||
$dev.critical - set critical temperature for $dev, default 60 (°C), | ||
e.g. "env.nvme0n1.critical 80" | ||
If the "smartctl" environment variable is not set the plugin will | ||
search your $PATH, /usr/bin, /usr/sbin, /usr/local/bin and | ||
|
@@ -46,6 +50,9 @@ All rights reserved. | |
2016-08-27, Gabriele Pohl ([email protected]) | ||
Fix for github issue #690 | ||
2023-07-23, Andreas Perhab, WT-IO-IT GmbH | ||
enable configuring warning and critical temps | ||
=head1 LICENSE | ||
Redistribution and use in source and binary forms, with or without | ||
|
@@ -227,8 +234,16 @@ if (defined $ARGV[0]) { | |
my @dirs = splitdir($_); | ||
print $d . ".label " . $dirs[-1] . "\n"; | ||
print $d . ".max 100\n"; | ||
print $d . ".warning 57\n"; | ||
print $d . ".critical 60\n"; | ||
my $warning = "57"; | ||
if (defined($ENV{clean_fieldname($_) . ".warning"})) { | ||
$warning = $ENV{clean_fieldname($_) . ".warning"}; | ||
} | ||
print clean_fieldname($_) . ".warning $warning\n"; | ||
my $critical = "60"; | ||
if (defined($ENV{clean_fieldname($_) . ".critical"})) { | ||
$critical = $ENV{clean_fieldname($_) . ".critical"}; | ||
} | ||
print clean_fieldname($_) . ".critical $critical\n"; | ||
my $id = get_drive_id($_, device_for_drive($_), $use_nocheck); | ||
print $d . ".info $id\n"; | ||
} | ||
|