[SR-Users] stats in kamailio

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 4 23:31:31 CET 2011



On 2/27/11 5:27 AM, Juha Heinanen wrote:
> Henning Westerholt writes:
>
>> "kamctl fifo get_statistics all" will show you all available statistics,
>> for a more simpler view try "kamctl moni". The closest thing you'll
>> find regards to the load are inuse transaction, or concurrent dialogs.
> tmx:inuse_transactions would be more useful if it would contain an
> average over some time (1-5 minutes or something like the routers have)
> rather than an instantaneous value.  but last time when i looked, it was
> difficult to implement in k any kind of stat with average value.
> perhaps that has now changed with sip router?
What I used, even in older versions, is to combine statistics with 
rtimer and htable. The statistics were just simple counters, holding 
integer value, incremented/decremented as wanted.

There are some stats that just increment, practically counting different 
events.

Here is what I do if I want to get like "load" stats - i.e., number of 
events in a specific period of time. For example number of 2xx 
transactions per minute:

Load htable module and define a htable, say stats.

In event_route[htable:mod-init] I set $sht(stats=>2xx_transactions) = 0;

Load rtimer module to execute a route block every minute. In that route 
block, do this kind of logic:

$var(stats) = $stat(2xx_transactions);
$var(diff) = $var(stats) - $sht(stats=>2xx_transactions);
$sht(stats=>2xx_transactions) = $var(stats);

- insert in db the value of $var(diff) along with the timestamp so you 
have the number of transactions answered with 2xx during the last 
minute. Then configure siremis to make a graph out of the db records

You can have another rtimer route executed not that often that can 
delete records older than 1-2 days, so you don't fill up the database.

Cheers,
Daniel

tmx:2xx_transactions


-- 
Daniel-Constantin Mierla
http://www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110304/5d6fb39a/attachment.htm>


More information about the sr-users mailing list