riskersen / Monitoring

Monitoring plugins wich are Nagios/icinga compatible
65 stars 113 forks source link

check_fortigate.pl: Return OK in case of no configured VPN tunnels #28

Open bonki opened 7 years ago

bonki commented 7 years ago

In case of zero configured tunnels $oid_ipsectuntableroot does not exist which resulted in the script exiting with

UNKNOWN: session get table failed for .1.3.6.1.4.1.12356.101.12.2.2.1.1

Expected:

OK: foo (Master: bar): Active SSL-VPN Connections/Tunnels: 0/0: IPSEC Tunnels: Configured/Active: 0/0 |'ActiveSSL-VPN'=0 'ActiveIPSEC'=0
bonki commented 7 years ago

You probably don't want to merge this as it is as there's probably a canonical way of checking for SNMP::NoSuchInstance errors, this is merely meant for testing purposes.

riskersen commented 7 years ago

Hey, thanks for your contribution.

Hm, hard to decide, in most cases empty oids aren't okay, except this one. So i would propose to name the function somehow like

get_snmp_table_accept_empty_oid

What do you think?

bonki commented 7 years ago

The problem is that get_table could also fail in case of real session errors (and in this case _accept_empty_oid is misleading) even if the OID exists in which case this will silently drop any errors and might wrongfully report zero tunnels which is what makes this more of a hack. In my book that's not very pretty error handling but if we can live with that (for the time being, anyway), go for it :)

bonki commented 7 years ago

What do I have to do to get this merged (in which case I'll have to update #36 which is based on latest master)? :)

riskersen commented 3 years ago

I have no idea, how this went through, but are you willing to rebase your pull request...?

sgruber94 commented 2 years ago

I can create a PR to implement that one. (if @bonki agrees)