HP-UX Event ManagerAdministrator's Guide
Using Event Manager
Monitoring Events
Chapter 2 47
Step 10. Verify that the events are logged correctly by entering the following
commands at the HP-UX prompt:
# echo 'event {name local.admin.backup.ok}' | evmpost
# echo 'event {name local.admin.backup.failed}' | evmpost
# evmget -f '[name local.admin.backup]' |
evmshow -t '@timestamp [@priority] @@'
28-Jun-2002 15:21:39 [200] BACKUP: Backup completed OK
28-Jun-2002 15:21:40 [400] BACKUP: Backup failed - code 0
In the previous example, the evmpost command reads the source input
from its standard input (stdin) stream, converts it to an event, and posts
it. The output from the final command shows the posted events. It
includes the priorities specified in the template file, because the daemon
merges the template information into each event as it is posted. The
value of the code in the second event is zero, because it is the dummy
value supplied in the template file, and that value was not overridden in
the posted event. In the backup script, the value is set to a value other
than zero.
Step 11. Add the posting commands to your backup script, as shown in the
following example:
#! /bin/sh
# This shell script runs the backup operation
# and posts an event to indicate success
#or failure.
do_backups # Performs the backup operation
if [ $? -eq 0 ]
then
# success
echo 'event {name local.admin.backup.ok}'| evmpost
else
# failure
RES=$?
evmpost << END
event {
name local.admin.backup.failed
var { name result_code type UINT8 value $RES }
}
END
fi