snejpro / check_synology Goto Github PK
View Code? Open in Web Editor NEWIcinga2 script for Synology Diskstation
Icinga2 script for Synology Diskstation
Hi,
I can't get this plugin to work on Debian 11 with python 3,9, no matter what parameters are given. Example:
root@geotek-icinga:~# /usr/lib/nagios/plugins/check_synology.py -v 2c -H 192.168.146.35 -C xxxxx
Traceback (most recent call last):
File "/usr/lib/nagios/plugins/check_synology.py", line 467, in <module>
res = snmpget(queue)
File "/usr/lib/nagios/plugins/check_synology.py", line 219, in snmpget
snmpres = proc_snmpget(oids)
File "/usr/lib/nagios/plugins/check_synology.py", line 137, in proc_snmpget
return proc(command, oids)
File "/usr/lib/nagios/plugins/check_synology.py", line 122, in proc
key=re.findall("(iso(\.[0-9]+)+) ", l)[0][0]
IndexError: list index out of range
Tested with different Synology Models. Other Synology plugins return valid results. Any idea what is causing this?
Hello!
Great plugin.
But the "storage" is not ok.
./check_synology.py -H 10.31.24.52 -u x -a x -p x -m storage
Traceback (most recent call last):
File "./check_synology.py", line 508, in
render_storage(queue)
File "./check_synology.py", line 404, in render_storage
size_bytes = int(r['1.3.6.1.2.1.25.2.3.1.4.'+id]['value'])*int(r['1.3.6.1.2.1.25.2.3.1.5.'+id]['value'])
KeyError: '1.3.6.1.2.1.25.2.3.1.4.56'
snmapwalk:
.1.3.6.1.2.1.25.2.3.1.4.1 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.3 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.6 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.7 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.8 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.10 = INTEGER: 1024
.1.3.6.1.2.1.25.2.3.1.4.31 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.4.36 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.4.38 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.4.39 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.4.49 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.4.55 = INTEGER: 8192
.1.3.6.1.2.1.25.2.3.1.4.56 = INTEGER: 4096
.1.3.6.1.2.1.25.2.3.1.5.1 = INTEGER: 2034260
.1.3.6.1.2.1.25.2.3.1.5.3 = INTEGER: 5351936
.1.3.6.1.2.1.25.2.3.1.5.6 = INTEGER: 2034260
.1.3.6.1.2.1.25.2.3.1.5.7 = INTEGER: 1325860
.1.3.6.1.2.1.25.2.3.1.5.8 = INTEGER: 71004
.1.3.6.1.2.1.25.2.3.1.5.10 = INTEGER: 3317676
.1.3.6.1.2.1.25.2.3.1.5.31 = INTEGER: 596382
.1.3.6.1.2.1.25.2.3.1.5.36 = INTEGER: 254282
.1.3.6.1.2.1.25.2.3.1.5.38 = INTEGER: 254282
.1.3.6.1.2.1.25.2.3.1.5.39 = INTEGER: 254282
.1.3.6.1.2.1.25.2.3.1.5.49 = INTEGER: 254282
.1.3.6.1.2.1.25.2.3.1.5.55 = INTEGER: 1404790756
.1.3.6.1.2.1.25.2.3.1.5.56 = INTEGER: 3897958
It's a RS815+ NAS with DSM 7.1-42661 Update 1
load,memory, disk, raid, status, update is ok, thx.
Hey SnejPro,
just started testing your check-script ("freakin big thank you" for that director bucket!) and got an issue maybe you can help to get it running?
'/usr/lib/nagios/plugins/check_synology.py' '--storage_used_warn' '80' '-v' '2c' '-m' 'all' '-H' 'MY-NAS-IP' '-C' 'public' '--ups_load_warn' '80' '--ups_load_crit' '90' '--ups_level_warn' '25' '--ups_level_crit' '50' '--temp_warn' '70' '--temp_crit' '80' '--storage_used_crit' '90' '--port' '161' '--net_warn' '90' '--net_crit' '95' '--memory_warn' '80' '--memory_crit' '90' '--disk_temp_warn' '60' '--disk_temp_crit' '70'
Traceback (most recent call last):
File "/usr/lib/nagios/plugins/check_synology.py", line 467, in <module>
res = snmpget(queue)
File "/usr/lib/nagios/plugins/check_synology.py", line 219, in snmpget
snmpres = proc_snmpget(oids)
File "/usr/lib/nagios/plugins/check_synology.py", line 137, in proc_snmpget
return proc(command, oids)
File "/usr/lib/nagios/plugins/check_synology.py", line 117, in proc
result=subprocess.run(command, capture_output=True).stdout.decode('UTF-8')
File "/usr/lib/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
Greetings
Chriss
Hi,
I found a little issue that the disk check can't detect "hot spare drives" . They had status "Initialized" and this triggers a warning.
Script Output:
NAS-Status: WARNING
Disks:
Disk 0 - Name: Disk 1
Disk 0 - Status: Normal - OK
Disk 0 - Model: ST3000VN007-2E4166
Disk 0 - Temperature: 31.0 C - OK
Disk 1 - Name: Disk 2
Disk 1 - Status: Normal - OK
Disk 1 - Model: ST3000VN007-2E4166
Disk 1 - Temperature: 32.0 C - OK
Disk 2 - Name: Disk 3
Disk 2 - Status: Initialized - WARNING
Disk 2 - Model: ST3000VN007-2E4166
Disk 2 - Temperature: 31.0 C - OK
And here a screenshot from the storage manager. screen is in german but i think the important stuff is still identifiable.
Greetings
When a host device does not respond or is unreachable, the check command returns status=1 which is interpreted as "Warning" by icinga. This also happens if the check is crashing due to an internal error.
This is bad because it causes Icinga to show this device being "reachable", which is not true. When there is no responsse or if an internal crash occurs the plugin should exit with return code=3 which means "Unknown" according to Nagios Guidelines.
The script works fine except for the modes "memory" and "storage"...
Both give me a ValueError
Memory:
ValueError: invalid literal for int() with base 10: '1871636 kB'
Storage:
ValueError: invalid literal for int() with base 10: '8192 Bytes'
I had a small feature request
I miss some cpu load warn and crit thresholds, so for my synology nas i used now https://github.com/lausser/check_nwc_health "cpu-load" for the "load" check.
Also i miss to set a longer timeout. I see it's hardcoded to 5 secs, but if a synology nas is on heavy load, ex as a backup server during night, sometimes it needs more than 5 secs to answer. (I edited it by hand now)
Downloaded v1 and deployed it to my Icinga2 server (Ubuntu 18.04).
When I attempt to execute the script from the command line, I get the following:
Traceback (most recent call last):
File "./check_synology.py", line 53, in <module>
last_check_file = "/tmp/check_synology_"+args.hostname+"_"+re.sub('\W', '', args.mode)+".json"
TypeError: must be str, not NoneType
I'm not a python guy, so what's the easy fix here?
edit - just to confirm, is this compatible with DSM 7?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.