<a id="command-line-interface"></a>

# Command line interface

The `rated` package comes with a program called `ratectl` that
can be used to manage any aspect of the rated process. This section is a guide for
that program.

Every command have a `--help` flag to display available options.

The *ratectl* program communicates with the `rated`
processes over the control sockets.
The raw JSON response data can be useful
when using the CLI for scripting with tools like *jq*,
and the request data can be useful when learning about the API.
Therefore, the commands have a `--json` output flag making it return the raw response
and a `--json-request` flag that prints the raw request (JSON encoded).

<a id="cli-config"></a>

<a id="configuration-management"></a>

## Configuration management

These sub-commands can reload the [running configuration](config_rated_app.html.md)
See the [configuration](config_rated_app.html.md) section for more information.

<a id="cli-reload"></a>

<a id="reloading-configurations"></a>

### Reloading configurations

You can also invoke the individual reload commands directly:

```console
$ ratectl reload                           # /etc/halon/rated-app.yaml
```

<a id="cli-rate"></a>

<a id="rate-function"></a>

## Rate function

It’s possible to both list and clear rate. As per the example below.

```console
$ ratectl list
┌───────────────────┬────────────┬───────┬─────────────┬────────┬────────┬────────────┐
│ Namespace         │ Entry      │ Count │ Local count │ Oldest │ Newest │ Rate (#/s) │
├───────────────────┼────────────┼───────┼─────────────┼────────┼────────┼────────────┤
│ delivery-failures │ customer0  │     1 │           1 │      8 │      8 │          0 │
│ delivery-failures │ customer1  │     5 │           5 │     12 │      4 │      0.625 │
│ delivery-failures │ customer10 │     1 │           1 │      8 │      8 │          0 │
...
$ ratectl clear --entry customer10
1 entries deleted
```
