NetXMS Support Forum

English Support => General Support => Topic started by: rhodri on December 29, 2024, 12:27:29 PM

Title: Instance Discovery Filter Script - and display name
Post by: rhodri on December 29, 2024, 12:27:29 PM
hi guys and girls,
bit of a question I have about setting the display name based of another SNMP query the data is as follows 

1.3.6.1.4.1.14988.1.1.19.1.1.2.11 [STRING] = sfp11
1.3.6.1.4.1.14988.1.1.19.1.1.2.12 [STRING] = sfp12
1.3.6.1.4.1.14988.1.1.19.1.1.3.11 [INTEGER] = 0
1.3.6.1.4.1.14988.1.1.19.1.1.3.12 [INTEGER] = 1
1.3.6.1.4.1.14988.1.1.19.1.1.4.11 [INTEGER] = 0
1.3.6.1.4.1.14988.1.1.19.1.1.4.12 [INTEGER] = 0
1.3.6.1.4.1.14988.1.1.19.1.1.5.11 [GAUGE32] = 131000
1.3.6.1.4.1.14988.1.1.19.1.1.5.12 [GAUGE32] = 85000
1.3.6.1.4.1.14988.1.1.19.1.1.6.11 [GAUGE32] = 30
1.3.6.1.4.1.14988.1.1.19.1.1.6.12 [GAUGE32] = 41
1.3.6.1.4.1.14988.1.1.19.1.1.7.11 [GAUGE32] = 3290
1.3.6.1.4.1.14988.1.1.19.1.1.7.12 [GAUGE32] = 3256
1.3.6.1.4.1.14988.1.1.19.1.1.8.11 [GAUGE32] = 17
1.3.6.1.4.1.14988.1.1.19.1.1.8.12 [GAUGE32] = 4
1.3.6.1.4.1.14988.1.1.19.1.1.9.11 [INTEGER] = -5468
1.3.6.1.4.1.14988.1.1.19.1.1.9.12 [INTEGER] = -6800
1.3.6.1.4.1.14988.1.1.19.1.1.10.11 [INTEGER] = -1407
1.3.6.1.4.1.14988.1.1.19.1.1.10.12 [INTEGER] = 0

I have tried this to get something but all I get is an error: Minor netxms1 SYS_SCRIPT_ERROR Script (DCI::TheDevice::8963::InstanceFilter) execution error: Error 15 in line 1: Unknown object's attribute 
dd = $node.createSNMPTransport()?.getValue(".1.3.6.1.4.1.14988.1.1.19.1.1.2.".$1);
if(dd!=NULL) {
return [true, $1, dd];
}

return [true, $1, $1];

if I try getting the data via a seperate script and replace $node with the device it works any help would be great im new to Netxms and Scripting.

Thanks 
Rhodri

Title: Re: Instance Discovery Filter Script - and display name
Post by: rhodri on December 30, 2024, 12:23:45 AM
right after a bit of digging and feeling like a total tit.. 

It turns out I was missing a . from the Concatenation operator simple mistake so this now seems to work

getoid = ".1.3.6.1.4.1.14988.1.1.19.1.1.2.";
instance = $1;
walk = $node.createSNMPTransport()?.getValue(getoid .. instance);
if(walk == NULL) {
walk = $1;
}
return [true, instance, walk];


and this now effects the {instance-name} as intended.

hope it helps someone in the future!