wernerfred / check_synology

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

FIX: support for private key protocol #9

Open dommi22m opened 3 years ago

dommi22m commented 3 years ago

For now there is no support to choose the protocol for private key. (3DES/AES) Neither for the auth key (MD5/SHA)

So you will get an TypeError if not AES is selected in Synology SNMP Setup :

float() argument must be a string or a number, not 'NoneType'

I made a little change to get the private key protocol as parameter. Not well programmed but yet an acceptable change.

wernerfred commented 3 years ago

Just tested your changes. With AES it's working. With 3DES not:

No SNMP response received before timeout
Traceback (most recent call last):
  File "check_synology.py", line 77, in <module>
    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'

But my Sonology lets me only configure AES or DES (missing 3). What model are you using?

wernerfred commented 3 years ago

I added DES support. Please @dommi22m provide information regarding 3DES and check again.

wernerfred commented 3 years ago

@dommi22m for backwards compatibility i changed the argument to be optional (provided via -k) and defaulted it to the current method AES. Authentication method could then be implemented accordingly via -a.

amotl commented 2 years ago

Hi there,

after the refactoring coming from #19, the feature to select a different SNMP privacy protocol would have to be implemented slightly different. Please let us know if you still have demand for this, @dommi22m.

With kind regards, Andreas.

amotl commented 2 years ago

Hi again,

check_synology moved on to use the Easy SNMP library under the hood. So, this patch would need to be adjusted appropriately. Maybe someone from the community can submit a corresponding update?

With kind regards, Andreas.

gkasKaR commented 2 years ago

Hey there,

i just used the newest version to perform a check.

The error code is now another one: UNKNOWN - Authentication failure (incorrect password, community or key)

With nwc_health, I use the authprotocol sha. So I think the issue occours because of the different protocol requirements.

Thank you for the explanaiton and investigation :)

Greetings

amotl commented 2 years ago

Hi @gkasKaR,

The error code is now another one: UNKNOWN - Authentication failure (incorrect password, community or key)

Thanks a stack for checking. This is a sweet error response.

So I think the issue occours because of the different protocol requirements.

Great that we have been able to find the reason for #16. So, @dommi22m's patch is needed for your situation as well. May I ask which Synology DiskStation model you are using?

With nwc_health, I use the authprotocol "SHA".

All right. Now, someone would need to adjust this patch to the new SNMP library to improve the situation here.

With kind regards, Andreas.