Download details

check_synology check_synology.php

Informationen
Erstelldatum 01.01.2021
Änderungsdatum 06.10.2021
Version 1.20211005
Dateigröße 1.79 MB
Downloads 410
Lizenz MIT Lizenz external
Preis Donate PayPal

 

Nagios Plugin to check a Synology NAS over SNMP

You need to install php-snmp

If you find a bug or have a request, write me.


/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m system -t temperatur -w 35 -c 45
Warning - 36.00 °C | Temperatur=36.00;35;45

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m system -t update -c ~2 -w 2
OK - DS720+ , XXXXXXXXXXXXX , DSM 7.0-41222 , Unavailable

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m system -t status
OK - System: OK - Powerstatus: OK - Fan: OK - CpuFan: OK

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m cpu -t usage -w 80 -c 90
OK - 9% (User: 7% System: 2% I/O Wait: 2% Idle: 89%)|Cpu=9%;80;90;; User=7% System=2% IOWait=2% Idle=89%

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m memory -t usage -w 80 -c 90
OK - 40.8% (4092376KB | TOTAL=10031480KB;;;; USED=4092376KB;;;; FREE= 218228KB;;;; CACHES=5720876KB;;;;

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m disk -t status
OK - Normal: 4 - Initalized: 0 - NotInitalized: 0 - SystemPartitionFailed: 0 - Crashed: 0

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m disk -t status -n 2
OK - Disk 2: WD80EFAX-68KNBN0 (SATA) , Normal

/usr/bin/php 
Critical - 35.00 °C | Temperatur=35,00;25;30

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m raid -t status
OK - Volume 1: Normal

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m raid -t usage -w 50 -c 90
WARNING - Free: 2432.381 GB , Used: 4717.251 GB , Total: 7149.632 GB| used=4717.251GB;3574.500;6434.100

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m ups -t usage -w 50 -c 25
OK - Charged: 100% (Seconds: 1171) | Charged=100%;50;25;; Seconds=1171

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m service -t CIFS -w 5 -c 10
Warning - CIFS: 9

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 3 -m service -t CIFS -w 5 -c 10 -u nagios -p nagiossnmp -a MD5 -x DES -X nagiossnmp
Warning - CIFS: 9

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m network -V
Array
(
[iso.3.6.1.2.1.31.1.1.1.1.1] => STRING: "lo"
[iso.3.6.1.2.1.31.1.1.1.1.2] => STRING: "sit0"
[iso.3.6.1.2.1.31.1.1.1.1.3] => STRING: "eth1"
[iso.3.6.1.2.1.31.1.1.1.1.4] => STRING: "eth0"
[iso.3.6.1.2.1.31.1.1.1.1.5] => STRING: "ovs-system"
[iso.3.6.1.2.1.31.1.1.1.1.6] => STRING: "ovs_eth0"
[iso.3.6.1.2.1.31.1.1.1.1.7] => STRING: "ovs_eth1"
[iso.3.6.1.2.1.31.1.1.1.1.10] => STRING: "tap080027072e2b"
[iso.3.6.1.2.1.31.1.1.1.1.11] => STRING: "tap080027D5E8A7"
)

/usr/bin/php ./check_synology.php -H 192.168.2.200 -P 2 -C public -m network -t usage -n 3
OK - eth1: In: 0.00% (0.68 KB/s ) - Out: 0.00% (0.00 KB/s) | IN=0.00% OUT=0.00%

/usr/bin/php ./check_synology.php -H 192.168.2.200 -m uptime
OK - 5 days, 18 hours, 7 minutes, 41 seconds 

./check_synology.php -H 192.168.2.200 -m disksmart -t status -w 10 -c 50
WARNING - Disksmart 2 [Disk: 1 Reallocated_Sector_Ct(5)=40]


 

Usage:

/usr/bin/php check_synology.php -H [Synology NAS] -P [snmp_version] -m [mode]( -n [number] ( -t [test] -l [data] -w [Warning] -c [Critical] -d(php debug) -V (snmp debug) )

 

snmp_version 2 -C [community string] (default -C public)
            -3 -u [user] -p [password] -a [auth. prot. (MD5/SHA] ( -x [priv. proto. (DES/AES)] -X [priv. password])

-m mode

system
cpu
memory
disk
raid
service 
ups
network
uptime
disksmart (*)(info: https://kb.synology.com/de-de/DSM/tutorial/How_to_diagnose_drives_health_status_when_receiving_bad_sector_warning)
io (only snmp debug)
spaceio (only snmp debug)
flashcache (only snmp debug)
iscsilun (only snmp debug)
ebox (only snmp debug)
ha (only snmp debug)
gpuinfo (only snmp debug)

(*) - disksmart is warning if smart id 5 is
      greater or equal warning parameter
      or critical it is greater or equal critical parameter
    - warning if smart id 1 is greater 0 (only Samsung and WD)
    - warning if smart id 5 and 197 and 198 are greater 0

-n number disk/raid/network

-t test temperatur (system/disk)
update (system)
status (system/disk/raid/ups)
usage (raid/cpu/memory/ups/network)
CIFS, AFP, NFS, FTP, SFTP, HTTP/HTTPS, TELNET, SSH, OTHER (Services)


-l data F=Fahrenheit or C=Celsius (default)
T=Terrabyte or G=Gigabyte (default)

  

Example Critical
and Warning 
 (temperatur, update, status and services (CIDS, AFP ...):
-w 10 -c 20 = warning > 10 and critical > 20
-w ~20 -c ~10 = warning < 20 and critical < 10
-c @10:20 = critical ≥ 10 and ≤ 20, (inside the range of {10 .. 20})
-c 10:20 = critical < 10 or > 20, (outside the range of {10 .. 20})
-w 10:20 -c 5:25 = warning < 10 or > 20, (outside the range of {10 .. 20}) and critical < 5 or > 25,(outside the range of {5 .. 25})

 

Example Critical
and Warning 
procent (Usage)
-w 80 -c 90 = warning > 80% and critical > 90% (raid, cpu, memory)
-w ~50 -c ~25 = warning < 50% and critical < 25% (ups)

 


 

synology_cpu synology_disk2 synology_disk_temp3 synology_mem4 synology_network5 synology_ups6

Changelog

Version 1.20211004
add disksmart

Thank's to Joel


Version 1.20210828
check disk status correction
Thank's to Joel


Version 1.20210717
check ups usage seconds instead of minutes


Version 1.20210620
corrected warning/critical raid usage


Version 1.20210526
corrected typo error


Version 1.20210319
corrected raid usage (GB instead of MB)


Version 1.20210316
add uptime
update information, if there is no connection to NAS


Version 1.20210308
changed decimal point from comma to point
Thanks to "sziloo" from exchange.nagios.com


Version 1.20210226
add minutes to perfdata ups


Version 1.20210215
add check network


Version 1.20210205
corrected cpu (iowait)


Version 1.20210204
add check total disk status (-m disk -t status) - 256 disks
warning if disk Initalized or NotInitalized is greater 0 or critical disk SystemPartitionFailed or Crashed is greater 0


Version 1.20210124
minor bugs fixes


Version 1.20210111
add check ups


Version 1.20210106
add check cpu and memory usage 


Version 1.20210105
changed status, if there is no raid or raid number
changed status, if the disc number does not exist


Version 1.20210104
corrected TB warning and critical value performance data

  

Would you like to support me?
Then donate to PayPal...