Check SNMP Synology

Script: check_snmp_synology

check_snmp_data is a plugin to check the status of a Synology storage using snmp v2 or v3.

Requirements

  • snmpget
  • snmpwalk

Standalone installation

From this repository ypu need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash
  • check_snmp_includes with a shared snmp config reader

Syntax

Start the script without parameter to get the help.

______________________________________________________________________

CHECK_SNMP_SYNOLOGY 
v1.4

Based on script of Nicolas Ordonez.

Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________

Check health of a Synology drive using SNMP.

SYNTAX:
    check_snmp_synology [options] -h TARGET

OPTIONS:
    -a STRING
        Authentication params for snmpwalk/ snmpget to connect to target; 
        default: "-v2c -c public" (Snmpv2 with community string "public")
    -h SNMPTARGET
        Set a target to connect as fqdn or ip address; default: localhost
    -f FILE
        Read authentication from config file. See section 'CONFIG FILE' below.
        default: "/etc/icinga2/snmp.cfg"

    By default all checks will be executed. You can linit the executed checks
    by naming single checks:

    -s  System check:
        - Show system data: model, serial number, DSM version
        - System status
        - Power status
        - System fan Status
        - CPU fan status
    -d  Disk check: 
        - status and temperature of each hard disk
        - status of all raid volumes
        - free disk space
    -u  Update check; check switches to warning if an update is available
    -t  Temerature check

    -v  Enable detailed output of the checks. It is recommended for
        system status and disk status.

CONFIG FILE:
    The config file can be multiline and has the syntax
    [SNMPTARGET[,target2]]:[auth parameters]
    The auth parameters set the version and all needed values to connect.
    Snmp v2 uses a community string.
    Snmp v3 is highly recommended (you should disable Snmp v2) and needs
    a user and password.

    Example:
    server-01.example.com:-v 3 -l authnoPriv -a SHA -u snmpmonitor -A password-for-server-01
    server-02.example.com,192.168.0.4:-v 3 -l authnoPriv -a SHA -u snmpmonitor -A password-for-server-02

EXAMPLE:

    check_snmp_synology -h server-01.example.com -v
        Show complete Synology status of server-01 using connect data from 
        /etc/icinga2/snmp.cfg

    check_snmp_synology -h server-01.example.com -v -f /opt/somewhere/snmp.conf
        Show complete Synology status of server-01 using connect data from 
        custom config file

    check_snmp_synology -h server-01.example.com -u
        Make a single check if update is available.

Examples

Complete status

./check_snmp_synology -h server-01.example.com -v

Shows the full set of status checks. The output is something like that:

OK:   Synology "RS3614xs+" (s/n: "1410M9N0*****", "DSM 7.1-42962")
                          
---------- INFORMATION    
Synology model:           "RS3614xs+"
Synology s/n:             "1410M9N0*****"
DSM Version:              "DSM 7.1-42962"
Update available:         Up to date (2)
                          
---------- SYSTEM         
System Status:            Normal
Power Status:             Normal
System Fan Status:        Normal
CPU Fan Status:           Normal
NAS temperature:          40 °C
                          
---------- STORAGE        
Number of disks:          12
  "Disk 1" (model:"ST2000NM0008-2F3100") status: Normal (1) temperature: 29 °C 
  "Disk 2" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 3" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 4" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 33 °C 
  "Disk 5" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 34 °C 
  "Disk 6" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 7" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 8" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 34 °C 
  "Disk 9" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 10" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 11" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 35 °C 
  "Disk 12" (model:"ST2000NM0033-9ZM175") status: Normal (1) temperature: 34 °C 
                          
Number of RAID volumes:   1
  "Volume 1" status: Normal (1) - size 20282 GB, free 7514 GB (37%) 

Check temperature only

./check_snmp_synology -h server-01.example.com -t

Without -v param you get a short status with a single line. For this check the details are useless.

Next to the status you get a line with performance data.

OK: NAS temperature: 40 °C

 |temp=40;;

Check os update only

./check_snmp_synology -h server-01.example.com -u

Without -v param you get a short status with a single line. For this check the details are useless.

OK: Up to date

SNMP authentication configuration

In a configuration file you can put the authentication parameters for snmpget and snmpwalk.

By default it reads /etc/icinga2/snmp.cfg - but you can use -f FILENAME to override it.

sudo cat /etc/icinga2/snmp.cfg 
#
# snmp-connections
# SYNTAX: [hostname]:[params]
#
DEFAULT:-v 2c -c public
server-01.example.com:-v 3 -l authnoPriv -a SHA -u imlmonitor -A password-for-server-01
server-02.example.com:-v 3 -l authnoPriv -a SHA -u imlmonitor -A password-for-server-02