Dirk Alders 4 months ago
parent
commit
c4513855ff
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      check_reversetunnel

+ 7
- 7
check_reversetunnel View File

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

Loading…
Cancel
Save