This could be done with transformation scripts on a number of SNMP DCIs, but this is not convenient to manage, as transformation script on each of these DCis would be different.
A cleaner approach would be to use script DCIs. In script library create a script, named e.g. getPduMetric with the following contents:
Then create a DCI on the node, origin should be Script. In the metric field we have name of the script with it's parameters:
getPduMetric(.1.3.6.1.2.1.1.1.0, activePower)
Script accepts two parameters - OID and variable name. This way you can have just one script and define everything in metric of your DCIs.
A cleaner approach would be to use script DCIs. In script library create a script, named e.g. getPduMetric with the following contents:
Code Select
function main(oid, name) {
transport = $node->createSNMPTransport();
if (transport == null) return null;
v = transport->getValue(oid);
h = %{};
for (a : v->split(",")) {
b = a->split("=");
if (b->size == 2) h[b] = b[1];
}
return h[name];
}Then create a DCI on the node, origin should be Script. In the metric field we have name of the script with it's parameters:
getPduMetric(.1.3.6.1.2.1.1.1.0, activePower)
Script accepts two parameters - OID and variable name. This way you can have just one script and define everything in metric of your DCIs.