EMS Manual
Example of Reporting Events
EMS Manual—426909-005
B-8
The C Source File
if (spi_error = EMSINIT(
(short *)event_buf, /* Event build buffer */
XOUR_VAL_EVT_BUFLEN, /* total buffer length in bytes*/
(short *)&our_ssid, /* ssid of reporting subsystem*/
XOUR_EVT_TIME_TOO_LONG, /* event number */
XOUR_TKN_IO_FILE, /* subject token code */
file_name)) /* event subject value */
{
printf("*** EMSINIT error = %d\n", spi_error);
DEBUG();
}
/* If more than 1/2 minute, then critical */
if (io_time > 30000000)
emphasis = ZSPI_VAL_TRUE;
/* Add several tokens at once */
if (spi_error = EMSADDTOKENS((short *)event_buf,
/* our SSID by default */,
/* Token code Value Size */
XOUR_TKN_IO_MSG, io_msg , io_len,
XOUR_TKN_IO_TIME, (char*)&io_time , ,
ZEMS_TKN_EMPHASIS, (char*)&emphasis , ,
ZEMS_TKN_CONSOLE_PRINT, (char*)&true_val, ))
{
printf ("*** EMSADDTOKENS error = %d\n", spi_error);
DEBUG();
}
/* Add a single map */
if (SSNULL((short *)map_too_long_stats, (char *)too_long_stats))
DEBUG();
too_long_stats->subsys_process_type = XOUR_VAL_PROC_OUTPUT_BOUND;
too_long_stats->ios = num_ios;
too_long_stats->occurrences = evt_calls;
if (spi_error = EMSADDTOKENMAPS((short *)event_buf,
/* our SSID by default */,
(short*)map_too_long_stats,
(char *)too_long_stats))
{
printf("*** EMSADDTOKENMAPS error = %d\n", spi_error);
DEBUG();
}
/*
* The next gets the size of the event that was built to use for
* sending the event to the collector.
*/
if (spi_error = SSGETTKN((short *)event_buf, /* event buffer */
ZSPI_TKN_USEDLEN, /* special spi token code */
(char *)&size)) /* size is return in size */
{
printf("*** SSGETTKN error = %d\n", spi_error);
DEBUG();
}
/*
* Open the EMS Collector
*/
if (fs_error = (FILE_OPEN_(outputList.u_z_data.z_procname,
outputList.z_procname_len, &coll_filenum)))
{
printf (" Unsuccessful open of the collector \n");
DEBUG();
}