Icinga2 using default check_snmp for diskspace

To not have to install or even write plugins for simple things like the remaining diskspace of the root partition on a remote server, one can simply use the default check_snmp plugin from nagios. Just create your command in commands.conf like this (remember to replace -C with your snmp community string) :

object CheckCommand “snmpdisk” {
command = [ PluginDir + “/check_snmp” ]
arguments = {
“-H” = “$address$”
“-C” = “snmpcommunityofremoteservers”
“-o” = “UCD-SNMP-MIB::dskAvail.1”
“-w” = “$host.vars.d1w$”
“-c” = “$host.vars.d1c$”

Then in services.conf:

apply Service “disk” {
import “generic-service”
check_command = “snmpdisk”
assign where host.vars.htype == “snmp”

And then we can add the following to the host definition for a warning below 200gb and critical state below 100gb. These values could also be added to the command directly, but it’s probably easier to handle if we keep it a definition per host.:

vars.htype = “snmp”
vars.d1w = “200000000:100000000”
vars.d1c = “100000000:0”


Veröffentlicht unter linux