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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 14 additions & 1 deletion fortigate/check_fortigate.pl
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ sub get_vpn_state {
if ($vpnmode ne "ssl") {
# N/A as of 2015
# # Get just the top level tunnel data
my %tunnels = %{get_snmp_table($session, $oid_ipsectuntableroot . $oidf_tunndx)};
my %tunnels = %{get_snmp_table_nodie($session, $oid_ipsectuntableroot . $oidf_tunndx)};

while (($oid, $value) = each (%tunnels)) {
#Bump the total tunnel count
Expand Down Expand Up @@ -694,6 +694,19 @@ sub get_snmp_table{
return $sess_get_table;
} # end get snmp table

sub get_snmp_table_nodie{
my $session = $_[0];
my $oid = $_[1];

my $sess_get_table = $session->get_table(
-baseoid =>$oid
);

if ( ! defined($sess_get_table) ) {
return {};
}
return $sess_get_table;
} # end get snmp table

sub parse_args {
my $ip = ""; # snmp host
Expand Down