AirRecorder Tutorial - Part 2

The second part of this tutorial will discuss the use of placeholders and variables.

Placeholders

Placeholders are a convenient method to parametrize commands sent to a controller. By default, placeholder definitions are read from a file named:

"placeholders" or "placeholders.txt".

You can change the default by using the command line option:

--placeholders <placeholders-file>

The placeholders file is a simple text file with a single placeholder specification per line. A placeholder specification takes the form:

<placeholder>=<value1>,<value2>,...

For example:

apname=AP1,AP2

A placeholder is later referenced in the commands file by using the following syntax: ${<placeholdername>}. For each placeholder value, AirRecorder will run the specified command with the "${<placeholdername>}” string replaced with its corresponding value.

For example, consider an entry like this in your commands file:

0,show ap active ap-name ${apname}

and AirRecorder would run two commands once each:

show ap active ap-name AP1

show ap active ap-name AP2

NOTE: a placeholder definition can be spread over multiple lines by escaping the end of line with a \

apname3=\

AP6,\

AP7

Variables

Variables offer an additional flexible way of parametrising commands sent to a controller. Whereas placeholders use a predefined set of values, variables work with data that is fetched from the controller at runtime. For example, to run a command for every AP on the controller, one would use the variable: %{ap:name}.

Out of the box, AirRecorder comes with a pre-defined list of variables:

%{ap:name} => all AP names as listed by "show ap active", column Name

%{ap:group} => all AP group names as listed by "show ap active", column Group

%{ap-group:name} => all AP group names as listed by "show ap-group", column Name

%{user:name} => all user names as listed by "show user-table", column Name

%{time:hhmm} => outputs current controller time as hours:minutes (i.e. 10:42)

%{time:mmmdd} => outputs current controller time as month day (i.e. Jun 19)

Consider following entry in your commands file:

0,show ap active ap-name %{ap:name}

would instruct AirRecorder to run the command once for each active AP name.

NOTE: while variables offer a powerful way of running the same commands against multiple values, please keep in mind that it potentially generates a high number of commands that are send towards the CLI process of the controller. Use with caution!

Variables post-processing

The data set of a variable can be post-processed using processors. The general syntax is for a processor is: