Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made SNMP privacy protocol selectable #41

Merged
merged 5 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ check_synology --help

```shell
check_synology
usage: check_synology [-h] [-w W] [-c C] [-t T] [-r R] [-p PORT] hostname username authkey privkey {load,memory,disk,storage,update,status}

usage: check_synology [-h] [-w W] [-c C] [-t T] [-r R] [-p PORT] [-e PROTOCOL] hostname username authkey privkey {load,memory,disk,storage,update,status}
```

A custom port can be specified by using `-p`. The default value is `161`.
A custom privacy protocol can be specified by using `-e`. The default value is `AES128`.
Custom timeouts (`-t`) and retries (`-r`) can be specified by using `-t` and `-r` respectively. The default values are `-t 10` and `-r 3`.

### Available modes
Expand Down
4 changes: 3 additions & 1 deletion check_synology.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
parser.add_argument("-w", help="warning value for selected mode", type=int)
parser.add_argument("-c", help="critical value for selected mode", type=int)
parser.add_argument("-p", help="the snmp port", type=int, dest="port", default=161)
parser.add_argument("-e", help="SNMP privacy protocol encryption", type=str, default="AES128", choices=["AES128", "DES"])
parser.add_argument("-t", help="timeout for snmp connection", type=int, default=10)
parser.add_argument("-r", help="retries for snmp connection if timeout occurs", type=int, default=3)
args = parser.parse_args()
Expand All @@ -31,6 +32,7 @@
mode = args.mode
warning = args.w
critical = args.c
priv_protocol = args.e
snmp_timeout = args.t
snmp_retries = args.r

Expand All @@ -57,7 +59,7 @@ def croak(message=None):
auth_password=auth_key,
auth_protocol="MD5",
privacy_password=priv_key,
privacy_protocol="AES128")
privacy_protocol=priv_protocol)

except Exception as e:
croak(e)
Expand Down