[SR-Users] collecting statistics

Klaus Darilion klaus.mailinglists at pernau.at
Thu Mar 15 12:02:31 CET 2012


On 15.03.2012 11:49, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 3/15/12 9:23 AM, Klaus Darilion wrote:
>> Hi!
>>
>> I want to collect statistics on a load-balancer, e.g. how many
>> NOTIFYs, SUBSCRIBEs, ... and the respective response codes, e.g.
>> NOTIFYs-200, NOTIFYs-408,...., response time from the backend-servers,
>> ...
>>
>> Further I want to do this separately for each backend-server in the
>> cluster, i.e. for every IP address in the dispatcher list.
>>
>> Built in statistics or not detailed enough, so thought of implementing
>> the counting and measuring in script using htable and a periodic timer
>> which dumps the htable values to log file.
>>
>> Thus, I will end up with lots of code, especially for dumping I have
>> to address all possible keys manually:
>>
>> e.g. request route:
>> $var(key) = $rm + "::" + $dd;
>> $sht(stat=>$var(key)) = $sht(stat=>$var(key)) + 1;
>>
>> e.g. reply route:
>> if ($rs != "200" && $rs != "480" ) {
>> $var(key) = $rm + "::" + $si + "::XXX";
>> } else {
>> $var(key) = $rm + "::" + $si + "::" + $rs;
>> }
>> $sht(stat=>$var(key)) = $sht(stat=>$var(key)) + 1;
>>
>> e.g. dumping:
>> xlog("PUBLISH::83.136.32.169=$sht(stat=>PUBLISH::83.136.32.169)");
>> $sht(stat=>PUBLISH::83.136.32.169)=0;
>> xlog("PUBLISH_200::83.136.32.169=$sht(stat=>PUBLISH_200::83.136.32.169)");
>>
>> $sht(stat=>PUBLISH_200::83.136.32.169)=0;xlog("PUBLISH_480::83.136.32.169=$sht(stat=>PUBLISH_480::83.136.32.169)");
>>
>> $sht(stat=>PUBLISH_480::83.136.32.169)=0;
>> xlog("PUBLISH_XXX::83.136.32.169=$sht(stat=>PUBLISH_XXX::83.136.32.169)");
>>
>> $sht(stat=>PUBLISH_XXX::83.136.32.169)=0;
>>
>>
>> It works, but is not very nice, IMO. Thus, I wonder if someone has a
>> better, more elegant way to achieve this.
> I use htable for similar stats, but I pull them via mi/rpc commands -- a
> whole table can be dumped at once.

How do you reset the counters? I couldn't find a MI command for that.

Klaus



More information about the sr-users mailing list