Chapter 9. Logging Events from Applications and Scripts

The ESP framework provides two ways for you to send events from your local applications and scripts to ESP:


Note: You can also use the openlog, syslog, and closelog SYSLOG functions to send event information through SYSLOG. Refer to the syslog(3c) man page for more information.


Event Classification and Sequence Numbers

The ESP framework uses a standardized event classification scheme for the events that it registers. This classification scheme was implemented to:

  • Provide a meaningful representation of the events that have occurred so that users can easily interpret them

  • Provide an easy way to locate the source of an error by providing a general category and more specific information

In this scheme, events are categorized by class and type. An event class describes a general area that ESP monitors (for example, SCSI). An event type provides greater detail about individual events (for example, a SCSI controller initialization failure).

ESP automatically generates event class and type numbers when you create custom events and classes. You can use these numbers with your local applications and scripts to send event information to the ESP framework through the Event Manager API and esplogger and emgrlogger tools.

The ESP framework also uses unique sequence numbers for system messages. These sequence numbers provide a mechanism that enables ESP to isolate problems at the source code level.

Using the Event Manager API

The Event Manager API contains a set of functions that you can call from your local C or C++ programs to send event information to the Event Manager daemon (eventmond). The Event Manager forwards events to ESP on a subscription basis.

Refer to the Event Manager User Guide, publication number 007-4661-00x, for more information about the Event Manager API functions and how to use them.

Using the emgrlogger and esplogger Tools

The esplogger and emgrlogger tools provide a simple command-line interface to submit events to the Event Manager. emgrlogger works with the new Event Manager and replaces esplogger, which was used with previous versions of eventmond and ESP. esplogger remains available to provide backward compatibility. emgrlogger can produce any type of Event Manager event, including subscription events.

Use the emgrlogger and esplogger tools to pass event information from your local scripts to the event monitoring component of ESP (eventmond). You can run esplogger from a UNIX prompt or from a UNIX shell script. emgrlogger and esplogger use the following command syntax:

emgrlogger:

emgrlogger -h
emgrlogger [-S | -U | -Q | -UQ | -RS]
        [-c <class>] [-t <type>] [-a <appname>] [-s <source host>]
        [-o <origin>] [-p <priority>] [-f <facility>]
        [-P <path to remote host>] [ -is [<tag>]=[<value>]   |
          -if [<tag>]=<file path> |
          -id [<tag>]=<hex data> 
        ]*


Note: Options related to creating subscription events are not typically used and are not described in this document.

where:

  • The -S option makes a subscription request.

  • The -U option makes an unsubscription request.

  • The -Q option makes a subscription query.

  • The -UQ option makes an unsubscription by query result request.

  • The -RS option makes a remote subscription request.

  • The -c option specifies the event class.

  • The -t option specifies the event type.

  • The -a option specifies the name of the application.

  • The -s option specifies the source (hostname) of the event.

  • The -o option specifies the origin of the event.

  • The -p option specifies the priority value of the event.

  • The -f option specifies the facility value of the event.

  • The -P option specifies the delivery path for a remote subscription event.

  • The -is option specifies string data.

  • The -if option specifies file data.

  • The -id option specifies digital (binary) data in hexadecimal format.

esplogger:

esplogger -s <sequence_number> {-f <filename> | -m "<message>"} [-p <priority>] [-t <time>]
esplogger -h
esplogger -V

where:

  • The -s <sequence_number> option specifies the sequence number (in decimal or hexadecimal). You must use this option with the -t option and the -f or -m options.

  • The -f <filename> option specifies the file that contains data to log in the ESP framework. You must include the -s option with this option. You cannot use this option with the -m option.

  • The -m <message > option specifies a message to log in the ESP framework. You must include the -s option with this option. You cannot use this option with the -f option.

  • The -p <priority> option specifies the priority (for example, local0.notice). Refer to the syslog(3C) man page for descriptions of the priority values. If you do not specify a priority value, esplogger sets the priority to local0.info. You must use this option with the -s option and the -f or -m option.

  • The -t <time> option specifies the time that the event occurred. You must specify the time in seconds since 00:00:00 UTC on January 1, 1970 (in decimal notation). If you do not specify the time, esplogger defaults the time to the time that it received the event. You must use this option with the -s option and the -f or -m option.

  • The -h option prints the usage information.

  • The -V option prints the esplogger version number.


Note: You can also use logger to send event information through SYSLOG. Refer to the logger(1) man page for more information.


Example 1

emgrlogger -t 200356 -if FILE=availmon.dat
esplogger -s 200356 -f availmon.dat

This example sets the sequence number to 200356, the priority to local0.info (1030), and the time to the time that esplogger received the event. Then, it passes this information and the data in the availmon.dat file to eventmond.

Example 2

emgrlogger -t 0x00200000 -p syslog -f warning -is MSG="Start SVP"
emgrlogger -s 0x00200000 -p syslog.warning -m "Start SVP"

This example sets the sequence number to 0x00200000, the priority to syslog.warning (324), and the time to the time that emgrlogger or esplogger received the event. Then, it passes this information and the message to eventmond.