RAM percentage?
-
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

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 -
-
Some additional info can be found in this thread: 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")) * 100Best 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 valueYour codE: $1 / GetDCIValue($node, FindDCIByName($node, "System.Memory.Physical.Total")) * 100 :
Gives the normal valueWhat 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")) * 100Currently NetXMS will leave original value if transformation script fails - not a correct behaviour probably.
Best regards,
Victor -
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