]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - cmd/zed/zed.d/zed-functions.sh
New upstream version 0.7.9
[mirror_zfs-debian.git] / cmd / zed / zed.d / zed-functions.sh
index ed6a95914ee6232b0f02901d7f7b736396022185..fb16e9d36f3217be167dc7d1c6e71f49912b71b0 100644 (file)
@@ -438,3 +438,23 @@ zed_guid_to_pool()
                $ZPOOL get -H -ovalue,name guid | awk '$1=='"$guid"' {print $2}'
        fi
 }
+
+# zed_exit_if_ignoring_this_event
+#
+# Exit the script if we should ignore this event, as determined by
+# $ZED_SYSLOG_SUBCLASS_INCLUDE and $ZED_SYSLOG_SUBCLASS_EXCLUDE in zed.rc.
+# This function assumes you've imported the normal zed variables.
+zed_exit_if_ignoring_this_event()
+{
+       if [ -n "${ZED_SYSLOG_SUBCLASS_INCLUDE}" ]; then
+           eval "case ${ZEVENT_SUBCLASS} in
+           ${ZED_SYSLOG_SUBCLASS_INCLUDE});;
+           *) exit 0;;
+           esac"
+       elif [ -n "${ZED_SYSLOG_SUBCLASS_EXCLUDE}" ]; then
+           eval "case ${ZEVENT_SUBCLASS} in
+           ${ZED_SYSLOG_SUBCLASS_EXCLUDE}) exit 0;;
+           *);;
+           esac"
+       fi
+}