check_smart.conf
· 5.4 KiB · Text
原始檔案
object CheckCommand "check-smart" {
import "plugin-check-command"
command = [ "/usr/lib/monitoring-plugins" + "/check_smart" ]
arguments = {
"--device" = {
value = "$smart_device$"
set_if = {{ macro("$smart_device_is_glob$") == false }}
description = "A physical block device to be SMART monitored, eg /dev/sda. Pseudo-device /dev/bus/N is allowed."
}
"--global" = {
value = "$smart_device$"
set_if = {{ macro("$smart_device_is_glob$") == true }}
description = "A glob expression of physical devices to be monitored, eg -g '/dev/sd[a-z]'."
}
"--interface" = {
value = "$smart_interface$"
description = "Drive's interface type, must be one of: auto, ata, scsi, nvme, 3ware,N, areca,N, hpt,L/M/N, cciss,N, megaraid,N, aacraid,N,N,N"
required = true
}
"--raw" = {
value = "$smart_raw_list$"
description = "List (comma separated, without spaces!) of SMART attributes to check for their raw values."
}
"--exclude" = {
value = "$smart_exclude_list$"
description = "List of (comma separated) SMART attributes which should be excluded (=ignored) from checks."
}
"--exclude-all" = {
value = "$smart_exclude_all_list$"
description = "List of (comma separated) SMART attributes which should be excluded (=ignored) completely, for both checks and performance data."
}
"--bad" = {
value = "$smart_bad$"
description = "Threshold value (integer) when to warn for N bad entries (ATA: Current Pending Sector, SCSI: Grown defect list). Note: Deprecated for ATA drives, use `smart_warn` instead. Continue to use this for SCSI drives."
}
"--warn" = {
value = "$smart_warn$"
description = "Comma separated list of thresholds for ATA drives (e.g. `'Reallocated_Sector_Ct=10,Current_Pending_Sector=62'`)."
}
"--selftest" = {
set_if = "$smart_selftest$"
description = "If set to true, additionally check SMART's selftest log for errors."
}
"--ssd-lifetime" = {
set_if = "$smart_ssd_lifetime$"
description = "If set to true, additionally check SSD attribute Percent_Lifetime_Remain."
}
"--quiet" = {
set_if = "$smart_quite$"
description = "If set to true, additionally check SSD attribute Percent_Lifetime_Remain."
}
"--skip-self-assessment" = {
set_if = "$smart_skip_self_assessment$"
description = "If set to true, when faults are detected, only show failing drive(s) (only affects output when used with -g parameter)."
}
"--debug" = {
set_if = "$smart_debug$"
description = "If set to true, additionall debugging information is shown."
}
}
vars.smart_device = "/dev/sda"
vars.smart_interface = "auto"
vars.smart_device_is_glob = false
vars.smart_selftest = false
vars.smart_ssd_lifetime = false
vars.smart_quiet = false
vars.smart_skip_self_assessment = false
vars.smart_debug = false
timeout = 60s
}
/* apply smart service check */
apply Service "smart" {
import "local-generic-service"
check_command = "check-smart"
command_endpoint = host.name
// notification tag
vars.sections = [ "operatingsystem" ] # TODO GIT
assign where host.vars.os == "Linux" && host.vars.smart_device
ignore where host.vars.nochecksmart
ignore where host.vars.noagent
}
apply Service for (smart_device => config in host.vars.smart_devices) {
import "local-generic-service"
check_command = "check-smart"
vars += config
command_endpoint = host.name
// notification tag
vars.sections = [ "operatingsystem" ] # TODO GIT
ignore where host.vars.nochecksmart
ignore where host.vars.noagent
ignore where typeof(config) != Dictionary
}
object Host "hostname" {
import "linux-host"
address 127.0.1.3
vars.smart_device = "/dev/sda"
vars.smart_interface = "cciss,[0-5]"
vars.smart_device_is_glob = true
vars.smart_devices["smart - device megaraid,12"] = {
smart_device = "/dev/sdb"
smart_interface = "megaraid,12"
smart_device_is_glob = false
}
vars.smart_devices["smart - device megaraid,13"] = {
smart_device = "/dev/sdb"
smart_interface = "megaraid,13"
smart_device_is_glob = false
}
vars.smart_devices["smart - device megaraid,17"] = {
smart_device = "/dev/sdb"
smart_interface = "megaraid,17"
smart_device_is_glob = false
}
vars.smart_devices["smart - device megaraid,18"] = {
smart_device = "/dev/sdb"
smart_interface = "megaraid,18"
smart_device_is_glob = false
}
}
object Endpoint "hostname" {
}
object Zone "hostname" {
endpoints = [ "hostname" ]
parent = "master"
}
| 1 | object CheckCommand "check-smart" { |
| 2 | import "plugin-check-command" |
| 3 | |
| 4 | command = [ "/usr/lib/monitoring-plugins" + "/check_smart" ] |
| 5 | |
| 6 | arguments = { |
| 7 | "--device" = { |
| 8 | value = "$smart_device$" |
| 9 | set_if = {{ macro("$smart_device_is_glob$") == false }} |
| 10 | description = "A physical block device to be SMART monitored, eg /dev/sda. Pseudo-device /dev/bus/N is allowed." |
| 11 | } |
| 12 | "--global" = { |
| 13 | value = "$smart_device$" |
| 14 | set_if = {{ macro("$smart_device_is_glob$") == true }} |
| 15 | description = "A glob expression of physical devices to be monitored, eg -g '/dev/sd[a-z]'." |
| 16 | } |
| 17 | "--interface" = { |
| 18 | value = "$smart_interface$" |
| 19 | description = "Drive's interface type, must be one of: auto, ata, scsi, nvme, 3ware,N, areca,N, hpt,L/M/N, cciss,N, megaraid,N, aacraid,N,N,N" |
| 20 | required = true |
| 21 | } |
| 22 | "--raw" = { |
| 23 | value = "$smart_raw_list$" |
| 24 | description = "List (comma separated, without spaces!) of SMART attributes to check for their raw values." |
| 25 | } |
| 26 | "--exclude" = { |
| 27 | value = "$smart_exclude_list$" |
| 28 | description = "List of (comma separated) SMART attributes which should be excluded (=ignored) from checks." |
| 29 | } |
| 30 | "--exclude-all" = { |
| 31 | value = "$smart_exclude_all_list$" |
| 32 | description = "List of (comma separated) SMART attributes which should be excluded (=ignored) completely, for both checks and performance data." |
| 33 | } |
| 34 | "--bad" = { |
| 35 | value = "$smart_bad$" |
| 36 | description = "Threshold value (integer) when to warn for N bad entries (ATA: Current Pending Sector, SCSI: Grown defect list). Note: Deprecated for ATA drives, use `smart_warn` instead. Continue to use this for SCSI drives." |
| 37 | } |
| 38 | "--warn" = { |
| 39 | value = "$smart_warn$" |
| 40 | description = "Comma separated list of thresholds for ATA drives (e.g. `'Reallocated_Sector_Ct=10,Current_Pending_Sector=62'`)." |
| 41 | } |
| 42 | "--selftest" = { |
| 43 | set_if = "$smart_selftest$" |
| 44 | description = "If set to true, additionally check SMART's selftest log for errors." |
| 45 | } |
| 46 | "--ssd-lifetime" = { |
| 47 | set_if = "$smart_ssd_lifetime$" |
| 48 | description = "If set to true, additionally check SSD attribute Percent_Lifetime_Remain." |
| 49 | } |
| 50 | "--quiet" = { |
| 51 | set_if = "$smart_quite$" |
| 52 | description = "If set to true, additionally check SSD attribute Percent_Lifetime_Remain." |
| 53 | } |
| 54 | "--skip-self-assessment" = { |
| 55 | set_if = "$smart_skip_self_assessment$" |
| 56 | description = "If set to true, when faults are detected, only show failing drive(s) (only affects output when used with -g parameter)." |
| 57 | } |
| 58 | "--debug" = { |
| 59 | set_if = "$smart_debug$" |
| 60 | description = "If set to true, additionall debugging information is shown." |
| 61 | } |
| 62 | } |
| 63 | vars.smart_device = "/dev/sda" |
| 64 | vars.smart_interface = "auto" |
| 65 | vars.smart_device_is_glob = false |
| 66 | vars.smart_selftest = false |
| 67 | vars.smart_ssd_lifetime = false |
| 68 | vars.smart_quiet = false |
| 69 | vars.smart_skip_self_assessment = false |
| 70 | vars.smart_debug = false |
| 71 | timeout = 60s |
| 72 | } |
| 73 | |
| 74 | /* apply smart service check */ |
| 75 | apply Service "smart" { |
| 76 | import "local-generic-service" |
| 77 | |
| 78 | check_command = "check-smart" |
| 79 | |
| 80 | command_endpoint = host.name |
| 81 | |
| 82 | // notification tag |
| 83 | vars.sections = [ "operatingsystem" ] # TODO GIT |
| 84 | |
| 85 | assign where host.vars.os == "Linux" && host.vars.smart_device |
| 86 | ignore where host.vars.nochecksmart |
| 87 | ignore where host.vars.noagent |
| 88 | } |
| 89 | |
| 90 | apply Service for (smart_device => config in host.vars.smart_devices) { |
| 91 | import "local-generic-service" |
| 92 | |
| 93 | check_command = "check-smart" |
| 94 | |
| 95 | vars += config |
| 96 | |
| 97 | command_endpoint = host.name |
| 98 | |
| 99 | // notification tag |
| 100 | vars.sections = [ "operatingsystem" ] # TODO GIT |
| 101 | |
| 102 | ignore where host.vars.nochecksmart |
| 103 | ignore where host.vars.noagent |
| 104 | ignore where typeof(config) != Dictionary |
| 105 | } |
| 106 | |
| 107 | object Host "hostname" { |
| 108 | import "linux-host" |
| 109 | address 127.0.1.3 |
| 110 | vars.smart_device = "/dev/sda" |
| 111 | vars.smart_interface = "cciss,[0-5]" |
| 112 | vars.smart_device_is_glob = true |
| 113 | |
| 114 | vars.smart_devices["smart - device megaraid,12"] = { |
| 115 | smart_device = "/dev/sdb" |
| 116 | smart_interface = "megaraid,12" |
| 117 | smart_device_is_glob = false |
| 118 | } |
| 119 | vars.smart_devices["smart - device megaraid,13"] = { |
| 120 | smart_device = "/dev/sdb" |
| 121 | smart_interface = "megaraid,13" |
| 122 | smart_device_is_glob = false |
| 123 | } |
| 124 | vars.smart_devices["smart - device megaraid,17"] = { |
| 125 | smart_device = "/dev/sdb" |
| 126 | smart_interface = "megaraid,17" |
| 127 | smart_device_is_glob = false |
| 128 | } |
| 129 | vars.smart_devices["smart - device megaraid,18"] = { |
| 130 | smart_device = "/dev/sdb" |
| 131 | smart_interface = "megaraid,18" |
| 132 | smart_device_is_glob = false |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | object Endpoint "hostname" { |
| 137 | } |
| 138 | object Zone "hostname" { |
| 139 | endpoints = [ "hostname" ] |
| 140 | parent = "master" |
| 141 | } |