check_ipsec: Remove from package

This commit is contained in:
Jan Wagner 2022-02-19 18:37:24 +01:00
parent 092c3a5435
commit c874d999e0
9 changed files with 0 additions and 341 deletions

View file

@ -1,3 +0,0 @@
#/usr/bin/make -f
include ../common.mk

View file

@ -1,194 +0,0 @@
#!/bin/bash
# Written By Nicole
# Any Comments or Questions please e-mail to ml@nicole-haehnel.de
#
# Plugin Name: check_ipsec
# Version: 2.0
# Date: 26/08/2008
#
# Usage: check_ipsec --tunnels <n>
#
# gateways.txt file must be located in same directory
# and has to look like:
# nameofconn1 192.168.0.1
# nameofconn2 192.168.1.1
#
# ------------Defining Variables------------
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 2.0 $' | sed -e 's/[^0-9.]//g'`
#STRONG=`$IPSECBIN --version |grep strongSwan | wc -l`
DOWN=""
# ---------- Change to your needs ----------
PLUGINPATH="/usr/lib64/nagios/plugins"
GATEWAYLIST="gateways.txt"
IPSECBIN="/usr/sbin/ipsec"
FPINGBIN="/usr/sbin/fping"
# ping server in network on the other side of the tunnel
PINGIP=1 # ping yes or no (1/0)
# ------------------------------------------
. $PROGPATH/utils.sh
# Testing availability of $IPSECBIN, $FPINGBIN and $GATEWAYLIST
if [ $# -eq 0 ];
then
echo UNKNOWN - missing Arguments. Run check_ipsec --help
exit $STATE_UNKNOWN
fi
test -e $IPSECBIN
if [ $? -ne 0 ];
then
echo CRITICAL - $IPSECBIN not exist
exit $STATE_CRITICAL
else
STRONG=`$IPSECBIN --version |grep strongSwan | wc -l`
fi
if [ $PINGIP -eq 1 ]
then
test -e $FPINGBIN
if [ $? -ne 0 ];
then
echo CRITICAL - $FPINGBIN not exist
exit $STATE_CRITICAL
fi
fi
test -e $PROGPATH/$GATEWAYLIST
if [ $? -ne 0 ];
then
echo CRITICAL - $GATEWAYLIST not exist
exit $STATE_CRITICAL
fi
print_usage() {
echo "Usage:"
echo " $PROGNAME --tunnels <number of configured tunnels>"
echo " $PROGNAME --help"
echo " $PROGNAME --version"
echo " Created by Nicole, questions or problems e-mail ml@nicole-haehnel.de"
echo ""
}
print_help() {
print_revision $PROGNAME $REVISION
echo ""
print_usage
echo " Checks vpn connection status of an openswan or strongswan installation."
echo ""
echo " --tunnels <number of configured tunnels>"
echo " -T <number of configured tunnels>"
echo " provides the tunnel status of the openswan or strongswan installation"
echo ""
echo " --help"
echo " -h"
echo " prints this help screen"
echo ""
echo " --version"
echo " -V"
echo " Print version and license information"
echo ""
}
check_tunnel() {
if [[ "$STRONG" -eq "1" ]]
then
eroutes=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" | wc -l`
else
eroutes=`$IPSECBIN whack --status | grep -e "IPsec SA established" | grep -e "newest IPSEC" | wc -l`
fi
if [[ "$eroutes" -eq "$2" ]]
then
echo "OK - All $2 tunnels are up an running"
exit $STATE_OK
elif [[ "$eroutes" -gt "$2" ]]
then
echo "WARNING - More than $2 ($eroutes) tunnels are up an running"
exit $STATE_WARNING
else
echo "CRITICAL - Only $eroutes tunnels from $2 are up an running - $(location)"
exit $STATE_CRITICAL
fi
}
location() {
count=0
i=1
while read line; do
CONN=`echo $line| awk '{print $1}'`
IP=`echo $line| awk '{print $2}'`
if [[ "$STRONG" -eq "1" ]]
then
tunneltest=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e $CONN | wc -l`
else
tunneltest=`$IPSECBIN whack --status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e "$CONN" | wc -l`
fi
if [[ "$tunneltest" -eq "0" ]]
then
count=$[$count+1]
DOWN="$DOWN $CONN"
fi
if [[ "$PINGIP" -eq "1" && "$tunneltest" -eq "1" ]]
then
alive=`$FPINGBIN $IP -r 1 | grep alive | wc -l`
if [[ "$alive" -eq "0" ]]
then
count=$[$count+1]
DOWN="$DOWN $CONN (no ping)"
fi
fi
i=$[$i+1]
done < $PLUGINPATH/$GATEWAYLIST
echo $DOWN
}
case "$1" in
--help)
print_help
exit $STATE_OK
;;
-h)
print_help
exit $STATE_OK
;;
--version)
print_revision $PLUGIN $REVISION
exit $STATE_OK
;;
-V)
print_revision $PLUGIN $REVISION
exit $STATE_OK
;;
--tunnels)
check_tunnel $1 $2
;;
-T)
check_tunnel $1 $2
;;
*)
print_help
exit $STATE_OK
esac

View file

@ -1,6 +0,0 @@
Homepage: https://raw.githubusercontent.com/Inuits/monitoring-plugins/master/check_ipsec
Watch: https://raw.githubusercontent.com/Inuits/monitoring-plugins/master/check_ipsec # Version: ([0-9.]+)
Recommends: monitoring-plugins-common | nagios-plugins-common, fping, strongswan-starter | openswan
Version: 2.0
Uploaders: Jan Wagner <waja@cyconet.org>
Description: plugin checking ipsec connections from open- or stongswan

View file

@ -1,7 +0,0 @@
Copyright (c) 2008 ml@nicole-haehnel.de
License: N/A
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

View file

@ -31,9 +31,6 @@ check_iostat:
check_iostats: check_iostats:
Required Packages: sysstat Required Packages: sysstat
check_ipsec:
Required Packages: monitoring-plugins-common | nagios-plugins-common, fping, strongswan-starter | openswan
check_mysql_slave: check_mysql_slave:
Required Packages: libdbd-mysql-perl Required Packages: libdbd-mysql-perl

View file

@ -1,27 +0,0 @@
Author: Jan Wagner <waja@cyconet.org>
Description:
Patches check_ipsec to use debian specific paths.
diff --git a/check_ipsec/check_ipsec b/check_ipsec/check_ipsec
index 29834df..084e6ee 100644
--- a/check_ipsec/check_ipsec
+++ b/check_ipsec/check_ipsec
@@ -20,15 +20,15 @@ REVISION=`echo '$Revision: 2.0 $' | sed -e 's/[^0-9.]//g'`
#STRONG=`$IPSECBIN --version |grep strongSwan | wc -l`
DOWN=""
# ---------- Change to your needs ----------
-PLUGINPATH="/usr/lib64/nagios/plugins"
+PLUGINPATH="/usr/lib/nagios/plugins"
GATEWAYLIST="gateways.txt"
IPSECBIN="/usr/sbin/ipsec"
-FPINGBIN="/usr/sbin/fping"
+FPINGBIN="/usr/bin/fping"
# ping server in network on the other side of the tunnel
PINGIP=1 # ping yes or no (1/0)
# ------------------------------------------
-. $PROGPATH/utils.sh
+. $PLUGINPATH/utils.sh
# Testing availability of $IPSECBIN, $FPINGBIN and $GATEWAYLIST

View file

@ -1,71 +0,0 @@
Author: Jan Wagner <waja@cyconet.org>
Description:
Patches check_ipsec to fix syntax issues
diff --git a/check_ipsec/check_ipsec b/check_ipsec/check_ipsec
index 29834df..084e6ee 100644
--- a/check_ipsec/check_ipsec
+++ b/check_ipsec/check_ipsec
@@ -96,7 +96,7 @@ print_help() {
check_tunnel() {
- if [[ "$STRONG" -eq "1" ]]
+ if [ "$STRONG" -eq "1" ]
then
eroutes=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" | wc -l`
else
@@ -104,21 +104,21 @@ check_tunnel() {
fi
- if [[ "$eroutes" -eq "$2" ]]
+ if [ "$eroutes" -eq "$2" ]
then
echo "OK - All $2 tunnels are up an running"
exit $STATE_OK
- elif [[ "$eroutes" -gt "$2" ]]
+ elif [ "$eroutes" -gt "$2" ]
then
echo "WARNING - More than $2 ($eroutes) tunnels are up an running"
exit $STATE_WARNING
else
echo "CRITICAL - Only $eroutes tunnels from $2 are up an running - $(location)"
+ location
exit $STATE_CRITICAL
fi
}
-
location() {
count=0
@@ -129,24 +129,24 @@ while read line; do
CONN=`echo $line| awk '{print $1}'`
IP=`echo $line| awk '{print $2}'`
- if [[ "$STRONG" -eq "1" ]]
+ if [ "$STRONG" -eq "1" ]
then
tunneltest=`$IPSECBIN status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e $CONN | wc -l`
else
tunneltest=`$IPSECBIN whack --status | grep -e "IPsec SA established" | grep -e "newest IPSEC" |grep -e "$CONN" | wc -l`
fi
- if [[ "$tunneltest" -eq "0" ]]
+ if [ "$tunneltest" -eq "0" ]
then
count=$[$count+1]
DOWN="$DOWN $CONN"
fi
- if [[ "$PINGIP" -eq "1" && "$tunneltest" -eq "1" ]]
+ if [ "$PINGIP" -eq "1" && "$tunneltest" -eq "1" ]
then
alive=`$FPINGBIN $IP -r 1 | grep alive | wc -l`
- if [[ "$alive" -eq "0" ]]
+ if [ "$alive" -eq "0" ]
then
count=$[$count+1]
DOWN="$DOWN $CONN (no ping)"

View file

@ -1,27 +0,0 @@
--- a/check_ipsec/check_ipsec
+++ b/check_ipsec/check_ipsec
@@ -61,8 +61,7 @@
test -e $PROGPATH/$GATEWAYLIST
if [ $? -ne 0 ];
then
- echo CRITICAL - $GATEWAYLIST not exist
- exit $STATE_CRITICAL
+ USEGATEWAYS="0"
fi
print_usage() {
@@ -113,8 +112,12 @@
echo "WARNING - More than $2 ($eroutes) tunnels are up an running"
exit $STATE_WARNING
else
- echo "CRITICAL - Only $eroutes tunnels from $2 are up an running - $(location)"
- location
+ if [ "$USEGATEWAYS" -eq "0" ]
+ then
+ echo "CRITICAL - Only $eroutes tunnels from $2 are up an running"
+ else
+ echo "CRITICAL - Only $eroutes tunnels from $2 are up an running - $(location)"
+ fi
exit $STATE_CRITICAL
fi
}

View file

@ -1,8 +1,5 @@
check_apache_balancer_members/NagiosPlugins check_apache_balancer_members/NagiosPlugins
check_apache_balancer_members/epn check_apache_balancer_members/epn
check_ipsec/10_pathes
check_ipsec/15_fix_syntax
check_ipsec/20_remove_gateway
check_mysql_slave//epn check_mysql_slave//epn
check_nextcloud/shebang check_nextcloud/shebang
check_sieve/epn check_sieve/epn