<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.netxms.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aronhopkins</id>
	<title>NetXMS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.netxms.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aronhopkins"/>
	<link rel="alternate" type="text/html" href="https://wiki.netxms.org/wiki/Special:Contributions/Aronhopkins"/>
	<updated>2026-04-20T15:53:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.4</generator>
	<entry>
		<id>https://wiki.netxms.org/index.php?title=Script_Example:_Aggregation_of_DCI_values_and_applying_the_95%25_percentile_average&amp;diff=552</id>
		<title>Script Example: Aggregation of DCI values and applying the 95% percentile average</title>
		<link rel="alternate" type="text/html" href="https://wiki.netxms.org/index.php?title=Script_Example:_Aggregation_of_DCI_values_and_applying_the_95%25_percentile_average&amp;diff=552"/>
		<updated>2012-08-21T19:27:51Z</updated>

		<summary type="html">&lt;p&gt;Aronhopkins: Created page with &amp;quot;The example is based around a template which configuers ICMP Packet Loss probes. This script will loop around the nodes, collect the required DCI values. The values are then o...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The example is based around a template which configuers ICMP Packet Loss probes. This script will loop around the nodes, collect the required DCI values. The values are then ordered and the top 5 percent discarded, the remaining entries are averaged to give the required value;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
sub main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
trace(1, &amp;quot;Global Ping Loss 95&amp;quot;);&lt;br /&gt;
array pValue;&lt;br /&gt;
arrayI  = 0;&lt;br /&gt;
&lt;br /&gt;
foreach(parent : GetNodeParents($node))&lt;br /&gt;
{&lt;br /&gt;
	trace(3, &amp;quot;Parent object: name=&amp;#039;&amp;quot; . parent-&amp;gt;name .&amp;quot;&amp;#039; id=&amp;quot; . parent-&amp;gt;id);&lt;br /&gt;
	if (parent-&amp;gt;name == &amp;quot;all voice&amp;quot;)&lt;br /&gt;
	{&lt;br /&gt;
		foreach(vNode : GetObjectChildren(parent))&lt;br /&gt;
		{&lt;br /&gt;
			dciName = &amp;quot;ICMP: Packet loss to &amp;quot;.vNode-&amp;gt;name;&lt;br /&gt;
			dciId = FindDCIByDescription(vNode, dciName);&lt;br /&gt;
			if (dciId &amp;gt; 0)&lt;br /&gt;
			{&lt;br /&gt;
				tmpValue = GetDCIValue(vNode,dciId);				&lt;br /&gt;
				if (tmpValue != null)&lt;br /&gt;
				{&lt;br /&gt;
					pValue[arrayI++] = tmpValue;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Sort the Array&lt;br /&gt;
bubbleSort(pValue);&lt;br /&gt;
&lt;br /&gt;
// Apply the 95 percent rule&lt;br /&gt;
upTo = arrayI * 0.95;&lt;br /&gt;
pLoss = 0;&lt;br /&gt;
pCount = 0;&lt;br /&gt;
for(ia = 0; ia &amp;lt; upTo; ia++)&lt;br /&gt;
{&lt;br /&gt;
	pLoss += pValue[ia];&lt;br /&gt;
	pCount = ia;&lt;br /&gt;
}&lt;br /&gt;
p95AvgLoss = pLoss / pCount;&lt;br /&gt;
&lt;br /&gt;
trace(1, &amp;quot;Global Ping Loss 95 Summary: arrayI=&amp;quot;.arrayI.&amp;quot; upTo=&amp;quot;.upTo.&amp;quot; p95AvgLoss=&amp;quot;.p95AvgLoss );&lt;br /&gt;
&lt;br /&gt;
return p95AvgLoss;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sub bubbleSort(arr)&lt;br /&gt;
{&lt;br /&gt;
	swapped = true;&lt;br /&gt;
	while (swapped == true){&lt;br /&gt;
		swapped = false;&lt;br /&gt;
		for(ia = 1; arr[ia] != null; ia++)&lt;br /&gt;
		{&lt;br /&gt;
			ib = ia - 1;&lt;br /&gt;
			&lt;br /&gt;
			if (arr[ib] &amp;gt; arr[ia]){&lt;br /&gt;
				trace(3,&amp;quot;swap: &amp;quot;.ib.&amp;quot;:&amp;quot;.arr[ib].&amp;quot; with &amp;quot;.ia.&amp;quot;:&amp;quot;.arr[ia]);&lt;br /&gt;
				swapped=true;&lt;br /&gt;
				t = arr[ib];&lt;br /&gt;
				arr[ib] = arr[ia];&lt;br /&gt;
				arr[ia] = t;&lt;br /&gt;
				swapped = true;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sub printArray(arr)&lt;br /&gt;
{&lt;br /&gt;
	for(ia = 0; arr[ia] != null; ia++)&lt;br /&gt;
	{&lt;br /&gt;
		trace(1,&amp;quot;printArray: &amp;quot;.ia.&amp;quot;:&amp;quot;.arr[ia]);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aronhopkins</name></author>
	</entry>
	<entry>
		<id>https://wiki.netxms.org/index.php?title=SG:Script_Examples&amp;diff=551</id>
		<title>SG:Script Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.netxms.org/index.php?title=SG:Script_Examples&amp;diff=551"/>
		<updated>2012-08-21T18:57:14Z</updated>

		<summary type="html">&lt;p&gt;Aronhopkins: Addition of new example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Script Example: Additional Information About Connected Node]]&lt;br /&gt;
&lt;br /&gt;
[[Script Example: Enumerate All Nodes]]&lt;br /&gt;
&lt;br /&gt;
[[Script Example: Aggregation of DCI values and applying the 95% percentile average]]&lt;/div&gt;</summary>
		<author><name>Aronhopkins</name></author>
	</entry>
</feed>