2024-07-20 18:27:52 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2024-07-20 19:02:08 +02:00
|
|
|
NAGIOS_OK=0
|
|
|
|
NAGIOS_ERROR=2
|
2024-07-20 18:30:58 +02:00
|
|
|
#
|
2024-07-20 19:02:08 +02:00
|
|
|
MULTIMEDIA_TUNNEL_REGEX="\-R 10022:localhost:22.*mount-mockery.de$"
|
2024-07-20 18:30:58 +02:00
|
|
|
#
|
2024-07-20 18:27:52 +02:00
|
|
|
AUTOSSH_PIDs=$(pidof autossh)
|
|
|
|
if [ -z $AUTOSSH_PIDs ]; then
|
|
|
|
# no autossh process running
|
2024-07-20 19:02:08 +02:00
|
|
|
echo "ERROR - No autossh process is running!"
|
2024-07-20 18:30:58 +02:00
|
|
|
exit $NAGIOS_ERROR
|
2024-07-20 18:27:52 +02:00
|
|
|
else
|
|
|
|
# there is an autossh process
|
2024-07-20 19:07:03 +02:00
|
|
|
ps x -q $AUTOSSH_PIDs | grep "$MULTIMEDIA_TUNNEL_REGEX" 2>&1 > /dev/null
|
2024-07-20 18:27:52 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
2024-07-20 19:02:08 +02:00
|
|
|
echo "OK - The required autossh process is running"
|
2024-07-20 18:30:58 +02:00
|
|
|
exit $NAGIOS_OK
|
2024-07-20 18:27:52 +02:00
|
|
|
else
|
2024-07-20 19:02:08 +02:00
|
|
|
echo "ERROR - There are autossh processes, but none of them fit to the required connection details"
|
2024-07-20 18:30:58 +02:00
|
|
|
exit $NAGIOS_ERROR
|
2024-07-20 18:27:52 +02:00
|
|
|
fi
|
|
|
|
fi
|