Fortinet white logo
Fortinet white logo

Script Reference Guide

PROXY:atomic_counter_add(counter_name,value)

PROXY:atomic_counter_add(counter_name,value)

Adds a value to the specified atomic counter name.

Syntax

PROXY:atomic_counter_add(counter_name,value);

Arguments

Name Description
counter_name

A Lua string as the name of the counter. This parameter is mandatory.

value

A Lua number to be added to the counter

Events

All events except: PERSISTENCE, POST_PERSIST.

Example

 when HTTP_REQUEST {
       counter_name = "DemoCounter1"
       value = 10
	ret = PROXY:atomic_counter_add(counter_name, value)
       if ret then
	debug("===>>atomic_counter_add success: [%s]=[%d]\n", counter_name, value)
       else
	debug("===>>atomic_counter_add failed: [%s]=[%d]\n", counter_name, value)
       end
}

Supported Version

FortiADC version 7.6.0 and later.

PROXY:atomic_counter_add(counter_name,value)

PROXY:atomic_counter_add(counter_name,value)

Adds a value to the specified atomic counter name.

Syntax

PROXY:atomic_counter_add(counter_name,value);

Arguments

Name Description
counter_name

A Lua string as the name of the counter. This parameter is mandatory.

value

A Lua number to be added to the counter

Events

All events except: PERSISTENCE, POST_PERSIST.

Example

 when HTTP_REQUEST {
       counter_name = "DemoCounter1"
       value = 10
	ret = PROXY:atomic_counter_add(counter_name, value)
       if ret then
	debug("===>>atomic_counter_add success: [%s]=[%d]\n", counter_name, value)
       else
	debug("===>>atomic_counter_add failed: [%s]=[%d]\n", counter_name, value)
       end
}

Supported Version

FortiADC version 7.6.0 and later.