1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[ <!ENTITY % local.common.attrib
"xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'">
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;
]
>
<section id="cnts.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
<sectioninfo>
</sectioninfo>
<title>Functions</title>
<section id="cnt_inc">
<title>
<function>cnt_inc([group.]name)</function>
</title>
<para>
Increments the counter <emphasis>group.name</emphasis>. The counter
must be defined using the <varname>script_counter</varname>
module parameter.
If the group name is missing, the group specified by the
<varname>script_cnt_grp_name</varname> modparam will be used.
</para>
<example>
<title><function>cnt_inc</function> usage</title>
<programlisting>
...
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");
...
}
</programlisting>
</example>
</section>
<section id="cnt_add">
<title>
<function>cnt_add([group.]name, number)</function>
</title>
<para>
Adds <emphasis>number</emphasis> the counter
<emphasis>group.name</emphasis>.
The counter must be defined using the
<varname>script_counter</varname> module parameter.
If the group name is missing, the group specified by the
<varname>script_cnt_grp_name</varname> modparam will be used.
</para>
<example>
<title><function>cnt_add</function> usage</title>
<programlisting>
...
modparam("counters", "script_counter", "reqs10 reqs times 10")
...
route {
cnt_add("reqs10", 10);
...
}
</programlisting>
</example>
</section>
<section id="cnt_reset">
<title>
<function>cnt_reset([group.]name)</function>
</title>
<para>
Resets the counter <emphasis>group.name</emphasis>. The counter
must be defined using the <varname>script_counter</varname>
module parameter.
If the group name is missing, the group specified by the
<varname>script_cnt_grp_name</varname> modparam will be used.
</para>
<example>
<title><function>cnt_reset</function> usage</title>
<programlisting>
...
modparam("counters", "script_counter", "reqs")
...
route {
if (...)
cnt_reset("reqs");
...
}
</programlisting>
</example>
</section>
</section>
|