Nagios Plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

check_reversetunnel 657B

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