diff options
author | louwrentius <[email protected]> | 2014-08-30 00:14:20 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-09-02 14:18:54 -0700 |
commit | bcd9624d0f941bebf732f61bcb7bdbd223b0d396 (patch) | |
tree | cf923e2311cb20dffc62399365c866d430b6c9e5 /cmd/zed | |
parent | 76c3a616420c2b16c117adf8c845cc1e0d262301 (diff) |
Change delimiter for ZED email scripts
When the ZED_EMAIL_INTERVAL_SECS="3600" option is set in zed.rc
configuration file then notification emails should be rate limited.
Rate limiting is accomplished by maintaining a colon delimited state
file which includes the device name. Unfortunately there are valid
device names which include a colon and therefore prevent the rate
limiting for working properly. For this reason the delimiter has
been changed to a semi-colon.
Signed-off-by: louwrentius <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chris Dunlap <[email protected]>
Closes #2645
Diffstat (limited to 'cmd/zed')
-rwxr-xr-x | cmd/zed/zed.d/data-email.sh | 8 | ||||
-rwxr-xr-x | cmd/zed/zed.d/io-email.sh | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/cmd/zed/zed.d/data-email.sh b/cmd/zed/zed.d/data-email.sh index 9f8316149..f056ac803 100755 --- a/cmd/zed/zed.d/data-email.sh +++ b/cmd/zed/zed.d/data-email.sh @@ -12,7 +12,7 @@ # 4: unsupported event class # 5: internal error # State File Format: -# POOL:TIME_OF_LAST_EMAIL +# POOL;TIME_OF_LAST_EMAIL # test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc" @@ -47,7 +47,7 @@ flock -x 8 # Query state for last time email was sent for this pool. TIME_NOW=`date +%s` -TIME_LAST=`egrep "^${ZEVENT_POOL}:" "${STATEFILE}" 2>/dev/null | cut -d: -f2` +TIME_LAST=`egrep "^${ZEVENT_POOL};" "${STATEFILE}" 2>/dev/null | cut -d ";" -f2` if test -n "${TIME_LAST}"; then TIME_DELTA=`expr "${TIME_NOW}" - "${TIME_LAST}"` if test "${TIME_DELTA}" -lt "${ZED_EMAIL_INTERVAL_SECS:=3600}"; then @@ -67,8 +67,8 @@ EOF MAIL_STATUS=$? # Update state. -egrep -v "^${ZEVENT_POOL}:" "${STATEFILE}" 2>/dev/null > "${STATEFILE}.$$" -echo "${ZEVENT_POOL}:${TIME_NOW}" >> "${STATEFILE}.$$" +egrep -v "^${ZEVENT_POOL};" "${STATEFILE}" 2>/dev/null > "${STATEFILE}.$$" +echo "${ZEVENT_POOL};${TIME_NOW}" >> "${STATEFILE}.$$" mv -f "${STATEFILE}.$$" "${STATEFILE}" if test "${MAIL_STATUS}" -ne 0; then diff --git a/cmd/zed/zed.d/io-email.sh b/cmd/zed/zed.d/io-email.sh index 6cfe3c7f7..f97591175 100755 --- a/cmd/zed/zed.d/io-email.sh +++ b/cmd/zed/zed.d/io-email.sh @@ -12,7 +12,7 @@ # 4: unsupported event class # 5: internal error # State File Format: -# POOL:VDEV_PATH:TIME_OF_LAST_EMAIL +# POOL;VDEV_PATH;TIME_OF_LAST_EMAIL # test -f "${ZED_SCRIPT_DIR}/zed.rc" && . "${ZED_SCRIPT_DIR}/zed.rc" @@ -49,8 +49,8 @@ flock -x 8 # Query state for last time email was sent for this pool/vdev. TIME_NOW=`date +%s` -TIME_LAST=`egrep "^${ZEVENT_POOL}:${ZEVENT_VDEV_PATH}:" "${STATEFILE}" \ - 2>/dev/null | cut -d: -f3` +TIME_LAST=`egrep "^${ZEVENT_POOL};${ZEVENT_VDEV_PATH};" "${STATEFILE}" \ + 2>/dev/null | cut -d ";" -f3` if test -n "${TIME_LAST}"; then TIME_DELTA=`expr "${TIME_NOW}" - "${TIME_LAST}"` if test "${TIME_DELTA}" -lt "${ZED_EMAIL_INTERVAL_SECS:=3600}"; then @@ -71,9 +71,9 @@ EOF MAIL_STATUS=$? # Update state. -egrep -v "^${ZEVENT_POOL}:${ZEVENT_VDEV_PATH}:" "${STATEFILE}" \ +egrep -v "^${ZEVENT_POOL};${ZEVENT_VDEV_PATH};" "${STATEFILE}" \ 2>/dev/null > "${STATEFILE}.$$" -echo "${ZEVENT_POOL}:${ZEVENT_VDEV_PATH}:${TIME_NOW}" >> "${STATEFILE}.$$" +echo "${ZEVENT_POOL};${ZEVENT_VDEV_PATH};${TIME_NOW}" >> "${STATEFILE}.$$" mv -f "${STATEFILE}.$$" "${STATEFILE}" if test "${MAIL_STATUS}" -ne 0; then |