HP-UX Event ManagerAdministrator's Guide
Using Event Manager
Monitoring Events
Chapter 2 45
To create and post a new event, complete the following steps:
Step 1. Create the /var/evm/adm/templates/local directory if it does not
exist.
Step 2. Use a text editor, such as vi, to create the following text file:
# This file contains EVM event templates for local
# backup notification events.
event {
name local.admin.backup.ok
format "BACKUP: Backup completed OK"
priority 200
}
event {
name local.admin.backup.failed
format "BACKUP: Backup failed - code $result_code"
var {name result_code type UINT8 value 0}
priority 400
}
Step 3. Save the file in the /var/evm/adm/templates/local directory with the
name backup.evt.
You can install new template files in any directory under
/var/evm/adm/templates, but name subdirectories and template files
according to the names of your events for ease of identification. Keeping
a small number of closely-related event templates in a single template
file simplifies maintenance.
Step 4. Verify the template syntax. The syntax of a template file is identical to
the syntax used to post an event. Hence, you can use the evmpost -r
command to verify the syntax. The -r option instructs the evmpost
command not to post the event, but to validate the syntax, convert the
input into binary events, and then write the events to its standard
output (stdout) stream. Use the evmpost -M command option to prevent
the merging of template items in to the event, or to add any
environmental items such as a timestamp.
As with any stream of binary Event Manager events, you can use the
evmshow command to verify the output of the evmpost command. To do
this, enter the following command at the HP-UX prompt:
# cat /var/evm/adm/templates/local/backup.evt |
evmpost -r -M | evmshow -t "@priority @@"
If you created the file correctly, the following output is displayed: