Same Problem
My Solution:
Old: “service_description”: “VPN IPSec Tunnel”,
New: “service_description”: “VPN IPSec Tunnel %s”,
(And change from python2 to python3)
#!/usr/bin/env python3
def inventory_tunnel(info):
inventory = []
for name, state in info:
if state == "2":
inventory.append( (name, state) )
return inventory
def check_tunnel(item, params, info):
for name, state in info:
if name == item:
if state == "2":
return (0, "OK - Tunnel is up")
else:
return (2, "CRITICAL - link is down")
return (3, "UNKNOWN - Tunnel not found")
check_info["fortigate_tunnel"] = {
"inventory_function": inventory_tunnel,
"check_function": check_tunnel,
"service_description": "VPN IPSec Tunnel %s",
"snmp_scan_function": lambda oid: ".1.3.6.1.4.1.12356.101.1" in oid(".1.3.6.1.2.1.1.2.0"),
"snmp_info": (
".1.3.6.1.4.1.12356.101.12.2.2.1",
[
3, # fgVpnTunEntPhase2Name
20, # fgVpnTunEntStatus
]),
"has_perfdata": False,
}