Skip to content

Commit

Permalink
nvme: enable specifying warnings and criticals for serial numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-wtioit authored and sumpfralle committed Oct 13, 2021
1 parent 5023485 commit 6408924
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/disk/nvme
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ name, e.g., 'nvme0n1', to make environment variable:
env.nvme_usage_nvme0n1_warning 5:
env.nvme_usage_warning 8:
If your device names change on reboot you can also use the labels
(based on serial numbers) to set the warning and critical labels
env.nvme_usage_SN_1234567_warning 8:101
env.nvme_usage_SN_1234567_critical 5:101
=head1 INTERPRETATION
This is a multigraph plugin which makes three graphs.
Expand Down Expand Up @@ -191,8 +197,10 @@ sub smart_log {
sub my_print_thresholds {
my ($label, $graph, $device, $warn_default, $crit_default) = @_;
my $dev = basename($device);
my ($warn, $crit) = get_thresholds($graph, "${graph}_${dev}_warning", "${graph}_${dev}_critical",
my ($warn_label, $crit_label) = get_thresholds($graph, "${graph}_${label}_warning", "${graph}_${label}_critical",
$warn_default, $crit_default);
my ($warn, $crit) = get_thresholds($graph, "${graph}_${dev}_warning", "${graph}_${dev}_critical",
$warn_label, $crit_label);
print "${label}.warning $warn\n" if defined $warn;
print "${label}.critical $crit\n" if defined $crit;
}
Expand Down

0 comments on commit 6408924

Please sign in to comment.