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.

57 lines
1.2 KiB

  1. #!/bin/sh
  2. #
  3. # (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
  4. # (C) 2009 Tom Eastep <teastep@shorewall.net>
  5. #
  6. # License: GPLv2
  7. #
  8. DATE=$(/bin/date)
  9. STATE=${1}
  10. NAME=${2}
  11. CHECKIP=${3}
  12. DEVICE=${4}
  13. WARN_EMAIL=${5}
  14. REPLIED=${6}
  15. WAITING=${7}
  16. TIMEOUT=${8}
  17. REPLY_LATE=${9}
  18. CONS_RCVD=${10}
  19. CONS_WAIT=${11}
  20. CONS_MISS=${12}
  21. AVG_RTT=${13}
  22. cat <<EOM | msmtp ${WARN_EMAIL}
  23. Subject: "LSM: ${NAME} ${STATE}, DEV ${DEVICE}"
  24. Hi,
  25. Your connection ${NAME} has changed it's state to ${STATE} at ${DATE}.
  26. Following parameters were passed:
  27. newstate = ${STATE}
  28. name = ${NAME}
  29. checkip = ${CHECKIP}
  30. device = ${DEVICE}
  31. warn_email = ${WARN_EMAIL}
  32. Packet counters:
  33. replied = ${REPLIED} packets replied
  34. waiting = ${WAITING} packets waiting for reply
  35. timeout = ${TIMEOUT} packets that have timed out (= packet loss)
  36. reply_late = ${REPLY_LATE} packets that received a reply after timeout
  37. cons_rcvd = ${CONS_RCVD} consecutively received replies in sequence
  38. cons_wait = ${CONS_WAIT} consecutive packets waiting for reply
  39. cons_miss = ${CONS_MISS} consecutive packets that have timed out
  40. avg_rtt = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
  41. Your LSM Daemon
  42. EOM
  43. exit 0
  44. #EOF