Post by wbreidbachPost by RandallPost by wbreidbachPost by wbreidbachPost by PrasadHello All,
Please advice me how do read EMS logs pertaining to a specific filter
criteria in a TACL script.
Below is what I need to accomplish by doing so.
1) Need to browse theough the EMS logs for specific criteria. lets
assume pathway subsys errors
2) save it ro a variable and the prepare a formatted report.
I just need to tweak. how do I get the ems logs into the Tacl variable.
The easiest way to do that is to create a specific filter for the
EMSDIST program.
If you can specify your criteria a filter can easily be created.
Wolfgang
Just to avoid misunderstandings: EMSDIST with TYPE PRINT provides a
formatted report.
Unfortunately the length of the output line is depending on the
destination device, for a process it would be 132 as default. You can
change that be running the process as a subtype 30 process and answer
the -106 message according to your needs.
The only chance to get the event message "in one piece" would be to
use a CONSUMER type distributor, I did that with a TAL program but
this might be difficult in TACL as you have to use the SPI
procedures.
(shameless plug)
There are other ways of processing EMS logs not on the NonStop. You
can pull events in real time out to workstations and process them
there using database tools. If interested, contact me.- Zitierten Text ausblenden -
- Zitierten Text anzeigen -
We are processing the EMSLOG(s) with a home developed database-based
application. In addition we are using SNMP traps with EMSDIST. My
impression was that TACL had to be treated as a must.
This is a good point: We are not certain that we know the actual requirement. Sometimes what happens is that the person posting the question has progressed part way on what he thinks is the best approach to solving the problem, then posts with a question about something with that approach that he does not know how to do. It might be that there is a much better or easier approach to satisfying the original request that has been overlooked.
?PASS
TANDEM PATHWAY *
This is a fixed-column format: the items start in columns 1, 10, and 20. (There also is a pass value that starts in column 40, but that is not of any interest for a printing distributor.) Put those two lines into an Edit file and specify it as the FILTER parameter in an EMSDIST command. Look in chapter 6 for the other things a filter table can do.
[#SET ZPWY^VAL^SSID [ZSPI^VAL^TANDEM].[ZSPI^SSN^ZPWY].[ZPWY^VAL^VERSION] ]
FILTER pass_pathway;
BEGIN
IF ZSPI^TKN^SSID = SSID ( ZPWY^VAL^SSID ) THEN PASS;
FAIL;
END;
#PUSH dummy
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZSPITACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZEMSTACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZPWYTACL
#POP dummy
EMF/IN GETPATH/ OGETPATH
Then specify OGETPATH as the FILTER in an EMSDIST command.
FILEINFO $*.ZSPIDEF.ZSPITACL
should find where it is if it is not on $SYSTEM.
The full filter language is described in chapter 5 of the EMS Reference manual. When starting, you probably can skip the beginning parts of the description and go directly to the subheading "Declarations" and read on from there. The examples ought to be enough to let you see how to form statements in a filter. If you find you need to do something that is not clear from the statement descriptions and examples, refer back to the earlier part of chapter 5 for the more detailed description of that point.
One point that sometimes gets confused is the difference between EMSTEXTMATCH and MATCH. If you want to test the contents of a token that contains a string to see whether it matches a pattern, MATCH is what to use. EMSTEXTMATCH is for something different.
The EMS filter is executed in an interpreter inside EMSDIST, so give some attention to minimizing the statements that have to be executed. If the filter is short, this does not matter much, but if the filter gets to be large and complex, try to arrange it so that it tests the most likely things first.
You said you wanted to get the results from EMSDIST into a TACL variable and format them for a report. EMSDIST, at least when used as a printing distributor, already formats event for printing. If the normal output from EMSDIST is not in the form you want, you can supply your own formatting templates to use to format the events. That requires learning the template formatting language, which is described in the DSM Template Services manual.
You must create a DDL dictionary from the token definition files supplied by HP before being able to compile formatting templates. The DDL source files that you need for this are in the same ZSPIDEFS subvolume as the other token definition files are. You must include the SPI and EMS token definitions first, then those from the subsystems whose events you want to format. In some cases, a subsystem's token definitions might depend on another subsystem's token definitions. The first four characters of the name of an undefined reference will lead you to the file that defines that item.
To write a formatting template for an event, you must know what tokens are included in the event. This is documented in a manual for the product. Often it contains the words Management Programming Manual in the title of the manual, but not always. Once you know the tokens in the event, writing the template to say how the event should be formatted is not very difficult. I cannot remember whether HP includes the source file for the formatting templates among the token definitions and other SPI files shipped with the product. If so, you might be able to adapt the templates supplied by HP for the subsystems whose events you want to print. That would be easier than writing the templates entirely on your own.
There is a way to override the part of the event formatting that displays the date, time, subsystem ID, etc. at the beginning of the line for each event. You can supply an empty formatting template to eliminate that header altogether, or you can supply a formatting template that formats just what you want. I don't find the template key used for that header formatting template in a quick look at the documentation. If you need that, I'm sure we can find it.
You get EMSDIST to use your custom formatting templates by naming the file containing them in the =_EMS_TEMPLATES DEFINE before running EMSDIST. That will not affect the formatting done by other places in your system.
If having EMSDIST produce the report is not suitable, then you could either take the formatted messages that EMSDIST produces, process them, and produce a report in whatever format you prefer, or you could use EMSDIST as a consumer distributor, which returns the event messages in SPI tokenized for to your program (which could be a TACL program or one in C or TAL), which would then extract information from the events and produce the report you need.
Getting the report from EMSDIST into your TACL code is not as simple as using OUTV in the EMSDIST command, since EMSDIST does not write its report to its OUT file. The TEXTOUT parameter to the EMSDIST command can specify a disk file or a process. Writing to a disk file and then reading that file from TACL probably is the simplest way to take. I do not know what types of disk files are acceptable, and the manual seems not to list them. It does say that if the file does not exist, EMSDIST will create an entry-sequenced file with 80-character records, so entry-sequenced files must be acceptable. I imagine it would accept longer records, but whether it uses the full record length, I don't know.
It might be possible to specify your own TACL process name or that of another TACL process as the TEXTOUT file and use #SERVER to read the formatted lines as EMSDIST writes them. I cannot say whether that will work. If you try to send the lines to your own TACL process, you certainly would have to use NOWAIT on the EMSDIST command. I don't know what else might be necessary. The process would not have to be written in TACL -- it could be written in C, COBOL, TAL, or pTAL, or any other language that can read from $RECEIVE.
Using the consumer distributor approach probably is formally the better approach if you cannot use a report produced by EMSDIST as the final result, but it takes more work. You must learn how to send SPI commands to EMSDIST to retrieve events and write the per-event
...
read more »- Hide quoted text -
- Show quoted text -
Hi Prasad,
Are you certain that the events from MULTIBAT contain the
zems^tkn^text token? If MULTIBAT has defined its events with
individual tokens and supplied formatting templates for the events, it
generally would not include the zems^tkn^text token in the event
messages. In that case, you would have to look at the definition of
the contents of the event messages as documented by MULTIBAT to
determine how to test for the events that are of interest.
If the MULTIBAT events do use the zems^tkn^text token rather than
individual tokens, when you refer to the zems^tkn^text token in the
filter, you must qualify it by the EMS subsystem ID. To do that, you
must first initialize the variable containing the EMS subsystem ID,
then use it in the reference to the token.
You can tell which of the EMS tokens need to be qualified by looking
at their documentation in the EMS manual. If the description of the
token says it is a shared token, you do not qualify it, but if it is
nonshared, you must qualify it with the EMS subsystem ID. These
definitions are in chapter 14 of the EMS Reference manual (EMS
Definitions). In general, tokens stored in the header of the event
message are shared and need not be qualified and tokens in the body of
the event message are nonshared and must be qualified, but there are a
few exceptions to this general rule.
Under the assumption that the MULTIBAT events do use the zems^tkn^text
token, then I believe your filter should be written this way:
#PUSH dummy
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZSPITACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZEMSTACL
#POP dummy
[#SET ZEMS^VAL^SSID [ZSPI^VAL^TANDEM].[ZSPI^SSN^ZEMS].
[ZEMS^VAL^VERSION]]
[#DEF mbat^val^ssid SSID
BEGIN
SSID x MULTIBAT.1.0;
END;]
FILTER TEST^FILTER
BEGIN
IF (zspi^tkn^ssid = SSID(mbat^val^ssid) AND
MATCH (SSID(zems^val^ssid,zems^tkn^text), "*G110*") then
PASS
ELSE
FAIL;
END;
Note that I removed the #LOAD for the ZPWY token definitions, since
your filter does not use any Pathway tokens. Including that line does
not cause any error, but just takes time and memory that are not
needed.
The EMS documentation says that there should be a semicolon following
the name of the filter in the FILTER statement, but I see that your
filter omits that. Perhaps EMF considers that semicolon to be
optional, but if you continue to have trouble with this filter, try
adding that semicolon to see whether that makes a difference.
I hope that solves the problem, but if it does not solve the problem,
please write again.
- Keith
PRASAD BHALEKAR wrote:
Hi Keith,
The filter looks like below.
#PUSH dummy
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZSPITACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZEMSTACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZPWYTACL
#POP dummy
[#DEF mbat^val^ssid SSID
BEGIN
SSID x MULTIBAT.1.0;
END;]
FILTER TEST^FILTER
BEGIN
IF (zspi^tkn^ssid = SSID(mbat^val^ssid) AND
MATCH (zems^tkn^text, "*G110*") then
PASS
ELSE
FAIL;
END;
this is how the filter I have coded. But to my surprise this doesnt
give any
matching events.
but if I put a check on the ZEMS^TKN^EVENTNUMBER it works fine.
Also in one of the existing filters we have here.. The match criteria
also
works.
I am afraid why it isnt working with me.
Regards,
Prasad
On Thu, Feb 24, 2011 at 9:37 PM, Keith Dick <***@earthlink.net>
wrote:
Prasad wrote:
On Feb 22, 2:19 am, Keith Dick <***@acm.org> wrote:
wbreidbach wrote:
On 21 Feb., 15:01, Randall <***@nexbridge.com> wrote:
On Feb 21, 5:32 am, wbreidbach <***@bv-
zahlungssysteme.de> wrote:
On 21 Feb., 09:42, wbreidbach <***@bv-
zahlungssysteme.de> wrote:
On 21 Feb., 08:49, Prasad <***@gmail.com> wrote:
Hello All,
Please advice me how do read EMS logs pertaining to a specific filter
criteria in a TACL script.
Below is what I need to accomplish by doing so.
1) Need to browse theough the EMS logs for specific criteria. lets
assume pathway subsys errors
2) save it ro a variable and the prepare a formatted report.
I just need to tweak. how do I get the ems logs into the Tacl
variable.
The easiest way to do that is to create a specific filter for the
EMSDIST program.
If you can specify your criteria a filter can easily be created.
Wolfgang
Just to avoid misunderstandings: EMSDIST with TYPE PRINT provides a
formatted report.
Unfortunately the length of the output line is depending on the
destination device, for a process it would be 132 as default. You can
change that be running the process as a subtype 30 process and answer
the -106 message according to your needs.
The only chance to get the event message "in one piece" would be to
use a CONSUMER type distributor, I did that with a TAL program but
this might be difficult in TACL as you have to use the SPI
procedures.
(shameless plug)
There are other ways of processing EMS logs not on the NonStop. You
can pull events in real time out to workstations and process them
there using database tools. If interested, contact me.- Zitierten Text
ausblenden -
- Zitierten Text anzeigen -
We are processing the EMSLOG(s) with a home developed database-based
application. In addition we are using SNMP traps with EMSDIST. My
impression was that TACL had to be treated as a must.
This is a good point: We are not certain that we know the actual
requirement. Sometimes what happens is that the person posting the
question
has progressed part way on what he thinks is the best approach to
solving
the problem, then posts with a question about something with that
approach
that he does not know how to do. It might be that there is a much
better or
easier approach to satisfying the original request that has been
overlooked.
So, to respond to the specific question: If you need only select
certain
EMS events by the subsystem name and event number, a filter table is
the
easiest way to do that. Filter tables are described in chapter 6 of
the EMS
Reference manual. There is more to filter tables than this simple
example
shows, but to select all Pathway events, this would do:
?PASS
TANDEM PATHWAY *
This is a fixed-column format: the items start in columns 1, 10, and
20.
(There also is a pass value that starts in column 40, but that is not
of
any interest for a printing distributor.) Put those two lines into an
Edit
file and specify it as the FILTER parameter in an EMSDIST command.
Look in
chapter 6 for the other things a filter table can do.
If you must select events based on the values of other things in the
events, a regular EMS filter is needed. It is a little harder to
write than
a filter table is, but not terribly hard. Just as an example, I think
this
filter would do the same as the above filter table:
[#SET ZPWY^VAL^SSID [ZSPI^VAL^TANDEM].[ZSPI^SSN^ZPWY].
[ZPWY^VAL^VERSION]
]
FILTER pass_pathway;
BEGIN
IF ZSPI^TKN^SSID = SSID ( ZPWY^VAL^SSID ) THEN PASS;
FAIL;
END;
Put the above lines into an Edit file, for this example, let us call
it
GETPATH. Then the following lines would compile the filter:
#PUSH dummy
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZSPITACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZEMSTACL
#LOAD /KEEP 1, LOADED dummy/ $SYSTEM.ZSPIDEF.ZPWYTACL
#POP dummy
EMF/IN GETPATH/ OGETPATH
Then specify OGETPATH as the FILTER in an EMSDIST command.
EMF is a TACL routine which needs the token definitions loaded in TACL
form, which is why the #LOAD commands are needed before running EMF.
I
believe this example filter did not need the EMS tokens, but they are
often
used in filters (when checking the event number, for example), so you
usually would need them. The ZSPIDEF subvolume might be on a
different disc
than $SYSTEM -- the command:
FILEINFO $*.ZSPIDEF.ZSPITACL
should find where it is if it is not on $SYSTEM.
The full filter language is described in chapter 5 of the EMS
Reference
manual. When starting, you probably can skip the beginning parts of
the
description and go directly to the subheading "Declarations" and read
on
from there. The examples ought to be enough to let you see how to
form
statements in a filter. If you find you need to do something that is
not
clear from the statement descriptions and examples, refer back to the
earlier part of chapter 5 for the more detailed description of that
point.
One point that sometimes gets confused is the difference between
EMSTEXTMATCH and MATCH. If you want to test the contents of a token
that
contains a string to see whether it matches a pattern, MATCH is what
to use.
EMSTEXTMATCH is for something different.
The EMS filter is executed in an interpreter inside EMSDIST, so give
some
attention to minimizing the statements that have to be executed. If
the
filter is short, this does not matter much, but if the filter gets to
be
large and complex, try to arrange it so that it tests the most likely
things
first.
You said you wanted to get the results from EMSDIST into a TACL
variable
and format them for a report. EMSDIST, at least when used as a
printing
distributor, already formats event for printing. If the normal output
from
EMSDIST is not in the form you want, you can supply your own
formatting
templates to use to format the events. That requires learning the
template
formatting language, which is described in the DSM Template Services
manual.
You must create a DDL dictionary from the token definition files
supplied
by HP before being able to compile formatting templates. The DDL
source
files that you need for this are in the same ZSPIDEFS subvolume as the
other
token definition files are. You must include the SPI and EMS token
definitions first, then those from the subsystems whose events you
want to
format. In some cases, a subsystem's token definitions might depend
on
another subsystem's token definitions. The first four characters of
the
name of an undefined reference will lead you to the file that defines
that
item.
To write a formatting template for an event, you must know what tokens
are included in the event. This is documented in a manual for the
product.
Often it contains the words Management Programming Manual in the title
of
the manual, but not always. Once you know the tokens in the event,
writing
the template to say how the event should be formatted is not very
difficult.
I cannot remember whether HP includes the source file for the
formatting
templates among the token definitions and other SPI files shipped with
the
product. If so, you might be able to adapt the templates supplied by
HP for
the subsystems whose events you want to print. That would be easier
than
writing the templates entirely on your own.
There is a way to override the part of the event formatting that
displays
the date, time, subsystem ID, etc. at the beginning of the line for
each
event. You can supply an empty formatting template to eliminate that
header
altogether, or you can supply a formatting template that formats just
what
you want. I don't find the template key used for that header
formatting
template in a quick look at the documentation. If you need that, I'm
sure
we can find it.
You get EMSDIST to use your custom formatting templates by naming the
file containing them in the =_EMS_TEMPLATES DEFINE before running
EMSDIST.
That will not affect the formatting done by other places in your
system.
If having EMSDIST produce the report is not suitable, then you could
either take the formatted messages that EMSDIST produces, process
them, and
produce a report in whatever format you prefer, or you could use
EMSDIST as
a consumer distributor, which returns the event messages in SPI
tokenized
for to your program (which could be a TACL program or one in C or
TAL),
which would then extract information from the events and produce the
report
you need.
Getting the report from EMSDIST into your TACL code is not as simple
as
using OUTV in the EMSDIST command, since EMSDIST does not write its
report
to its OUT file. The TEXTOUT parameter to the EMSDIST command can
specify a
disk file or a process. Writing to a disk file and then reading that
file
from TACL probably is the simplest way to take. I do not know what
types of
disk files are acceptable, and the manual seems not to list them. It
does
say that if the file does not exist, EMSDIST will create an entry-
sequenced
file with 80-character records, so entry-sequenced files must be
acceptable.
I imagine it would accept longer records, but whether it uses the full
record length, I don't know.
It might be possible to specify your own TACL process name or that of
another TACL process as the TEXTOUT file and use #SERVER to read the
formatted lines as EMSDIST writes them. I cannot say whether that
will
work. If you try to send the lines to your own TACL process, you
certainly
would have to use NOWAIT on the EMSDIST command. I don't know what
else
might be necessary. The process would not have to be written in TACL
-- it
could be written in C, COBOL, TAL, or pTAL, or any other language that
can
read from $RECEIVE.
Using the consumer distributor approach probably is formally the
better
approach if you cannot use a report produced by EMSDIST as the final
result,
but it takes more work. You must learn how to send SPI commands to
EMSDIST
to retrieve events and write the per-event
...
read more »- Hide quoted text -
- Show quoted text -
HI Keith,
I need to use the MATCH for ems text but unfortunately its not working
as expected. Any ideas why is it so ?
--Prasad
Hi Prasad,
Without seeing the filter code you are using, it is very hard to guess
at
the problem. It could be that you misunderstand how to use MATCH, or
that
you misunderstand what is the contents of the token whose value you
are
testing with MATCH, or something else.
Could you send me the whole filter, or at least a few lines of it that
contain the MATCH function? Also, could you send me the formatted
message
for an event you expected MATCH to be true but it was not? Maybe that
will
give me a better idea of what the problem is.
If you are unsure of the contents of the tokens in an event, even
after
studying the description of the tokens in the event given in the
Management
Programming Manual for the product that produces the event, you can
use the
DUMP ON option to get EMSDIST to display the individual tokens and
values
from the event. Use the TIME and STOP options on EMSDIST at the same
time
to limit the events selected to just the time of the event whose
contents
you want to see so that it does not produce an extremely large output.
If you have programmed an event-processing program using a consumer
distributor and the filter is passing events that you believe should
not
have been passed, you can use Inspect to display an event message:
specify
TYPE EMS or TYPE EMS-NUM in the DISPLAY command. This is described in
the
Inspect manual. This formatted dump is also available in Visual
Inspect,
but I do not know the details of how to request it. It is not
available in
Native Inspect. It might be available in TACL, but I think not.
I do not remember any debugging options available to help see how a
filter
is being interpreted. I think none were implemented, so we can only
look at
the statements of the filter and the contents of an event to try to
figure
out why the filter is not working as expected.
- Keith
Hi Keith,
I tried according to your suggestions but it didnt work. below is the
dump of one of the multibatch ems event
**** Next Event ****
Header_type: %H1
Checksum: F
Last_error: token_not_found (%HFFF8)
Last_error_tkncode: (%H3,%H4,%HFDE6) Ldev-
Number
Max_field_version: 0
SSID: MULTIBAT.1.0
Used_byte_length: %H1E6
Buffer_byte_length: %H1E6
Console-Print: F
Generating-CPU: %H8
Emphasis: F
Event-Number: (%H3)
Standard-defined-type: not-specified (%H0)
User-defined-type: undefined (%H0)
Event-Hdr-Version: %H2
ZEMS-TKN-FORWARDED: F
Generation-Timestamp: 2011-02-26 00:00:02.858.835
Logged-Timestamp: 2011-02-26 00:00:02.859.038
Node-Name: "\NODENAME"
Node-Number: %H4
Generating-PIN: %H2E6
Process-Descriptor: "\NODENAME.$ABCD:145825521"
ZEMS-TKN-REDUNDANT: F
Suppress-Display: F
Userid: %H3F %HFE
Subject-Mark:*
(%H1,%H18,%H1): "G112.AA.01.* "
Manager: \NODENAME.$ABCD
TANDEM.EMS.0 Text: "G112.AA.01.*, started by
operator"
": [ $A123 , 10, Critical-
N, (063"
",254), \NODENAME.
$SYSTEM.SYSTEM.TAC"
"L ,
000000001316606705 ]., "
"\NODENAME.$A1MC 26/02/11,
00:00 "
" "
" "
" "
TANDEM.EMS.0 Action-Needed: T
TANDEM.EMS.0 Action-ID:- %H1