Przeglądaj źródła

check_reversetunnel rework

master
Dirk Alders 5 miesięcy temu
rodzic
commit
0435acd697
1 zmienionych plików z 9 dodań i 4 usunięć
  1. 9
    4
      check_reversetunnel

+ 9
- 4
check_reversetunnel Wyświetl plik

@@ -1,18 +1,23 @@
1 1
 #!/bin/sh
2 2
 #
3
+NAGIOS_OK = 0
4
+NAGIOS_ERROR = 2
5
+#
6
+MULTIMEDIA_TUNNEL_REGEX = "\-R 10022:localhost:22.*mount-mockery.de$"
7
+#
3 8
 AUTOSSH_PIDs=$(pidof autossh)
4 9
 if [ -z $AUTOSSH_PIDs ]; then
5 10
     # no autossh process running
6 11
     echo "No autossh process is running!"
7
-    exit 2
12
+    exit $NAGIOS_ERROR
8 13
 else
9 14
     # there is an autossh process
10
-    ps x -q $AUTOSSH_PIDs | grep "\-R 10022:localhost:22.*mount-mockery.de$" 2>&1 > /dev/null
15
+    ps x -q $AUTOSSH_PIDs | grep $MULTIMEDIA_TUNNEL_REGEX 2>&1 > /dev/null
11 16
     if [ $? -eq 0 ]; then
12 17
         echo "The required autossh process is running"
13
-        exit 0
18
+        exit $NAGIOS_OK
14 19
     else
15 20
         echo "There are autossh processes, but none of them fit to the required connection details"
16
-        exit 2
21
+        exit $NAGIOS_ERROR
17 22
     fi
18 23
 fi

Ładowanie…
Anuluj
Zapisz