Get interface speed in Threshold Script ?

Started by ntnam, August 22, 2019, 11:31:45 AM

Previous topic - Next topic

ntnam

I monitor traffic in Data Collection Configuration

Description: {instance-name} - Traffic Out (bits/s)
Parameter : .1.3.6.1.2.1.31.1.1.1.10.{instance}
Origin: SNMP - Unsigned Integer 64bit
Transformation :  Average delta per second
Transformation script: $1 * 8
Instance Discovery : SNMP Walk - OIDs
Base SNMP OID: .1.3.6.1.2.1.31.1.1.1.1

It's work ok.
I need add event when percent bandwidth reach.
I create Threshold script below but the "{instance}" seem to fail.


$ifo = GetInterfaceObject($node, {instance});
$speed = $ifo->speed;
if ($1/$speed*100 > $2)
  return true;
else
  return false;


How can i get {instance} value? or get interface speed from variables $dci, $node, $object?

Victor Kirhenshtein

In NXSL script you can use $dci->instance (or $dci->instanceData depending on your configuration) to get instance value.

Best regards,
Victor

ntnam

Thanks you.
I replace {instance} by $dci->instanceData is ok.