using DCI attributes within transformation script
-
Hello together,
is there a way to use attributes of the current DCI within a transformationscript?
For example getting the name-attribute and building out of this an oid with an value that was requested in an other DCI.
Best regards
Georg
-
$1 - current value (last polled)
if you want use another dci in curent dci see this http://wiki.netxms.org/wiki/NXSL_Function_Reference#Data_Collection -
Sorry but I hove to clarify the question. I want to do the following with the Transformatinscript of the DCI
I have an DCI with parameter:
.1.3.6.1.2.1.31.1.1.1.10.10201
from that parameter/name I want to build the parameter
.1.3.6.1.2.1.2.2.1.5.10201
to find the corresponding DCI by GetDCIValueByName that has requested the interface speed.
With this information I want to calculate the percentage value for the usage of the interface within the transformormationscript. -
mmm?
sub main() { if ($node->isSNMP) { transport = CreateSNMPTransport($node); if (transport == null) { return -1; } ifspeed = SNMPGetValue(transport, ".1.3.6.1.2.1.2.2.1.5.10201"); // get if speed if (ifspeed != null) { //you can use "case/switch" if have y have many params if (ifspeed == "blablabla") //change blabla bla string. see mib, i don't know how it on cisco { return (($1*8)/(1 << 20)); //transform bytes to megabites } else { return $1; //return default value } } } } -
Not really what I want to do.
Within transformationscript some pseudocode now
sub main()
{
pos = rindex(trim($dci->name),".");
len = length(trim($dci->name)) - pos;
port = right($dci->name,len);
snmpoid = ".1.3.6.1.2.1.2.2.1.5.".port;
speed = GetDCIValueByName($node,snmpoid);
result = (($1*8)*100)/speed;
return result;
}the meaning of $dci in this example would be the same as with $node refering to the current DCI.
-
@gkaudewitz said in using DCI attributes within transformation script:
Not really what I want to do.
Within transformationscript some pseudocode now
sub main()
{
pos = rindex(trim($dci->name),".");
len = length(trim($dci->name)) - pos;
port = right($dci->name,len);
snmpoid = ".1.3.6.1.2.1.2.2.1.5.".port;
speed = GetDCIValueByName($node,snmpoid);
result = (($1*8)*100)/speed;
return result;
}the meaning of $dci in this example would be the same as with $node refering to the current DCI.
$dci object added in 1.2.4 dev version
how get snmp y see in my script.
i'm recomend write script in script library and using functions with "use" operator. -
Now we have same understanding of my problem.
Thanks for the information concerning $dci.
This will simplify the tasks concerning calculation of values for me. Because I don't want generating an extra snmprequest each time the octet-value is requested.Thanks for the help!
-
@gkaudewitz said in using DCI attributes within transformation script:
Now we have same understanding of my problem.
Thanks for the information concerning $dci.
This will simplify the tasks concerning calculation of values for me. Because I don't want generating an extra snmprequest each time the octet-value is requested.Thanks for the help!
if portspeed is constant you can write array with each port information in the script.
-
Is the $dci object added in final version of 1.2.4?
-
Yes, it is available in 1.2.4.
Best regards,
Victor -
@gkaudewitz said in using DCI attributes within transformation script:
Is the $dci object added in final version of 1.2.4?
and in 1.2.4 added multipliers for charts.
and y need only transform bytes to bites
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