Instance Discovery Filter Script [SOLVED]
-
-
-
-
hi..,
i didn't change anything in delta calculation but a little change in this Script.
snmp = CreateSNMPTransport($node);
x = SNMPGetValue(snmp, ".1.3.6.1.2.1.2.2.1.16." . $1);
if (x != null) return x; // you gave me like this return (x > 0 );
else return 0;i am also confused how it started collecting data. due to that change in the script or happened automatically. but still there is 0 value for the other interfaces (10,2.33) strange why it gives for 1,9 did you notice this in screenshots.
thank you,
Percy -
@victor said in Instance Discovery Filter Script [SOLVED]:
Hi!
You actually thinking in right direction - you can use SNMPGet function to read value of each instance and determine to include it or not. Below is a working example of such approach. I use OID .1.3.6.1.2.1.2.2.1.16 (ifOutOctets) as a base. I use
Port traffic: {instance}
as description and
.1.3.6.1.2.1.2.2.1.16.{instance}
as parameter name. Correct parameter name is important, because {instance} will be the part after base OID you configure on instance discovery page, not the full OID.
Then, on instance discovery page, I set discovery method to "SNMP Walk - OIDs", set base OID to .1.3.6.1.2.1.2.2.1.16, and use the following filtering script:
snmp = CreateSNMPTransport($node);
return SNMPGetValue(snmp, ".1.3.6.1.2.1.2.2.1.16." . $1) != 0;Now just close data collection configuration for the node and run configuration poll. You should get DCIs for all OIDs with non-zero value.
Best regards,
Victor@victor said in Instance Discovery Filter Script [SOLVED]:
This filtering script checks that absolute value for given OID is 0. If you have non-zero value which is not changing over time, OID will pass filter but you will still get 0 as delta value.
So I changed from delta value to original value and i'm still getting 0 values. Absolute values all are 0s (checked with snmpwalk).
Where is the problem?
Configuration is the same, except oid is now .1.3.6.1.2.1.31.1.1.1.3. (CRCAlignErrors) where all values are 0:@nikk said in Instance Discovery Filter Script [SOLVED]:
My parameter is: .1.3.6.1.2.1.31.1.1.1.10.{instance}
and in Instance tab:
SNMP Walk - OID's
.1.3.6.1.2.1.31.1.1.1.10and script:
snmp = CreateSNMPTransport($node);
return SNMPGetValue(snmp, ".1.3.6.1.2.1.31.1.1.1.10." . $1) != 0; -
Check that you really get the value with SNMPGetValue - it will return null if SNMP query fails for some reason, and null != 0, so instance that cannot be read will be accepted.
Best regards,
Victor -
-
Hi,
!= null should work. Can you show full script please?
Best regards,
Victor -
-
-
Hi!
Condition (value != null || value != 0) is always true - if value is null then it will not be 0, and vise versa. Correct condition will be (value != null && value != 0), so full script could look like this:
snmp = CreateSNMPTransport($node); value = SNMPGetValue(snmp, ".1.3.6.1.2.1.16.1.1.1.3." . $1); return (value != null) && (value != 0);you are right, returning 0 is the same as returning false.
Best regards,
Victor -
-
The filter discussed above is for the instanced DCIs, right ?
At the time of applying of the DCI it checks if there are values (non-zero and non-null) and creates real DCI for that one OID.Where exactly are you getting those 0 values ?
If there are semi-stable values in the OIDs and DCIs are created at that time, these will exist even if OID return 0 afterwards... Check history of the DCIs which are showing 0 now.
You can also check snmpwalk if the 0 value is correct or not.
-
-
When you remove those DCIs with zero values manually, they pop back up ?
If not, it must have been something while creating the DCI (mind that whenever you open or modify the DCI it reapplies).
If these return after modyfying/opening the root DCI, there is something in it.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login



