The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/cmd/zed/zed.d/data-notify.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 # shellcheck disable=SC2154
    3 #
    4 # Send notification in response to a DATA error.
    5 #
    6 # Only one notification per ZED_NOTIFY_INTERVAL_SECS will be sent for a given
    7 # class/pool/[vdev] combination.  This protects against spamming the recipient
    8 # should multiple events occur together in time for the same pool/[vdev].
    9 #
   10 # Exit codes:
   11 #   0: notification sent
   12 #   1: notification failed
   13 #   2: notification not configured
   14 #   3: notification suppressed
   15 #   9: internal error
   16 
   17 [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
   18 . "${ZED_ZEDLET_DIR}/zed-functions.sh"
   19 
   20 [ -n "${ZEVENT_POOL}" ] || exit 9
   21 [ -n "${ZEVENT_SUBCLASS}" ] || exit 9
   22 [ -n "${ZED_NOTIFY_DATA}" ] || exit 3
   23 
   24 rate_limit_tag="${ZEVENT_POOL};${ZEVENT_VDEV_GUID:-0};${ZEVENT_SUBCLASS};notify"
   25 zed_rate_limit "${rate_limit_tag}" || exit 3
   26 
   27 umask 077
   28 note_subject="ZFS ${ZEVENT_SUBCLASS} error for ${ZEVENT_POOL} on $(hostname)"
   29 note_pathname="$(mktemp)"
   30 {
   31     echo "ZFS has detected a data error:"
   32     echo
   33     echo "   eid: ${ZEVENT_EID}"
   34     echo " class: ${ZEVENT_SUBCLASS}"
   35     echo "  host: $(hostname)"
   36     echo "  time: ${ZEVENT_TIME_STRING}"
   37     echo " error: ${ZEVENT_ZIO_ERR}"
   38     echo " objid: ${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}"
   39     echo "  pool: ${ZEVENT_POOL}"
   40 } > "${note_pathname}"
   41 
   42 zed_notify "${note_subject}" "${note_pathname}"; rv=$?
   43 rm -f "${note_pathname}"
   44 exit "${rv}"

Cache object: 9d57a710a2dfd56f7ec52be237fbc8c4


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.