
If I have a text parameter that contains text only can I pull the text of that parameter some how? I have tried to get it using the get("/".applicationclass."/"instance."/".parameter."/value); command with out any luck. Using that command I can get values on graphs but that's about it. Any ideas?
Thanks
Hey Bert. Thanks for the reply.
It's pretty basic, the only exception may be I'm trying to pull the data in the text parameter from event catalog 11. I can get the value of a graph parameter without issue. Here is the code:
populate
set("../LOGAlarms/value", errdisp, unique(matchedline) ); #errodisp is a title and matchedline is text pulled from a log file.
pull
almtxt = get("/".applicationclass."/".instance."/LogAlarms/value");
What I'm trying to do is pass the text from the LOGAlarms parameter through SNMP to a SNMP management system but I can't even get the text to print in the SOW. I agree with you IT SHOULD WORK. The text is present in the LOGAlarms parameter. Weird!
Thanks for your help,
Rob
"
populate
set("../LOGAlarms/value", errdisp, unique(matchedline) ); #errodisp is a title and matchedline is text pulled from a log file.
"
Whoa...hold it
Unless the unique(matchedline) returns a timestamp....and a recent one you will have problems here. The third argument of set() should be a timestamp in seconds past the epoch format. If your unique(matchedline) is textual it will evalute to 0 numerically...which would represent the epoch....Dec 1970....which is likely way outside your retention period for history even...and definately not the most recent value of this parameter.
Perhaps you meant
<br/>set("../LOGAlarms/value", errdisp . "\n" . unique(matchedline) ); <br/>
Indeed, this is undocumented in the manual, but already documented in the devcon forum since 2000 ...
See :
http://communities.bmc.com/communities/thread/14530
-- Geert
Strange ...
Just to help us move forward on this, could you remove the timestamp from the set instruction (for now) ?
Also after you set the paramter - looks like you are doing it from another parameter - just do the following :
<br/>set("../LOGAlarms/value", errdisp ); <br/>parampath = "/".get("../../name")."/".get("../sid")."/LOGAlarms/value";<br/>print("TESTING print(get(".parampath.")); = ".get(parampath)."\n");<br/>
Now see what get's printed in the SOW and try the same get from %PSL
Let us know what happens.
-- Geert
The set command doesn't contain a time stamp the text from the log file does. The unique was just to remove redundant lines of the same error from the text file. Yes your right that the parameter is set in a different parameter, kind of. I am setting the parameter from a collector and attempting to retreive it's contents from the Notification area of Event Catalog 11 to send on to our SNMP management system. Here is the output.
OUTPUT WITH YOUR CODE IN THE COLLECTOR:
20030226093102 TESTING print(get(/BIRCH_LOGMON/test_log/LOGAlarms/value)); = *************************************************************************************
20030226093102 *** New text between Wed Feb 26 09:21:16 2003 and Wed Feb 26 09:22:16 2003
20030226093102 *** Template: anytext
20030226093102 *** Alarm Level : 6
20030226093102 *************************************************************************************
20030226093102 This is a test message written to the log.
OUTPUT WITH YOUR CODE IN NOTIFICATION OF SEC 11
20030226093102 TESTING print(get(/kcbmcd01/kcbmcd01/LOGAlarms/value)); =
I am really confused now
Your original post shows that you are using three arguments for the set(). The third argument is meant to be a timestamp. You then indicated that the 3rd argument was a timestamp, and now you indicate that it is not? What is it? If the third argument to set() is not a timestamp I suspect that is causing the problem.
Let's copy this in your even notification action for event 11.
I think that will explain what you have to use to get the data you want ...
<br/><br/># Retrieve event information in a "safe" way<br/>evstatus = <<<END_OF_TEXT<br/>%{EV_STATUS} <br/>END_OF_TEXT;<br/><br/>thetime = <<<END_OF_TEXT<br/>%{EV_TIME} <br/>END_OF_TEXT; <br/><br/>type = <<<END_OF_TEXT<br/>%{EV_TYPE} <br/>END_OF_TEXT; <br/><br/>node = <<<END_OF_TEXT<br/>%{EV_NODE} <br/>END_OF_TEXT; <br/><br/>origin = <<<END_OF_TEXT<br/>%{EV_ORIGIN} <br/>END_OF_TEXT; <br/><br/>desc = <<<END_OF_TEXT<br/>%{EV_DESC} <br/>END_OF_TEXT; <br/><br/>args = <<<END_OF_TEXT<br/>%{EV_ARGS} <br/>END_OF_TEXT; <br/><br/>name = <<<END_OF_TEXT <br/>%{EV_NAME} <br/>END_OF_TEXT; <br/><br/>severity = <<<END_OF_TEXT<br/>%{EV_NSEVERITY}<br/>END_OF_TEXT;<br/><br/># Extract the additional information from the event <br/>alm_range = nthargf(args,1,"\t");<br/>arg2 = nthargf(args,2,"\t");<br/>arg3 = nthargf(args,3,"\t");<br/>arg4 = nthargf(args,4,"\t");<br/>alm_min = nthargf(args,5,"\t");<br/>evvalue = nthargf(args,6,"\t");<br/>alm_max = nthargf(args,7,"\t");<br/><br/>appl = nthargf(arg4,1,".");<br/>inst = nthargf(arg4,"2-",".",".");<br/>parm = arg3;<br/><br/>global = (arg2 == "global");<br/>parampath = sprintf("/%s/%s/%s",appl,inst,parm);<br/>paramstatus = get(parampath."/status");<br/>value = get(parampath."/value");<br/><br/># Show some information about this event<br/>data=sprintf("ORIGIN=%s\n".<br/> "NAME=%s\n".<br/> "NODE=%s\n".<br/> "TYPE=%s\n".<br/> "TIME=%s\n".<br/> "SEVERITY=%s\n".<br/> "ALARM_RANGE#=%s\n".<br/> "ALARM_RANGE_DEFINITION=[%s,%s]\n".<br/> "PARAM STATUS=%s\n".<br/> "EVENT STATUS=%s\n".<br/> "NAMESPACE VALUE=%s\n".<br/> "VALUE IN EVENT=%s\n".<br/> "APPLICATION=%s\n".<br/> "INSTANCE=%s\n".<br/> "PARAMETER=%s\n".<br/> "PARAMETER_IS_GLOBAL=%s\n".<br/> "DESCRIPTION=%s\n",<br/> origin,<br/> name,<br/> node,<br/> type,<br/> thetime,<br/> severity,<br/> alm_range,<br/> alm_min,alm_max,<br/> paramstatus,<br/> evstatus,<br/> value,<br/> evvalue,<br/> appl,<br/> inst,<br/> parm,<br/> global,<br/> desc<br/> );<br/> <br/>print(data."\n");<br/><br/>print("get(\"".parampath."/value\"); = ".value."\n");<br/><br/>
-- Geert
OK Mike, the unique(matchedline) is condensing multiple instances of the same line from a text file into one. Yes, those lines contain a time stamp. As you can see in my latest example I am able to extract the data from the parameter when in the collector. So don't focus on the set() command because it is working, the data is in the text parameter LogAlarms. The issue is, why can't I pull the data from LogAlarms when in Standard Event Catalog 11.
Rob