# Functions

## `cnt_inc([group.]name)`

Increments the counter group.name. The counter must be defined using the `script_counter` module parameter. If the group name is missing, the group specified by the `script_cnt_grp_name` modparam will be used.

### `cnt_inc` usage

    ...
    modparam("counters", "script_counter", "reqs")
    modparam("counters", "script_counter", "out.reqs  forwarded requests")
    ...
    route {
    	cnt_inc("reqs");
    	if (forward(uri:host, uri:port))
    		cnt_inc("out.reqs");
    ...
    }

## `cnt_add([group.]name, number)`

Adds number the counter group.name. The counter must be defined using the `script_counter` module parameter. If the group name is missing, the group specified by the `script_cnt_grp_name` modparam will be used.

### `cnt_add` usage

    ...
    modparam("counters", "script_counter", "reqs10  reqs times 10")
    ...
    route {
    	cnt_add("reqs10", 10);
    ...
    }

## `cnt_reset([group.]name)`

Resets the counter group.name. The counter must be defined using the `script_counter` module parameter. If the group name is missing, the group specified by the `script_cnt_grp_name` modparam will be used.

### `cnt_reset` usage

    ...
    modparam("counters", "script_counter", "reqs")
    ...
    route {
    	if (...)
    		cnt_reset("reqs");
    ...
    }