1#!/bin/sh
2#  This shell script can be executed by mcelog in daemon mode when a page
3#  in memory exceeds a pre-configured corrected error threshold.
4#  mcelog internally also supports offlining the page through the kernel.
5#
6# environment:
7# THRESHOLD     human readable threshold status
8# MESSAGE	Human readable consolidated error message
9# TOTALCOUNT    total count of errors for current DIMM of CE/UC depending on
10#		what triggered the event
11# LOCATION	Consolidated location as a single string
12# DMI_LOCATION  DIMM location from DMI/SMBIOS if available
13# DMI_NAME	DIMM identifier from DMI/SMBIOS if available
14# DIMM		DIMM number reported by hardware
15# CHANNEL	Channel number reported by hardware
16# SOCKETID	Socket ID of CPU that includes the memory controller with the DIMM
17# CECOUNT	Total corrected error count for DIMM
18# UCCOUNT	Total uncorrected error count for DIMM
19# LASTEVENT	Time stamp of event that triggered threshold (in time_t format, seconds)
20# THRESHOLD_COUNT Total umber of events in current threshold time period of specific type
21# ARGUMENTS:$1  the page address of soft offline
22#
23# note: will run as mcelog configured user
24# this can be changed in mcelog.conf
25
26logger -s -p daemon.err -t mcelog "$MESSAGE"
27logger -s -p daemon.err -t mcelog "Location: $LOCATION"
28
29[ -x ./page-error-post-sync-soft-trigger.local ] && . ./page-error-post-sync-soft-trigger.local $1
30
31if [ -d page-error-post-sync-soft-trigger.extern ]
32then
33    ls page-error-post-sync-soft-trigger.extern |
34    while read item
35    do
36        [ -x ./page-error-post-sync-soft-trigger.extern/$item ] && . ./page-error-post-sync-soft-trigger.extern/$item $1
37    done
38fi
39
40exit 0
41