<?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[Calculating monthly speeds over 95th percentile?]]></title><description><![CDATA[<p dir="auto">I want to create a DCI on nodes that have leased fiber lines. We pay for a particular speed i.e. 500/500mbit but the line is actually burstable much higher to i.e. 10gbit/10gbit. We do not pay for bursting, however we do get billed significantly extra if we exceed the provisioned speed for more than 5% of the billing cycle</p>
<p dir="auto">I can see there is an example NetXMS script for 95th percentile packet loss, but this isn't directly applicable<br />
I'm already polling interface speeds every 5 minutes, how can I create another DCI that can calculate the average speed so far the current month, and then use thresholds to alert at 50%, 85%, 95% etc</p>
]]></description><link>https://forum.netxms.org/topic/7676/calculating-monthly-speeds-over-95th-percentile</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:45:50 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7676.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 May 2023 05:03:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Calculating monthly speeds over 95th percentile? on Mon, 08 May 2023 10:30:24 GMT]]></title><description><![CDATA[<pre><code>dciId = 2531;
threshold = 500 * 1000 * 1000;

t = localtime();
t-&gt;hour = 0;
t-&gt;min = 0;
t-&gt;sec = 0;
endTime = mktime(t);

if (t-&gt;mon &gt;= 2) {
  t-&gt;mon = t-&gt;mon - 1;
}
else
{
  t-&gt;mon = 12;
  t-&gt;year = t-&gt;year - 1;
}
startTime = mktime(t);

a = GetDCIValues($node, dciId, startTime, endTime);

HighCnt = 0;
Cnt = 0;

for (v : a) {
  Cnt++;
  if (v &gt; threshold) HighCnt++;
}

return HighCnt / Cnt;
</code></pre>
<p dir="auto">Here's an example script that grabs all values for a DCI for last month. You can put this in a script DCI that is being collected by cron schedule on the first day of each month.</p>
<p dir="auto">Once you nave array with values, you can do various calculations with them. If you want to do calculations that involve big numbers, e.g. calculating average value, initialize variable like that:</p>
<p dir="auto">TotalCounter = 0L;</p>
<p dir="auto">This will use INT64 for this variable.</p>
]]></description><link>https://forum.netxms.org/post/32432</link><guid isPermaLink="true">https://forum.netxms.org/post/32432</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Mon, 08 May 2023 10:30:24 GMT</pubDate></item></channel></rss>