From 30c1b70e2bd3ad31e33d5d8e8e980f1f418a8f80 Mon Sep 17 00:00:00 2001 From: Jeremy Dubois Date: Wed, 8 Jul 2020 17:28:12 +0200 Subject: [PATCH] Modified openbgpd check to be in NRPE critical state when BGPD is not running --- .../files/plugins_bsd/check_openbgpd | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/roles/nagios-nrpe/files/plugins_bsd/check_openbgpd b/roles/nagios-nrpe/files/plugins_bsd/check_openbgpd index c62ec43..4e63480 100755 --- a/roles/nagios-nrpe/files/plugins_bsd/check_openbgpd +++ b/roles/nagios-nrpe/files/plugins_bsd/check_openbgpd @@ -5,6 +5,18 @@ # # 2009.11.12 #*#*# andrew fresh ######################################################################## +# +# MODIFIED VERSION FOR THE NEEDS OF EVOLIX +# By Jérémy Dubois +# +# Line 51 : +# added « open STDERR, '>&STDOUT'; » +# +# Lines 123 to 126 : +# added « or exit 2; » +# commented « or die $! » and the 2 lines below +# +######################################################################## use strict; use warnings; @@ -36,6 +48,7 @@ my $BGPCTL = '/usr/sbin/bgpctl'; use POSIX; use Config; my $PREFIX; +open STDERR, '>&STDOUT'; BEGIN { ## no critic 'warnings' @@ -107,9 +120,10 @@ sub read_status { } ## no critic 'die' close $fh - or die $! - ? "Error closing sysctl pipe: $!\n" - : "Exit status $? from sysctl\n"; + or exit 2; +# or die $! +# ? "Error closing sysctl pipe: $!\n" +# : "Exit status $? from sysctl\n"; return grep { exists $_->{neighbor} && $_->{as} ne 'AS' } @S; }