wernerfred / check_synology

This plugin will check a lot of different values on your Synology DiskStation.
MIT License
17 stars 25 forks source link

Handle pysnmp's `RequestTimedOut` exception more appropriately #17

Closed amotl closed 2 years ago

amotl commented 2 years ago

Dear Frederic,

thanks a stack for conceiving this fine program. We found that the code path when running into a No SNMP response received before timeout condition can be improved.

While we don't quite like how the patch is currently implemented, the code now handles this condition well. In this case, check_synology will respond with state "UNKNOWN".

With kind regards, Andreas.

P.S.: For your reference, I am sharing two of the tracebacks we received below.

Traceback (most recent call last):
  File "/opt/check_synology/check_synology.py", line 100, in if disk.startswith("No Such Instance"):
AttributeError: 'NoneType' object has no attribute 'startswith'
Traceback (most recent call last):
  File "/opt/check_synology/check_synology.py", line 67, in load1 = str(float(snmpget('1.3.6.1.4.1.2021.10.1.5.1'))/100)
TypeError: float() argument must be a string or a number, not 'NoneType'

/cc @tonkenfo

wernerfred commented 2 years ago

@all-contributors add @amotl for code

allcontributors[bot] commented 2 years ago

@wernerfred

I've put up a pull request to add @amotl! :tada: