The following applet is triggered whenever there is a system environment message (%ENVMON) generated in the device’s syslog. E.g high temperature, failed power supply etc. As soon as EEM “sees” %ENVMON messages, it will execute the below commands, capture the output and email it to me:

event manager applet env_monitor authorization bypass
event syslog pattern "%ENVMON"
action 1.01 syslog msg "------ EEM GENERATED MESSAGE ---------"
action 1.02 syslog msg "------ENVIRONMENT PROBLEM DETECTED----"
action 1.03 cli command "enable"
action 1.04 set result ""
action 1.05 cli command "show clock"
action 1.06 append result "$_cli_result"
action 1.07 cli command "show environment table"
action 1.08 append result "$_cli_result"
action 2 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "Router Environmental Change Notification" body "$result"

courtesy of Chris Partsenidis