Hi,
I have a host with different kinds of drives on which I want to apply a smart check:
plugin file: /usr/lib/nagios/plugins/check_smart.pl
Command definition:
object CheckCommand "smart_attributes" {
import "plugin-check-command"
command = [ PluginDir + "/check_smart.pl" ]
arguments = {
"-d" = {
value = "$smart_devices$"
description = "A physical block device to be SMART monitored"
}
"-g" = {
value = "$smart_global$"
description = "A glob expression of physical devices to be monitored"
}
"-i" = {
required = true
value = "$smart_interface$"
description = "Drive's interface type"
}
"-r" = {
value = "$smart_raw$"
description = "List (comma separated, without spaces!) of SMART attributes to check for their raw values"
}
"-b" = {
value = "$smart_attributes_bad$"
description = "Threshold value (integer) when to warn for N bad entries"
}
"-w" = {
value = "$smart_warn$"
description = "Comma separated list of thresholds for ATA drives"
}
"-e" = {
value = "$smart_exclude$"
description = "List of (comma separated) SMART attributes which should be excluded (=ignored) from checks."
}
"-E" = {
value = "$smart_exclude_all$"
description = " List of (comma separated) SMART attributes which should be excluded (=ignored) completely, for both checks and performance data."
}
"-s" = {
value = "$smart_selftest$"
description = "Additionally check SMART's selftest log for errors."
}
"-l" = {
value = "$smart_ssd_lifetime$"
description = "Additionally check attribute 'Percent_Lifetime_Remain' which is available on some SSD drives."
}
}
}
Service Definition:
apply Service "check_smart_sata" {
import "generic-service"
check_command = "smart_attributes"
command_endpoint = host.vars.client_endpoint
assign where host.vars.smart_sata
host.vars.smart_global = "/dev/sd[a-z]"
host.vars.smart_interface = "ata"
}
apply Service "check_smart_nvme" {
import "generic-service"
check_command = "smart_attributes"
command_endpoint = host.vars.client_endpoint
assign where host.vars.smart_nvme
host.vars.smart_global = "/dev/nvme[0-9]"
host.vars.smart_interface = "nvme"
}
apply Service "check_smart_scsi" {
import "generic-service"
check_command = "smart_attributes"
command_endpoint = host.vars.client_endpoint
assign where host.vars.smart_scsi
host.vars.smart_global = "/dev/da[0-9]"
host.vars.smart_interface = "scsi"
}
apply Service "check_smart_raid_ctrl" {
import "generic-service"
check_command = "smart_attributes"
command_endpoint = host.vars.client_endpoint
assign where host.vars.smart_cciss
host.vars.smart_global = "/dev/sd[a-z]"
host.vars.smart_interface = "cciss,0"
}
apply Service "check_smart_dom" {
import "generic-service"
check_command = "smart_attributes"
command_endpoint = host.vars.client_endpoint
assign where host.vars.smart_dom
host.vars.smart_global = "/dev/ada[0-9]"
host.vars.smart_interface = "auto"
}
object Host "<hostname>" {
import "generic-host-bm-bsd"
address = "10.X.X.X"
vars.smart_dom = true
vars.smart_nvme = true
vars.smart_scsi = true
}
The three smart checks are all executed with the value for the scsi drives da[x]
, thus also the nvme check and the dom check are looking for a device named da[x]
. Seems that last match wins. If I disable the other checks and each check is applied alone, they work stand-alone as intended (e.g. checking for nvd0
).
(Somehow similar to this problem, but thew solution does not fit for me)
Right now I’m a little stuck - so any idea to make it work?
Thank you very much!
Icinga Version Info:
icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.13.7-1)
Copyright (c) 2012-2023 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
System information:
Platform: Debian GNU/Linux
Platform version: 10 (buster)
Kernel: Linux
Kernel version: 4.19.0-23-amd64
Architecture: x86_64
Build information:
Compiler: GNU 8.3.0
Build host: runner-hh8q3bz2-project-575-concurrent-0
OpenSSL version: OpenSSL 1.1.1n 15 Mar 2022