check_tunneldigger 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. PLUGINDIR=$(dirname $0)
  3. . $PLUGINDIR/utils.sh
  4. if [ -e /lib/systemd/system/tunneldigger@.service ] ; then
  5. domains=$(/bin/ls /etc/systemd/system/multi-user.target.wants/tunneldigger@* | grep -oE "[0-9]+")
  6. fi
  7. if [ -e /lib/systemd/system/tunneldigger.service ] ; then
  8. systemctl --quiet is-active tunneldigger.service
  9. if [ $? -ne 0 ]; then
  10. echo "ERROR: service tunneldigger is not running"
  11. exit $STATE_CRITICAL
  12. else
  13. echo "OK: service tunneldigger is running"
  14. exit $STATE_OK
  15. fi
  16. fi
  17. ERROR_IN_DOM=''
  18. if [ -e /lib/systemd/system/tunneldigger@.service ] ; then
  19. for domain in $domains ; do
  20. systemctl --quiet is-active tunneldigger@${domain}.service
  21. if [ $? -ne 0 ] ; then
  22. ERROR_IN_DOM="$ERROR_IN_DOM $domain"
  23. fi
  24. done
  25. if [[ $ERROR_IN_DOM == '' ]] ; then
  26. echo "OK: service tunneldigger is running"
  27. exit $STATE_OK
  28. else
  29. echo "ERROR: service tunneldigger is not running in Dom: $ERROR_IN_DOM"
  30. exit $STATE_CRITICAL
  31. fi
  32. fi