<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Transformation: Add previous DCI value to current DCI value?]]></title><description><![CDATA[<p dir="auto">I'm trying to create a usage graph in netXMS and having trouble with the formulas to do so</p>
<p dir="auto">At the moment i'm polling an interface for the traffic, then using simple delta transformation with "return max($1, 0);" (to avoid negative numbers if i.e. router restarts)<br />
What I need now is a way to read the last dci value and add it to the current result, so that it continually increments</p>
<p dir="auto">i.e. currently it returns<br />
6pm - 53mb<br />
(router restarts)<br />
7pm - 0mb<br />
8pm - 155mb<br />
9pm - 110mb</p>
<p dir="auto">I need to add each previous value together so that it shows a running total<br />
i.e.<br />
6pm - 53mb<br />
7pm - (0mb + 53mb) = 53mb<br />
8pm - (53mb + 155mb) = 208mb<br />
9pm - (208mb + 110mb) = 318mb</p>
]]></description><link>https://forum.netxms.org/topic/5553/transformation-add-previous-dci-value-to-current-dci-value</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:40:37 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5553.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Apr 2018 01:38:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Fri, 04 May 2018 12:54:01 GMT]]></title><description><![CDATA[<p dir="auto">Delta calculation for tables is not implemented yet.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/24218</link><guid isPermaLink="true">https://forum.netxms.org/post/24218</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 04 May 2018 12:54:01 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Fri, 04 May 2018 00:54:50 GMT]]></title><description><![CDATA[<p dir="auto">Ok next question</p>
<p dir="auto">I was considering creating a table instead of lots of individual DCI's. That way I can have daily/weekly/monthly usage as well as other information like number of reconnects etc all on a single line for an interface without dozens/hundreds of DCI entries</p>
<p dir="auto">Is it possible to do simple delta calculation in table columns yet? I can't see a drop down option for it, can I do it manually somehow?</p>
]]></description><link>https://forum.netxms.org/post/24217</link><guid isPermaLink="true">https://forum.netxms.org/post/24217</guid><dc:creator><![CDATA[Millenium7]]></dc:creator><pubDate>Fri, 04 May 2018 00:54:50 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Wed, 02 May 2018 18:10:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">it is not possible to delete data from within script. Reset to 0 will work (you can check current date and time in script and return 0 if it is first poll after midnight).</p>
<p dir="auto">Another possible option is to create two DCIs - one short term and one long term. Long term DCI will have custom schedule to collect it once per day/week/month/etc. and it will get get sum of values from short term DCI for required period. Retention time for short term DCI can be set to desired time interval plus some extra time to allow long term DCI collector script to run.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/24204</link><guid isPermaLink="true">https://forum.netxms.org/post/24204</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 02 May 2018 18:10:16 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Tue, 01 May 2018 02:04:47 GMT]]></title><description><![CDATA[<p dir="auto">Ok I found reference that there's a bug with read access from a forum post back in 2014</p>
<p dir="auto"><a href="https://www.netxms.org/forum/general-support/transformation-script-and-$dci-object/" rel="nofollow ugc">https://www.netxms.org/forum/general-support/transformation-script-and-$dci-object/</a></p>
<p dir="auto">It seems that bug is still present, test will show an error but $dci-&gt;id does work when actually polling the DCI. So this is what I have come up with so far</p>
<pre><code>t = GetDCIValue($node,$dci-&gt;id);
if (t != null)
return t + $1;
else
return $1 - $1;
</code></pre>
<p dir="auto">Transformation set to simple delta. The first result will always return 0, after that it counts up usage continuously</p>
<p dir="auto">The next question is then how do I handle resetting the value back to 0 after a day/week/month?<br />
Is there a scripting command to clear all old data? Then I can simply add some code to check the date/time and clear the values accordingly<br />
Alternatively I could do the same but manually reset the value to 0 which would work fine I suppose. The graph would show a saw-tooth pattern over time<br />
The ultimate solution would be to sum all previous DCI values between the last '0', delete all those entries and replace it with a single sum entry. That would drastically reduce the amount of stored data and let me see a single spike per day/week/month on a history graph separated by a single 0 entry</p>
]]></description><link>https://forum.netxms.org/post/24201</link><guid isPermaLink="true">https://forum.netxms.org/post/24201</guid><dc:creator><![CDATA[Millenium7]]></dc:creator><pubDate>Tue, 01 May 2018 02:04:47 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Tue, 01 May 2018 01:00:11 GMT]]></title><description><![CDATA[<p dir="auto">I think that will do it. I've tested with<br />
t = GetDCIValue($node,8347);<br />
return t;</p>
<p dir="auto">And it does return the previous value. But i'm having trouble with the syntax for the DCI id (since I dont want to type it in manually)<br />
I've tried<br />
t = GetDCIValue($node,$dci-&gt;id);<br />
return t;</p>
<p dir="auto">And its giving my an error. I can't find the syntax I need to return the ID number of the current DCI</p>
<p dir="auto">While i'm at it, is there a better way for troubleshooting and finding out the correct syntax? I struggle with this all the time because its very difficult to know if i'm typing syntax correctly, or wht values are being returned. Is there a console I can open and type these sorts of commands in and get some realtime help on syntax and output, similar to a SSH terminal i.e. type GetDCI&lt;tab&gt; and it will me all the available commands. As well as manually type those in i.e. "echo GetDCIValue(230,123)" and see the output</p>
]]></description><link>https://forum.netxms.org/post/24200</link><guid isPermaLink="true">https://forum.netxms.org/post/24200</guid><dc:creator><![CDATA[Millenium7]]></dc:creator><pubDate>Tue, 01 May 2018 01:00:11 GMT</pubDate></item><item><title><![CDATA[Reply to Transformation: Add previous DCI value to current DCI value? on Mon, 30 Apr 2018 09:36:46 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://wiki.netxms.org/wiki/NXSL:GetDCIValue" rel="nofollow ugc">https://wiki.netxms.org/wiki/NXSL:GetDCIValue</a> might work.<br />
As you are in the transform stage, the value that you just collected can't be returned as a result yet, which means it should return the previous one?</p>
]]></description><link>https://forum.netxms.org/post/24196</link><guid isPermaLink="true">https://forum.netxms.org/post/24196</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Mon, 30 Apr 2018 09:36:46 GMT</pubDate></item></channel></rss>