[INUG-Users] Regular Expression Query?
Greg Hubbard
glh.forums at gmail.com
Wed Dec 9 10:54:13 EST 2009
Does your lookup table have a default return value that you can use to mean
"not found" -- I did not see that. Is that the value "2"?
Keep in mind that if an address field has any leading or trailing spaces it
will cause a simple "match" to fail.
GLH
On Wed, Dec 9, 2009 at 9:46 AM, Kris <krisnaa1980 at gmail.com> wrote:
> Hi All,
>
> I have the following below code that checks for Link Down alarms. As the
> customer is not interested in receiving Link Down alarms from specific IP
> Addresses, i have specified all of them in a lookup table in the below
> format:
>
> table FlagID =
> {
> {"10.200.161.107","1"},
>
>
>
> {"10.200.161.124","1"}
> }
>
> I have new two alarms with Summary that triggered from IP Address
> 10.200.192.79 (this IP does not belong to the lookup table)
>
> 1) Link Down: Lost Carrier ( FastEthernet0 )
> 2) Link Down: Keepalive failed ( FastEthernet0 )
>
> These alarms were shown in Netcool with Severity 1 and also the the alarms
> were not emailed. The condition for emailing is Grade = 51.
>
> Following is the code:
>
> if (match(@AlertGroup, "Generic Link Status")) {
> if (regmatch(@Summary, "^Link.*$")) {
> $flaglinkid = lookup($IPaddress,FlagID)
> details($ifDescr,$flaglinkid)
> if (match($flaglinkid, "1")) {
> @Grade = 50
> @Severity = 4
> } else if (match($flaglinkid, "2")) {
> if (match($IPaddress, "10.200.163.117") &&
> regmatch(@Summary, "^Link Down.*Serial.*$")) {
> details($ifDescr,$flaglinkid)
> switch($ifDescr) {
> case "Serial3/0:15" | "Serial3/1:15"
> | "Serial3/2:15" | "Serial3/3:15":
> @Grade = 51
> @Severity = 5
> default:
> discard
> }
> }
>
> if (match($IPaddress, "10.200.163.117") &&
> regmatch(@Summary, "Link Up.*Serial.*$")) {
> details($ifDescr,$flaglinkid)
> switch($ifDescr) {
> case "Serial3/0:15" | "Serial3/1:15"
> | "Serial3/2:15" | "Serial3/3:15":
> @Grade = 51
> @Severity = 1
> default:
> discard
> }
> }
> } else {
> @Severity = 4
> @Grade = 51
> }
> }
> }
>
> Not sure why this alarm is showing with Severity 1. As per the code it
> should fall under this category:
>
> } else {
> @Severity = 4
> @Grade = 51
> } But this is not happening, link down alarms are showing with Severity 1
> after deploying the above code.
>
> Any help is appreciated.
>
> Regards,
> Kris
> _______________________________________________
> Sent by the netcoolusers.org "users" mailing list
> Post: users at netcoolusers.org
> Unsubscribe: users-unsubscribe at netcoolusers.org
> Search: http://netcoolusers.org/Search
>
--
Disclaimer: 1) all opinions are my own, 2) I may be completely wrong, 3) my
advice is worth at least as much as what you are paying for it, or your
money cheerfully refunded.
More information about the Users
mailing list