<?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[Checking if time on different servers is identical]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">It’s easy to collect time on servers individually, but where do I compare the times of the different servers to create an event should they be unequal (within a margin of course)?</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/topic/1383/checking-if-time-on-different-servers-is-identical</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 19:34:04 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/1383.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Sep 2011 04:58:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Checking if time on different servers is identical on Mon, 03 Oct 2011 11:06:13 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">Variable $node is unset in condition scripts, because it's not a node. Currently it's not possible to access condition's custom attributes from script. I'll add some method to access them.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6064</link><guid isPermaLink="true">https://forum.netxms.org/post/6064</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 03 Oct 2011 11:06:13 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Mon, 03 Oct 2011 10:41:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I thought I could avoid examining the log file by adding a a custom attribute on the Condition object and set is within the script</p>
<p dir="auto">The following line:<br />
SetCustomAttribute($node,"MaxTimeDeviation",maxDeviation);<br />
returns the following error:<br />
Failed to execute evaluation script for condition object 1234 "TimeDeviation": Error 14 in line 13: Left argument of -&gt; must be a reference to object</p>
<p dir="auto">Using the following test line gives the same error:<br />
SetCustomAttribute($node,"MaxTimeDeviation","test");</p>
<p dir="auto">What am I doing wrong?</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6062</link><guid isPermaLink="true">https://forum.netxms.org/post/6062</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Mon, 03 Oct 2011 10:41:27 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Sat, 01 Oct 2011 20:38:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">I set the schedule to * * * * * and up to now receive derivation of a second. Having a two second tolerance is more than acceptable in my case.<br />
Your other solution is indeed even better, it’s just that while searching for a solution to the problem at hand I learned an interesting NetXMS feature that will without a doubt serve me in the future. Thanks!</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6051</link><guid isPermaLink="true">https://forum.netxms.org/post/6051</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Sat, 01 Oct 2011 20:38:36 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Sat, 01 Oct 2011 09:15:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">Condition uses last collected value of DCIs - checking condition does not cause DCI poll. You can switch to custom schedule - if you will have schedule like * * * * *, you DCI will be collected at the beginning of each minute. Scheduler check DCI schedules once per 2 second, so you will not be able to achieve better than 2 second accuracy.</p>
<p dir="auto">Converting conditions to something similar to nodes with DCIs makes sense. I'll think about it.</p>
<p dir="auto">Also, I thought about another way of checking server time sync: you can collect server's system time once per minute and compare it with monitoring server's time. To check that monitoring server's time is accurate, you can check ntp status on monitoring server. That way should be easier probably while still accurate.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6046</link><guid isPermaLink="true">https://forum.netxms.org/post/6046</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Sat, 01 Oct 2011 09:15:20 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Sat, 01 Oct 2011 05:13:16 GMT]]></title><description><![CDATA[<p dir="auto">Victor,<br />
I upgraded to 1.1.5, this time with no problems. Great!</p>
<p dir="auto">I set the new syntax for obtaining the values and it works.</p>
<p dir="auto">In my specific case the result is not what I had expected. I use the DCI System.CurrentTime to get the time on several servers, As they’re using NTP their time is within a few milliseconds of each other yet the my script calculates a different deviations each time (up to a minute apart). As the pooling interval of both DCI’s was 60 seconds I guess this has to do with the moment NetXMS grabs the value from each of the servers. This bring me to the question of where is the condition object calculated, is it each time one of the DCI’s in the list of DCI’s of the condition object pool changes?<br />
I changed to pooling interval to 10 seconds and the deviation got to under 10 seconds, I could set is to once every seconds which probably resolve the problem, however it will be using a lot of resources for just knowing if my servers are still in sync.<br />
If I change the pooling to custom schedule, will they be pooled on the same time?</p>
<p dir="auto">Using the condition object for the first time, I’ve noticed it behaves differently than a DCI. Would it not be better to make it closer to a DCI? It retains the “Data tab” where one set the different DCI’s to be used, the “script tab” should allow calculate any type of  value, a “Thresholds tab” where triggers can be set. This will also allow to have historical result with “last value” and the ability to draw graphs (in my case the max deviation of the time on the severs)</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6045</link><guid isPermaLink="true">https://forum.netxms.org/post/6045</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Sat, 01 Oct 2011 05:13:16 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 12:34:18 GMT]]></title><description><![CDATA[<p dir="auto">Victor,</p>
<p dir="auto">I wanted to ask when 1.1.5 will be released, but noticed it was released today (JIT).<br />
I'll upgrade and try again. Thanks.</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6040</link><guid isPermaLink="true">https://forum.netxms.org/post/6040</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Fri, 30 Sep 2011 12:34:18 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 12:21:15 GMT]]></title><description><![CDATA[<p dir="auto">Oops, that's my failure <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--disappointed" style="height:1.4em;width:auto;vertical-align:middle" title=":(" alt="😞" /> Prior to 1.1.5 DCI values only accessible via $1, $2, etc. variables. Array $values also was added in 1.1.5. I suggest to do upgrade first <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6039</link><guid isPermaLink="true">https://forum.netxms.org/post/6039</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 30 Sep 2011 12:21:15 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 12:17:04 GMT]]></title><description><![CDATA[<p dir="auto">Victor</p>
<p dir="auto">My script above was mistyped (sorry), the script on the server has the same text as your suggestion.</p>
<p dir="auto">The error returned is for following line:<br />
for(i=0; $values[i] != null; i++)</p>
<p dir="auto">Could it be something else?</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6038</link><guid isPermaLink="true">https://forum.netxms.org/post/6038</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Fri, 30 Sep 2011 12:17:04 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 11:45:24 GMT]]></title><description><![CDATA[<p dir="auto">This is because you use array instead of referencing it's elements. Correct version should looks like this:</p>
<pre><code>for(i=0; $values[i] != null; i++)
{
   trace(0,"+++" . $values[i] . "+++");

   minTime = min(minTime, $values[i]);
   maxTime = max(minTime, $values[i]);
}
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6037</link><guid isPermaLink="true">https://forum.netxms.org/post/6037</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 30 Sep 2011 11:45:24 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Sat, 01 Oct 2011 04:23:40 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">Not having 1.1.5 (yet) I tried 1..1.4:</p>
<p dir="auto">for(i=0; $values[i] != null; i++)<br />
{<br />
...<br />
}</p>
<p dir="auto">is still giving an error. What's wrong?</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6036</link><guid isPermaLink="true">https://forum.netxms.org/post/6036</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Sat, 01 Oct 2011 04:23:40 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 09:53:48 GMT]]></title><description><![CDATA[<p dir="auto">You miss "conditions" in documentation because it is not documented <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Working with the conditions is as follows:</p>
<ol>
<li>Create condition object somewhere in the infrastructure (services) tree.</li>
<li>Open properties, and on "Data" page, add DCIs</li>
<li>The, on "Script" page, write checking script. DCIs can be referred using variables $1, $2, etc., or via $values array. Script should return true if condition is active, and false otherwise. On status change, appropriate event being generated (configured on "Events and Status" page).</li>
</ol>
<p dir="auto">Starting with version 1.1.5, you can use <strong>foreach</strong> operator for enumerating DCIs, for example:</p>
<pre><code>sum = 0;
foreach(v : $values)
{
	trace(1, "+++ value = " . v . " +++");
	sum += v;
}
trace(1, "+++ sum = " . sum . " +++");
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6035</link><guid isPermaLink="true">https://forum.netxms.org/post/6035</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 30 Sep 2011 09:53:48 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 09:14:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi Vicror,</p>
<p dir="auto">I must have missed the "condition objects" in the documentation, thanks.</p>
<p dir="auto">I'm not sure however how I should reference the DCI's in that object.<br />
Normaly one would use FindDCIByName($node, "System.CurrentTime")<br />
but in the condition object $node represen the the condition object  and there are serveral System.CurrentTime DCI's for the different servers.</p>
<p dir="auto">Regards,</p>
<p dir="auto">Dan</p>
]]></description><link>https://forum.netxms.org/post/6034</link><guid isPermaLink="true">https://forum.netxms.org/post/6034</guid><dc:creator><![CDATA[DanG]]></dc:creator><pubDate>Fri, 30 Sep 2011 09:14:44 GMT</pubDate></item><item><title><![CDATA[Reply to Checking if time on different servers is identical on Fri, 30 Sep 2011 07:13:15 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">You can create a condition object, add DCIs collecting current time from different servers, and write a script which will calculate deviation.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/6031</link><guid isPermaLink="true">https://forum.netxms.org/post/6031</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 30 Sep 2011 07:13:15 GMT</pubDate></item></channel></rss>