EMS Manual

Retrieving Event Messages Programmatically
EMS Manual426909-005
4-6
Event-Message Sources
Event-Message Sources
You must specify the source of the event messages the distributor is to access: either
the current log files of one or more primary or alternate collectors, or a saved log file.
Event message sources can be added or deleted. To change from one source to
another, delete the current source and add the new source. You can access up to ten
collectors (current log files), but only one saved log file.
To add a collector, issue a CONTROL command message that includes the token
ZEMS^TKN^CONNECT^SRC^COLL. You can include more than one of these tokens,
as long as the total number of collectors is always ten or fewer.
For example, to add two collectors, $0 (the local collector) and \CITY.$0 (the collector
on the node \CITY):
! Initialize buffer for distributor CONTROL command message
IF (error := SSINIT(spibuffer,
ZEMS^VAL^BUFLEN,
ZEMS^VAL^SSID,
ZSPI^VAL^CMDHDR,
ZEMS^CMD^CONTROL)) THEN ...
! Get external name of collector for use as token value
sbuf ':=' ["$0", 0];
CALL FNAMEEXPAND(sbuf, coll^name1, my^file^defaults);
! Place token--with token value--in spibuffer
spi^error := SSPUTTKN(spibuffer,
ZEMS^TKN^CONNECT^SRC^COLL,
coll^name1);
! Handle any error from SPI procedure
IF spi^error <> ZSPI^ERR^OK THEN ...
! Do the same thing for the second collector
sbuf ':=' ["\CITY.$0", 0];
CALL FNAMEEXPAND(sbuf,
coll^name2,
my^file^defaults);
spi^error := SSPUTTKN(spibuffer,
ZEMS^TKN^CONNECT^SRC^COLL,
coll^name2);
! Handle any error from SPI procedure
IF spi^error <> ZSPI^ERR^OK THEN ...
! Determine how many bytes of spibuffer have been used
spi^error := SSGETTKN(spibuffer,
ZSPI^TKN^USEDLEN,
buffer^length);
! Handle any error from SPI procedure
IF spi^error <> ZSPI^ERR^OK THEN ...