Go to file
Lars Hoogestraat 678fa691b1 minor doc 2021-02-03 21:00:10 +01:00
.gitignore support for availabe space check in bytes 2021-02-03 17:19:03 +01:00
LICENCE init 2020-07-09 14:33:59 +02:00
README.md minor doc 2021-02-03 21:00:10 +01:00
THIRDPARTY clean-up / use new gosnmp fork 2021-01-19 16:15:44 +01:00
go.mod support for availabe space check in bytes 2021-02-03 17:19:03 +01:00
go.sum support for availabe space check in bytes 2021-02-03 17:19:03 +01:00
main.go fmt format fix 2021-02-03 17:21:15 +01:00

README.md

Description

check_netapp is a command line tool to request information about the health of your NetApp e.g. for icinga.

This tool offers the following abilities:

  • Check the used and available space of volumes
  • Disk, fan and electronic failures
  • Obtaining the product version and firmware version

Usage

./check_netapp (version|df|fw|fansfailed|elecfailed|diskfailed)

Examples

Available disk space

List all available volumes (same as if you walk over OID: .1.3.6.1.4.1.789.1.5.4.1.2.):

./check_netapp df -H netapp.example.com -C public -l

returns the following

 SNMPv2-SMI::enterprises.789.1.5.4.1.2.1046 = STRING: "/vol/datastore01"
 SNMPv2-SMI::enterprises.789.1.5.4.1.2.1047 = STRING: "/vol/datastore02"
 SNMPv2-SMI::enterprises.789.1.5.4.1.2.1048 = STRING: "/vol/datastore03"

Returns total / used / available / disk space of volume 1047 (/vol/datastore02)

./check_netapp df -H netapp.example.com -C public -i 1047

returns the following text:

Space of volume /vol/datastore02 has usage of 26.54%. Space total: 18.0 TB - Space available: 13.3 TB - Space used: 4.8 TB

You can use the name of the volume. It needs to walk over all volumes.

./check_netapp df -H netapp.example.com -C public -p /vol/datastore02.

You can set simple thresholds of percentage of used space, e.g. -c for critical (exit code 1) and -w for warnings (exit code 2)

./check_netapp df -H netapp.example.com -C public -i 1047 -c 90 -w 80

would exit with error code 1, if usage is above 90% and if usage is between 80-90% it returns with exit code 2.

You can set simple thresholds of available space in form of a string representation, e.g. -cb for critical (exit code 1) and -wb for warnings (exit code 2)

./check_netapp df -H netapp.example.com -C public -i 1047 -cb '130 MiB' -wb '150 MiB'
./check_netapp df -H netapp.example.com -C public -i 1047 -cb '130 GB' -wb '150 GB'

Fan failures

Check for failures of the fans

./check_netapp fansfailed -H netapp.example.com -C public

Disk failures

Check for failures of the disks

./check_netapp diskfailed -H netapp.example.com -C public

Electronic failures

Check for failures of the electronic

./check_netapp elecfailed -H netapp.example.com -C public

Firmware information

Returns the current firmware information

./check_netapp fw -C public

Example usage with icinga

Command configuration

object CheckCommand "check-netapp-df" {
  command = [ PluginDir + "/check_netapp" ]

  arguments = {
    "df" = {
        order = -1
        required = true
    }
    "-H" = "$address$"
    "-i" = "$volumeID$"

    "-c" = {
      value = "$critical$"
    }
    "-w" = {
      value = "$warning$"
    }
    "-cb" = {
      value = "$criticalBytes$"
    }
    "-wb" = {
      value = "$warningBytes$"
    }
  }
}

object CheckCommand "check-netapp-electronic" {
  command = [ PluginDir + "/check_netapp" ]

  arguments = {
    "elecfailed" = {
        order = -1
        required = true
    }
    "-H" = "$address$"
  }
}

object CheckCommand "check-netapp-version" {
  command = [ PluginDir + "/check_netapp" ]

  arguments = {
    "version" = {
        order = -1
        required = true
    }
    "-H" = "$address$"
  }
}

object CheckCommand "check-netapp-firmware" {
  command = [ PluginDir + "/check_netapp" ]

  arguments = {
    "fw" = {
        order = -1
        required = true
    }
    "-H" = "$address$"
  }
}

object CheckCommand "check-netapp-diskfailed" {
  command = [ PluginDir + "/check_netapp" ]

  arguments = {
    "diskfailed" = {
        order = -1
        required = true 
    }
    "-H" = "$address$"
    "-c" = "1"
  }
}

Service configuration

It uses the group "netapp" to apply the checks.

apply Service "check-netapp-version" {
  import "generic-service"

  check_command = "check-netapp-version"

  vars.host.name = host.name
  vars.host.address = host.address
  assign where "netapp" in host.groups
}

apply Service "check-netapp-firmware" {
  import "generic-service"

  check_command = "check-netapp-firmware"

  vars.host.name = host.name
  vars.host.address = host.address
  assign where "netapp" in host.groups
}

apply Service "check-netapp-fans" {
  import "generic-service"

  check_command = "check-netapp-fans"

  vars.host.name = host.name
  assign where "netapp" in host.groups
}

apply Service "check-netapp-electronic" {
  import "generic-service"

  check_command = "check-netapp-electronic"

  vars.host.name = host.name
  vars.host.address = host.address
  assign where "netapp" in host.groups
}

apply Service "check-netapp-diskfailed" {
  import "generic-service"

  check_command = "check-netapp-diskfailed"

  vars.host.name = host.name
  assign where "netapp" in host.groups
}

Host configuration

object Host "netapp" {
    import "generic-host"

    address = "xxx.xxx.xxx.xxx"
    display_name = "NetApp

    groups += ["netapp"]
    
    vars.volumes["datastore01"] = {
        id = 1047
        criticalBytes = "50 MB"
        warningBytes = "100 MB"
    }

    vars.volumes["datastore02"] = {
        id = 1047
        critical = 99
        warning = 97
    }
}