3 Andrei Pelinescu-Onciul
7 Copyright © 2010 iptelorg GmbH
8 __________________________________________________________________
18 2.2. script_cnt_grp_name
22 3.1. cnt_inc([group.]name)
23 3.2. cnt_add([group.]name, number)
24 3.3. cnt_reset([group.]name)
40 1.1. Create a new script_counter
41 1.2. Set script_cnt_grp_name in the config file
45 1.6. cnt.get grp counter_name usage
46 1.7. cnt.reset grp name usage
47 1.8. cnt.list_groups usage
48 1.9. cnt.list_vars group usage
49 1.10. cnt.get_vars group usage
50 1.11. cnt.help grp name usage
52 Chapter 1. Admin Guide
60 2.2. script_cnt_grp_name
64 3.1. cnt_inc([group.]name)
65 3.2. cnt_add([group.]name, number)
66 3.3. cnt_reset([group.]name)
82 This module exports counters/statistics manipulating script functions
88 2.2. script_cnt_grp_name
92 Define a new counter that can be used from the script. The declaration
93 might include a group in front of the counter name, separated with '.'.
94 It might also include a counter description string (help message),
95 separated from the name with a ' ' or ':'. If the group is missing, the
96 group defined in the script_cnt_grp_name module parameter will be used
97 (the default is "script"). If the description is missing, the default
98 is "custom script counter". The format of the declaration is:
99 [group.]name[( |:)description].
101 Example 1.1. Create a new script_counter
102 modparam("counters", "script_counter", "foo") # script.foo
103 modparam("counters", "script_counter", "test.bar") # test.bar
104 modparam("counters", "script_counter", "baz example counter") # script.baz
105 modparam("counters", "script_counter", "test.x:another example") # test.x
107 2.2. script_cnt_grp_name
109 Group name that will be used for the counters defined via the
110 script_counter module parameter which do not have a specified group.
114 Example 1.2. Set script_cnt_grp_name in the config file
115 modparam("counters", "script_cnt_grp_name", "my_counters")
119 3.1. cnt_inc([group.]name)
120 3.2. cnt_add([group.]name, number)
121 3.3. cnt_reset([group.]name)
123 3.1. cnt_inc([group.]name)
125 Increments the counter group.name. The counter must be defined using
126 the script_counter module parameter. If the group name is missing, the
127 group specified by the script_cnt_grp_name modparam will be used.
129 Example 1.3. cnt_inc usage
131 modparam("counters", "script_counter", "reqs")
132 modparam("counters", "script_counter", "out.reqs forwarded requests")
136 if (forward(uri:host, uri:port))
141 3.2. cnt_add([group.]name, number)
143 Adds number the counter group.name. The counter must be defined using
144 the script_counter module parameter. If the group name is missing, the
145 group specified by the script_cnt_grp_name modparam will be used.
147 Example 1.4. cnt_add usage
149 modparam("counters", "script_counter", "reqs10 reqs times 10")
152 cnt_add("reqs10", 10);
156 3.3. cnt_reset([group.]name)
158 Resets the counter group.name. The counter must be defined using the
159 script_counter module parameter. If the group name is missing, the
160 group specified by the script_cnt_grp_name modparam will be used.
162 Example 1.5. cnt_reset usage
164 modparam("counters", "script_counter", "reqs")
186 Get the value of the counter identified by group.counter_name.
188 Prototype: cnt.get group counter_name
190 Example 1.6. cnt.get grp counter_name usage
191 $ kamcmd cnt.get script foo
195 Resets the counter identified by group.counter_name.
197 Prototype: cnt.reset group counter_name
199 Example 1.7. cnt.reset grp name usage
200 $ kamcmd cnt.reset script foo
204 Lists all the declared counter groups.
206 Prototype: cnt.list_groups
208 Example 1.8. cnt.list_groups usage
209 $ kamcmd cnt.list_groups
213 Alias to cnt.list_groups.
217 Lists all the names of all the counters belonging to the specified
220 Prototype: cnt.list_vars group
222 Example 1.9. cnt.list_vars group usage
223 $ kamcmd cnt.list_vars tmx
227 Alias to cnt.list_vars.
231 Lists all the counter names and their values in the specified group.
233 Prototype: cnt.get_vars group
235 Example 1.10. cnt.get_vars group usage
236 $ kamcmd cnt.get_vars script
240 Alias to cnt.get_vars.
244 Displays the counter description.
246 Prototype: cnt.help group counter_name
248 Example 1.11. cnt.help grp name usage
249 $ kamcmd cnt.help script foo