From 6ab5d46bc500e5fd3ce06c7dcd43dd5726d6fe07 Mon Sep 17 00:00:00 2001 From: Koos85 Date: Tue, 26 Sep 2023 15:11:02 +0200 Subject: [PATCH 1/2] exceptions --- lib/utils.py | 8 +------- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/utils.py b/lib/utils.py index 84e6967..9d7c7b7 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -1,7 +1,5 @@ -from asyncsnmplib.exceptions import SnmpNoConnection, SnmpNoAuthParams -from asyncsnmplib.utils import InvalidConfigException, snmp_queries +from asyncsnmplib.utils import snmp_queries from libprobe.asset import Asset -from libprobe.exceptions import CheckException, IgnoreResultException async def get_data( @@ -14,10 +12,6 @@ async def get_data( address = asset.name try: state = await snmp_queries(address, asset_config, queries) - except SnmpNoConnection: - raise CheckException('unable to connect') - except (InvalidConfigException, SnmpNoAuthParams): - raise IgnoreResultException except Exception: raise else: diff --git a/requirements.txt b/requirements.txt index 043abe5..9a45cef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -asyncsnmplib==0.1.10 -libprobe==0.2.29 +asyncsnmplib==0.1.11 +libprobe==0.2.34 From 5a5e8871d6c6540998a8f200f20a3e6bc40ab537 Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Wed, 27 Sep 2023 12:04:35 +0200 Subject: [PATCH 2/2] Upd req and simplify --- lib/utils.py | 9 +++------ requirements.txt | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/utils.py b/lib/utils.py index 9d7c7b7..d223015 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -10,9 +10,6 @@ async def get_data( address = check_config.get('address') if address is None: address = asset.name - try: - state = await snmp_queries(address, asset_config, queries) - except Exception: - raise - else: - return state + + state = await snmp_queries(address, asset_config, queries) + return state diff --git a/requirements.txt b/requirements.txt index 9a45cef..6869f6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ asyncsnmplib==0.1.11 -libprobe==0.2.34 +libprobe==0.2.35