NetXMS Support Forum

English Support => General Support => Topic started by: multix on September 27, 2014, 12:41:34 AM

Title: netxms 1.2.16 getavgdcivalue not working
Post by: multix on September 27, 2014, 12:41:34 AM
Hi There!

I am trying to use NetXMS on routers' bandwidth usage statistics and trying to see if any saturation is happening on my network.

For this, I am trying to use getavgdcivalue command on scripting but i am sure that command is not returning true result.

I had a look at code, and did not see any error.
Itried to use sql statement as described other posts about this command, and sql command is working properly but getavgdcivalue command is not working.

I Tried to use GetminDCIValue, it is working.
I tried to use GetMaxDCIValue, it is working.

I tried to use GetSumDCIValue, it is NOT Working properly.
I tried to use GetAVGDCIValur, it is NOT working properly.

Getsumdcivalue and getavgdcivalue is returning integers that smaller than 10.

By the way, i am using netxms on linux mint machine and mysql.

Can anybody help me to solve this problem, please?
Title: Re: netxms 1.2.16 getavgdcivalue not working
Post by: multix on September 27, 2014, 07:43:53 PM
I had a look into code and saw a new command : GetDCIValues . With this command, i can read all records between timestamp as an array.
i can calculate an average value by:

GetDCIValues between timestamps, Sum them and divide to record count between timestamps  (because both GetAvgDCIValue and GetSumDCIValue are not working properly and returning meanless integers between 1..10)

so i can calculate avg. But If there is an other way, can anybody tell me, please ?
Title: Re: netxms 1.2.16 getavgdcivalue not working
Post by: Victor Kirhenshtein on October 03, 2014, 10:30:06 PM
Hi,

that's very strange, because as you probably see in the code, all four functions share common implementation and only change SQL aggregate function. Can you please share exact data - actual DCI values, result of  GetAvgDCIValue and GetMaxDCIValue, and results of appropriate SQL queries?

Best regards,
Victor
Title: Re: netxms 1.2.16 getavgdcivalue not working
Post by: multix on October 15, 2014, 10:57:19 PM
All Information about DCI values and script as follows:

DCI Values :
"Timestamp","Value"
"15.10.2014 22:48:51","5192"
"15.10.2014 22:48:41","7360"
"15.10.2014 22:48:31","8624"
"15.10.2014 22:48:21","160"
"15.10.2014 22:48:11","2952"
"15.10.2014 22:48:01","160"
"15.10.2014 22:47:51","160"
"15.10.2014 22:47:41","160"
"15.10.2014 22:47:31","160"
"15.10.2014 22:47:21","160"
"15.10.2014 22:47:11","160"
"15.10.2014 22:47:01","2952"
(Got these with export to csv)

my sample script is :


node=FindNodeObject(null,11298);
nodedci2=FindDCIByDescription(node,"inbound_12");
nodedci=GetDCIObject(node,nodedci2);
saturesure=GetCustomAttribute(node,"saturesure");
btime=time();
avgdci=GetAvgDCIValue(node,nodedci->id,btime-saturesure,btime);
sumdci=GetSumDCIValue(node,nodedci->id,btime-saturesure,btime);
println "avgdci     : ".avgdci;
println "sumdci     : ".sumdci;
println "saturesure : ".saturesure;

inboundsondakka=GetDCIValues(node,nodedci->id,btime-saturesure,btime);
ib=0;
ic=0;
foreach (ia:inboundsondakka)
{
ib++;
ic=ic+ia;
println ib.".th record :".ia;
}

ic=ic/ib;
println "recordcount :".ib;
println "avgdcivalue :".ic;

return false;

(11298 my node id)

and console output is :

avgdci : 2.00000
sumdci : 3.00000
saturesure : 120
1th record : 5192
.
.
.
12.th record : 2952
recordcount : 12
avgdcivalue : 2350.00000

NETXMS version : 1.2.16. Compiled from source, and i am using mysql 5.5.38-0 and Operating System is : linux mint 17