1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-21 18:03:45 +01:00

patch 1.2.1a

This commit is contained in:
monitoreoDotOsiAtUchileDotCl 2020-10-22 10:27:34 -03:00
parent 6c12036e30
commit f22a7d8fb8

25
check_snmp/check_snmp_cpfw.pl Normal file → Executable file
View File

@ -5,6 +5,9 @@
# Author : Patrick Proy (patrick at proy.org) # Author : Patrick Proy (patrick at proy.org)
# Help : http://nagios.manubulon.com # Help : http://nagios.manubulon.com
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt # Licence : GPL - http://www.fsf.org/licenses/gpl.txt
# Patch 1.2.1a
# Author : monitoreo.osi@uchile.cl
# Desc: add to things at fw checks, connectionrate & connection peak
# TODO : # TODO :
# - check sync method # - check sync method
################################################################# #################################################################
@ -18,7 +21,8 @@ use Getopt::Long;
# Nagios specific # Nagios specific
use lib "/usr/local/nagios/libexec"; #use lib "/usr/local/nagios/libexec";
use lib "/usr/lib/nagios/plugins";
use utils qw(%ERRORS $TIMEOUT); use utils qw(%ERRORS $TIMEOUT);
#my $TIMEOUT = 15; #my $TIMEOUT = 15;
#my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); #my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
@ -26,11 +30,12 @@ use utils qw(%ERRORS $TIMEOUT);
########### SNMP Datas ########### ########### SNMP Datas ###########
###### FW data ###### FW data
my $policy_state = "1.3.6.1.4.1.2620.1.1.1.0"; # "Installed" my $policy_state = "1.3.6.1.4.1.2620.1.1.1.0"; # "Installed"
my $policy_name = "1.3.6.1.4.1.2620.1.1.2.0"; # Installed policy name my $policy_name = "1.3.6.1.4.1.2620.1.1.2.0"; # Installed policy name
my $connections = "1.3.6.1.4.1.2620.1.1.25.3.0"; # number of connections my $connections = "1.3.6.1.4.1.2620.1.1.25.3.0"; # number of connections
#my $connections_peak = "1.3.6.1.4.1.2620.1.1.25.4.0"; # peak number of connections my $connectionsSR = "1.3.6.1.4.1.2620.1.1.26.11.6.0" ; # fwConnectionsStatConnectionRate aka connx/seg
my @fw_checks = ($policy_state,$policy_name,$connections); my $connectionsPeak = "1.3.6.1.4.1.2620.1.1.25.4.0"; # peak number of connections
my @fw_checks = ($policy_state,$policy_name,$connections,$connectionsSR,$connectionsPeak);
###### SVN data ###### SVN data
my $svn_status = "1.3.6.1.4.1.2620.1.6.102.0"; # "OK" svn status my $svn_status = "1.3.6.1.4.1.2620.1.6.102.0"; # "OK" svn status
@ -380,6 +385,8 @@ if (defined ($o_mgmt)) {
my $fw_state=0; my $fw_state=0;
my $fw_print=""; my $fw_print="";
my $perf_conn=undef; my $perf_conn=undef;
my $perf_connSR=undef;
my $perf_connPeak=undef;
if (defined ($o_fw)) { if (defined ($o_fw)) {
@ -392,6 +399,8 @@ if (defined ($o_fw)) {
verb("State : $$resultat{$policy_state}"); verb("State : $$resultat{$policy_state}");
verb("Name : $$resultat{$policy_name}"); verb("Name : $$resultat{$policy_name}");
verb("connections : $$resultat{$connections}"); verb("connections : $$resultat{$connections}");
verb("connectionsSR : $$resultat{$connectionsSR}");
verb("connectionsPeak : $$resultat{$connectionsPeak}");
if ($$resultat{$policy_state} ne "Installed") { if ($$resultat{$policy_state} ne "Installed") {
$fw_state=2; $fw_state=2;
@ -417,6 +426,8 @@ if (defined ($o_fw)) {
} }
} }
$perf_conn=$$resultat{$connections}; $perf_conn=$$resultat{$connections};
$perf_connSR=$$resultat{$connectionsSR};
$perf_connPeak=$$resultat{$connectionsPeak};
} }
} else { } else {
$fw_print .= "cannot find oids"; $fw_print .= "cannot find oids";
@ -548,6 +559,8 @@ if (($ha_state_n+$svn_state+$fw_state+$mgmt_state) == 0 ) {
if (defined($o_perf) && defined ($perf_conn)) { if (defined($o_perf) && defined ($perf_conn)) {
$f_print .= " | fw_connexions=" . $perf_conn; $f_print .= " | fw_connexions=" . $perf_conn;
$f_print .= " | fw_connexionsSR=" . $perf_connSR;
$f_print .= " | fw_connexionsPeak=" . $perf_connPeak;
} }
print "$f_print\n"; print "$f_print\n";