# &adminguide;

## Overview

This module provides a statistics collector engine. It can track the values of various internal &kamailio; statistics for a specific period of time, allowing to retrieve them or a report over them via RPC commands.

## Dependencies

### &kamailio; Modules

The following modules must be loaded along this module:

- various - (optional, e.g., sl, tm, usrloc) for getting access to the statistics exported by these modules.

### External Libraries or Applications

The following libraries or applications must be installed before running &kamailio; with this module loaded:

- none

## Parameters

### `interval` (int)

Timer interval when to record the value for statistics.

Default value is 900 (15min).

#### Set `interval` parameter

    ...
    modparam("statsc", "interval", 300)
    ...

### `items` (int)

How many items to store for each statistic.

Note: it must be set before any 'track' parameter.

Default value is 100.

#### Set `items` parameter

    ...
    modparam("statsc", "items", 200)
    ...

### `track` (str)

Specify the statistics to track. The parameter can be set many times and one value can specify many statistics.

The format is "rname=sname", where the rname is the name for report and sname is internal &kamailio; statistic name.

Next statistics are tracked by default:

- shm.free - the internal statistic 'free_size' (from group 'shmem').

- shm.used - the internal statistic 'used_size' (from group 'shmem').

- shm.real_used - the internal statistic 'real_used_size' (from group 'shmem').

Default value is "".

#### Set `track` parameter

    ...
    modparam("statsc", "track", "req.received=rcv_requests")
    modparam("statsc", "track", "req.received=rcv_requests;rpl.received=rcv_replies")
    ...

## RPC Commands

### `statsc.report`

Get the report of recorded statistics.

Name: statsc.report

Parameters:

- _type_ :

  - list: list recorded values

  - diff: show diff between recorded values

- _name_: (optional) name of the statistic to show the report for. If missing or set to 'all', then the reports for all recorded statistics are done.

- _limit_: (optional) how many items to be included in the report

Example:

    ...
    # prototype: &kamcmd; statsc.report _type_ _name_ _limit_
    &kamcmd; statsc.report list
    &kamcmd; statsc.report list all 10
    &kamcmd; statsc.report diff
    ...