Function ( metric_name, [operation], [value] )
Description Increments or clears the named counter metric.

Refer to the User-defined Metrics article for important details.
Parameter metric_name is a string value chosen by the user to identify the counter metric.

operation is a numeric which may take on one of two values:

  1. — Increments the counter metric by value.
  2. — Clears the counter metric to 0. The value parameter is ignored.
value is the amount to increment the counter metric. If value is not specified, it defaults to 1.


  • If the operation is not specified, it defaults to

  • The following applies to all invocations of

    1. If metric_name has never been defined, the function will define it and set the metric_type to Thereafter, the function will perform the indicated operation as modified by value.
    2. If metric_name has been defined before, but has a metric_type other than, the function will log an error and the request/response causing this function call will be cancelled.
Returns No value returned
Examples 1. Create a counter-type metric with name “Foo” and add 42 to it. If the metric is not present, then create it and initialize it with default value, 0.“Foo”,, 42)

2. Increment the counter-type metric named "Foo." by 1.“Foo”,

3. Increment the counter named "tls1_2" if the SSL protocol is "TLSv1.2."

if avi.ssl.protocol() == "TLSv1.2" then"tls1_2",, 1)