Hi
I'm trying to calculate the percentage of free ram using the NetXMS agent.
The system has 520093696 bytes of ram.
So I did this:
1)Went to transformation TAB of DCI
2)Put in the following calculation: ($1 / 520093696) * 100
3)Set delta processing to: Keep original value.
This is the first time I've used this feature so talk slowly :D
Thanks in advance.
Hello!
Looks correct. Do you have any problems with it? Also, since version 0.2.20 you can collect total amount of RAM as separate DCI and use it's value in calculation instead of hardcoded value.
Best regards,
Victor
It does nothing with my calculation, just keeps giving the numer in Mbytes ???
Your idea sounds better, how would I do this? I haven't done this before so can you give me an example of how you would do this?
Thanks as always!
Some additional info can be found in this thread: https://www.netxms.org/forum/index.php/topic,289.0.html (https://www.netxms.org/forum/index.php/topic,289.0.html).
Assuming that you have DCI for parameter System.Memory.Physical.Total, your transformation script may look like this:
sub main()
{
total = GetDCIValue($node, FindDCIByName($node, "System.Memory.Physical.Total"));
return $1 / total * 100;
}
or simplified to
$1 / GetDCIValue($node, FindDCIByName($node, "System.Memory.Physical.Total")) * 100
Best regards,
Victor
I don't know why but your scripts aren't working either.
It looks like whatever I put as transformation script with "no delta processing", does absolutely nothing :(
Hardcoded: ($1 / 520093696) * 100:
Gives the normal value
Your codE: $1 / GetDCIValue($node, FindDCIByName($node, "System.Memory.Physical.Total")) * 100 :
Gives the normal value
What could be causing this, am I doing something wrong?
It' because DCI data type is unsigned int64, and automatic conversion from it to float (real) is not allowed. If you take a look at event log, you most likely will see a lot of SYS_SCRIPT_ERROR events. You have two options: change DCI data type to "float" or "integer", or do an explicit type conversion like this:
int64($1) / GetDCIValue($node, FindDCIByName($node, "System.Memory.Physical.Total")) * 100
Currently NetXMS will leave original value if transformation script fails - not a correct behaviour probably.
Best regards,
Victor
Aaaah I see! Excellent :)
Thanks so much again, nice to have this running.