Instance Discovery Filter Script adding "{alias}"

Started by anw, April 19, 2016, 08:32:00 PM

Previous topic - Next topic

anw

Hey

if found this solution for automation and filtering of dcis for my switches:
Description: Traffic, IN {instance-name}
Instance Discovery
Snmpwalk OID
Base OID
.1.3.6.1.2.1.31.1.1.1.1
filtering script
snmp = CreateSNMPTransport($node);
/* nur wenn PortSpeed > 0 */
x = SNMPGetValue(snmp, ".1.3.6.1.2.1.2.2.1.5.".$1);
y = SNMPGetValue(snmp, ".1.3.6.1.2.1.31.1.1.1.17.".$1);
if (x>0 && y!=2) return 1;
else return 0;




I would like to integrate the alias/port description in the description part
so the ouput would be

Description: Traffic {alias}, IN {instance-name}



how could i do this ?

regards

Victor Kirhenshtein

Hi,

you cannot add another placeholder, but you can concatenate anything you need into {instance-name} in filter script. For example, to add prefix "instance" to every instance name return from script as following:

return %(true, $1, "instance: " . $1);

first element is acceptance indicator, second is instance ({instance} will be replaced by it), third is instance name. There should be examples on the forum for filtering scripts used to return meaningful interface names in {instance-name}.

Best regards,
Victor


anw

ok thanks, but i wouldnt like to add a prefix - i would like to add the port description. not sure how to do it

Victor Kirhenshtein

You can read it from interface object (you can find one using GetInterfaceObject function), or directly from device via SNMP or agent (there are functions for direct SNMP or agent access).

Best regards,
Victor

Whiteotlc

Quote from: Victor Kirhenshtein on April 21, 2016, 04:32:24 PM
Hi,

you cannot add another placeholder, but you can concatenate anything you need into {instance-name} in filter script. For example, to add prefix "instance" to every instance name return from script as following:

return %(true, $1, "instance: " . $1);

first element is acceptance indicator, second is instance ({instance} will be replaced by it), third is instance name. There should be examples on the forum for filtering scripts used to return meaningful interface names in {instance-name}.

Best regards,
Victor

thank you so much for very helpful post. i will definitely take a note on everything you say because for sure it will resolve my problem as well in filter script adding. thanks!