nagios-nrpe: add some information in check_connections_state.sh check

dev
Jérémy Dubois 3 months ago
parent 3878e1bddc
commit 28b946bd47
  1. 1
      CHANGELOG
  2. 8
      roles/nagios-nrpe/files/plugins_bsd/check_connections_state.sh

@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- base: use a variable to define ntpd server
- base: add entry in doas.conf for sd0 in case we have a hard raid
- base: add munin files in newsyslog.conf by default
- nagios-nrpe: add some information in check_connections_state.sh check
### Changed

@ -5,8 +5,8 @@ MAIN_CONNECTION_PINGABLE_IP="31.170.8.95"
MAIN_CONNECTION_GATEWAY="IP"
MAIN_CONNECTION_IP="IP"
SECOND_CONNECTION_PINGABLE_IP="31.170.8.243"
INFO_MAIN_CONNECTION="IP - Description"
INFO_SECOND_CONNECTION="IP - Description"
INFO_MAIN_CONNECTION="IP - Description - interface"
INFO_SECOND_CONNECTION="IP - Description - interface"
CURRENT_GATEWAY=$(/usr/bin/netstat -nr | /usr/bin/grep "default" | /usr/bin/awk '{print $2}')
IS_GATEWAY_IN_FILE=1 # Check whether /etc/mygate has the IP of main connection
@ -28,7 +28,7 @@ fi
# If main connection is DOWN (used or not) => warning and exit
if /sbin/ping -c1 -w1 ${MAIN_CONNECTION_PINGABLE_IP} >/dev/null 2>&1; then
if [ "${CURRENT_GATEWAY}" != "${MAIN_CONNECTION_GATEWAY}" ]; then
echo "Main connection is UP but not used as gateway !"
echo "Main connection is UP (${INFO_MAIN_CONNECTION}) but not used as gateway !"
STATE=2
fi
else
@ -76,7 +76,7 @@ if [ "${IS_MISCELLANEOUS}" = 1 ]; then
fi
if [ "${STATE}" = 0 ]; then
echo "OK - Main connection is UP and used, second connection is UP"
echo "OK - Main connection is UP and used (${INFO_MAIN_CONNECTION}), second connection is UP (${INFO_SECOND_CONNECTION})"
fi
exit ${STATE}

Loading…
Cancel
Save