Getting SNMP data with NAGIOS

It is proven technology

© 2017 Dennis Leeuw dleeuw at made-it dot com
License: GPLv2 or later

Index

    1. Creating a SMART connector for SNMP to NAGIOS
    2. Define a command
    3. Tie the command to a host

Creating a SMART connector for SNMP to NAGIOS

According to the Seagate the S.M.A.R.T. data provided by their harddisks can not be trusted and can only be reliable read by their own tools, which of course are available for Windows and DOS and can thus not be run on a running Linux machine. For now I decided to settle for the total SMART status as provided in OID .1.3.6.1.4.1.38696.2.1.2.1.8

I hope to extend the script in the future for other values. The most recent version is available as check_snmp_smart and should be installed in one of the NAGIOS supported directories. The following examples assume it is installed in the USER1 dir.

Define a command

First we need to define a command in NAGIOS that collects the data:

# 'check_snmp_smart' command definition
define command{
        command_name    check_snmp_smart
        command_line    $USER1$/check_snmp_smart -H $HOSTADDRESS$ -s $ARG1$
        }
To make is useable by different hosts we use the HOSTADDRESS variable and we add one argument that contains the disks serial number, since device names might not be unique, the serial number is.

Tie the command to a host

We define a service to check and tie it to the host, of course you should use your own host and one of the serial numbers of a disk within that host. Change the bold printed values.

define service{
        use                             local-service
        host_name                       ceph01
        service_description             Harddisk Z1Z3VSJA
        check_command                   check_snmp_smart!Z1Z3VSJA
        }