transformation

Started by lindeamon, August 16, 2011, 12:16:42 PM

Previous topic - Next topic

lindeamon

hi,

i have configured a dci to show me the system and agent uptime and when i look at the dci values i see the number of seconds and the only thing i can do is to display it as multiplier.
i want to view it in days and hours format and came across a function called secondstouptime and i tried to use it but no luck.
what is the right way to get what i want ?

10x,
lindeamon

Victor Kirhenshtein

Hi!

SecondsToUptime should do the work. Don't forget that function names are case-sensitive, and don't forget to change DCI type to String. You transformation script may looks like following:


SecondsToUptime($1)


or


return SecondsToUptime($1);


Best regards,
Victor

lindeamon

hi victor,

u r the man.it worked like a charm,pitty this things do not appear on the user manual.
another thing regarding this solution:
i have configured a dci to find uptime through snmp and in the autoapply it told it to apply it on node that have snmp and do not have an agent.what i want to know is,once a node was applyed with this dci and i install an agent on it,will the template be automatically unbind ? if not,what is the right way do unbind it automatically ?

10x
lindeamon

Victor Kirhenshtein

Quote from: lindeamon on August 17, 2011, 09:28:23 AM
another thing regarding this solution:
i have configured a dci to find uptime through snmp and in the autoapply it told it to apply it on node that have snmp and do not have an agent.what i want to know is,once a node was applyed with this dci and i install an agent on it,will the template be automatically unbind ? if not,what is the right way do unbind it automatically ?

It all depends on your auto apply script. Template is applied when script returns true, and removed when script return false. So, if you wish template to be applied only on nodes with SNMP, but without NetXMS agent, and remoed from SNMP-only node when NetXMS agent installed on it, your auto apply script should looks like following:


return $node->isSNMP && !$node->isAgent;


Best regards,
Victor

lindeamon

thank you very much victor.