Unsolved
This post is more than 5 years old
20 Posts
0
1263
June 4th, 2009 05:00
ASL filter question
Hi,
I am pulling out the Description via ASL and want to only print data using comma's as the FS.
How do a go about doing this, I have tried substring but it is not working as expects, I am looking for an awk type print statement
example:
awk -F"," {print $1" "$2}'
ASL code I am using:
START {
}
do {
// get list of all nodes
//
nodes = getInstances("ICIM_UnitaryComputerSystem");
//
// go through list of nodes
//
foreach node ( nodes ) {
or = object(node);
de = or->DiscoveryErrorInfo?IGNORE;
model = or->Model?IGNORE;
desc = or->Description?IGNORE;
newdesc = substring(desc,33,43);
if ( glob( 'SWFE-E-ELOOP-Agent*', de) ) {
print(node." ".model." ".newdesc);
}
}
//
stop();
//
}
Kind Regards
J
I am pulling out the Description via ASL and want to only print data using comma's as the FS.
How do a go about doing this, I have tried substring but it is not working as expects, I am looking for an awk type print statement
example:
awk -F"," {print $1" "$2}'
ASL code I am using:
START {
}
do {
// get list of all nodes
//
nodes = getInstances("ICIM_UnitaryComputerSystem");
//
// go through list of nodes
//
foreach node ( nodes ) {
or = object(node);
de = or->DiscoveryErrorInfo?IGNORE;
model = or->Model?IGNORE;
desc = or->Description?IGNORE;
newdesc = substring(desc,33,43);
if ( glob( 'SWFE-E-ELOOP-Agent*', de) ) {
print(node." ".model." ".newdesc);
}
}
//
stop();
//
}
Kind Regards
J
No Events found!
savuka1
20 Posts
0
June 4th, 2009 06:00
RAW Data:
test.uk.com 2801 Cisco IOS Software, 2800 Software (C2800NM-IPBASEK9-M), Version 12.4(8c), RELEASE SOFTWARE (fc3)\X0D\X0ATechnical Support: http://www.cisco.com/techsupport\X0D\X0ACopyright (c) 1986-2006 by Cisco Systems, Inc.\X0D\X0ACompiled Mon 11-Dec-06 22:06 by prod_rel_team
Required format:
test.uk.com 2801 Version 12.4(8c)
So I want to split the 3 data field using comma's so I only print out the version of IOS.
Kind Regards
J
FredericMeunier_0588be
143 Posts
0
June 4th, 2009 06:00
can you be a little more specific, I'm not sure to understand what you want to achieve. Give us a sample of an entry and how you want to process it.
Thanks,
--Fred
Hemulll
2 Intern
•
138 Posts
0
June 4th, 2009 07:00
START {
}
do {
// get list of all nodes
//
nodes = getInstances("ICIM_UnitaryComputerSystem");
//
// go through list of nodes
//
foreach node ( nodes ) {
or = object(node);
de = or->DiscoveryErrorInfo?IGNORE;
model = or->Model?IGNORE;
desc = or->Description?IGNORE;
//newdesc = substring(desc,33,43);
xDescr = CONC(desc );
if ( glob( 'SWFE-E-ELOOP-Agent*', de) ) {
print(node." ".model." ".xDescr );
}
}
//
stop();
//
}
CONC(data) {
input = data;
delimiter = ",";
one:word Cisco .. fs .. fs two:word fs eol
}
do {
newDescr = one.two;
return newDescr;
}
Sorry, but have no time for test it.
savuka1
20 Posts
0
June 4th, 2009 07:00
Would that work for the ASL code I used above, I am not using an input file , I am querying the topology and then want to format the data.
Kind Regards
J
Hemulll
2 Intern
•
138 Posts
0
June 4th, 2009 07:00
START {
}
do {
// get list of all nodes
//
nodes = getInstances("ICIM_UnitaryComputerSystem");
//
// go through list of nodes
//
foreach node ( nodes ) {
or = object(node);
de = or->DiscoveryErrorInfo?IGNORE;
model = or->Model?IGNORE;
desc = or->Description?IGNORE;
//newdesc = substring(desc,33,43);
xDescr = CONC(desc );
if ( glob( 'SWFE-E-ELOOP-Agent*', de) ) {
print(node." ".model." ".xDescr );
}
}
//
stop();
//
}
CONC(data) {
input = data;
delimiter = ",";
one:word Cisco .. fs .. fs two:word fs .. eol
}
do {
newDescr = one.two;
return newDescr;
}
Sorry, but have no time for test it.
Hemulll
2 Intern
•
138 Posts
0
June 4th, 2009 07:00
CONC(data) {
input = data;
delimiter = ",";
one:word Cisco .. fs .. fs two:word fs eol
}
do {
newDescr = one.two;
return newDescr;
}
Not tested
Christian4
30 Posts
0
June 5th, 2009 06:00
GET_VERSION(descr) {
local outList = list();
input = descr;
do{}
rep( aInfo:{rep(notany(","))?} ","
do {
outList += aInfo;
}
)
}do{
return outList[2];
}
Regards,
Christian
savuka1
20 Posts
0
June 8th, 2009 02:00
How do you call this function as I have tried that code and have searched the ASL scripting guide and cannot find an example of how to call that function on a list of devices.
Kind Regards
J
mikesolec
13 Posts
0
June 16th, 2011 23:00
Hi Guys,
I need help on the syslog adapter my hook script, i am putting this entries and im getting a syntax error, got it from the thread
https://community.emc.com/message/550910
My goal is also to get the severity of the Cisco syslogs that extracts betwwen the "-" in any order. DO you have a sample hook script and syslog mgr asl that i can look at? thanks
*May 1 22:12:13.243: %SEC-6-IPACCESSLOGP:
LEVELS {
input=MESSAGE;
pre:rep(notany("-")) "-"
levels:integer ..eol
} do {
return levels;
}
And for setting the severity:
CUSTOM_RULE {
unusedPrefix:rep(notany(":")) ":" /* consume chars up to : */
msgDescription:rep(word) eol
} do {
sysloglevel = LEVELS();
if (sysloglevel == "1") {
SEVERITY = "1";
} else if (sysloglevel == "2") {
SEVERITY = "1";
} else if (sysloglevel == "3") {
SEVERITY = "2";
} else if (sysloglevel == "4") {
SEVERITY = "3";
} else if (sysloglevel == "5") {
SEVERITY = "5";
} else if (sysloglevel == "6") {
SEVERITY = "5";
} else if (sysloglevel == "7") {
SEVERITY = "5";
}
if (debug) { print(time().ASLNAME."Executing CUSTOM_RULE");}
}