Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

qnap_health

Rating
0 votes
Favoured:
0
Current Version
1.01
Last Release Date
2021-05-26
Compatible With
  • Nagios 4.x
Owner
License
GPL
Hits
568
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check QNAP NAS health status. Provides a large set of check routines.

Usage: ${0##*/} [-V protocol] -H -C -p -w -c "

Where: -p|--part - part to check"
-h - no human-readable output; do not use unit suffixes"
-w|--warning - warning"
-c|--critical - critical"
-t|--timeout - timeout for snmp connect, default: 5s"
--help - show this help"

SNMP specific"
-H|--hostname - hostname or IP"
-V - SNMP protocol version to use (1, 2c, 3); default: 2c"
-P|--port - SNMP port; default: 161"

SNMP Version 1|2c specific"
-C|--community - SNMP community name; default: public"

SNMP Version 3 specific"
-l|--level - security level (noAuthNoPriv|authNoPriv|authPriv)"
-u|--user - security name"
-a|--authprotocol - authentication protocol (MD5|SHA)"
-A|--authpassphrase - authentication protocol pass phrase"
-x|--privprotocol - privacy protocol (DES|AES)"
-X|--privpassphrase - privacy protocol pass phrase"

Parts are: status, sysinfo, systemuptime, temp, cpu, cputemp, usedram, iops, latency, powerstatus, fans, diskused, hdstatus, hdtemp, lunstatus (for iSCSI luns), volstatus (Raid Volume Status)"

volstatus & lunstatus checks all vols/luns and vols/lun space; powerstatus checks power supply"
is 1-8 for hd, 1-5 for vol"

Example for diskusage: ${0##*/} -H 127.0.0.1 -C public -p diskused -w 80 -c 95"

Example for volstatus: ${0##*/} -H 127.0.0.1 -C public -p volstatus -w 15 -c 10"
critical and warning value are related to free disk space"

Example for fans: ${0##*/} -H 127.0.0.1 -C public -p fans -w 2000 -c 1900"
critical and warning are minimum speed in rpm for fans"

this plugin requires the following programs to be installed:"
* bc"
* awk"
* snmpget"
* snmpwalk"
# Usage: Icinga2

Enable SNMP on QNAP NAS appliance and use this script with Icinga2.

Copy the command_qnap_health.conf into the configuration path of Icinga2.

# Usage: Nagios

Enable SNMP on QNAP NAS appliance, community name "public".

Add this at the end of your "/usr/local/nagios/etc/objects/commands.cfg":

```
##########
## QNAP ##
##########
define command{
command_name qnap_health
command_line $USER1$/qnap_health -H $HOSTADDRESS$ -C public -p $ARG1$ -w $ARG2$ -c $ARG3$
}
```

# Contributing

Please feel free to fork and collaborate on this little but useful project.

# Parts of script to improve

- Power unit check - (let me know if on your device work)
- Rewrite some code for better readability

# Test

This script was tested with:
- QNAP model TS-853U-RP (with 4 disk)
- QNAP model TS-859U+ (by Omar S. Ramirez thanks for your help)
- QNAP model TS-212 and TS-231P (by github user mir07 Michael Rasmussen)
- QNAP Model TS-EC1280U, Firmware 4.2.2 (Thanks to AndresCidoncha)
- QNAP Model TS-459 Pro+, Firmware 4.2.6, Max HD number 4, No. Volume 1
- QNAP Model TS-1263U-RP, Firmware 4.3.3, Max HD number 12, No. Volume 1
- QNAP Model TS-EC1680U, Firmware 4.3.6, Max HD number 16
- QNAP Model TS-EC2480U, Firmware 4.3.6, Max HD number 24
- QNAP Model TS-431P2, Firmware 4.4.1