Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 0157b441 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 403af45f
No related branches found
No related tags found
No related merge requests found
......@@ -22,12 +22,14 @@ from cmk.base.plugins.agent_based.utils import uptime
def parse_snmp_uptime(string_table: StringTable) -> Optional[uptime.Section]:
"""
>>> parse_snmp_uptime([['2297331594', '']])
>>> parse_snmp_uptime([['2297331594', '', '']])
Section(uptime_sec=22973315, message=None)
>>> parse_snmp_uptime([['124:21:26:42.03', '124:21:29:01.14']])
>>> parse_snmp_uptime([['124:21:26:42.03', '124:21:29:01.14', '']])
Section(uptime_sec=10790941, message=None)
>>> None is parse_snmp_uptime([[u'', u'Fortigate 80C']]) # nonsense
>>> None is parse_snmp_uptime([[u'', u'Fortigate 80C', 'Whatever']]) # nonsense
True
>>> parse_snmp_uptime([['2297331594', '', '313671']])
Section(uptime_sec=313671, message=None)
"""
if not string_table:
......@@ -41,7 +43,9 @@ def parse_snmp_uptime(string_table: StringTable) -> Optional[uptime.Section]:
return None
try:
return uptime.Section(int(snmpEngineTime), None)
value = int(snmpEngineTime)
if value > 0:
return uptime.Section(int(snmpEngineTime), None)
except ValueError:
pass
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment