> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/latest/observability/radius.md).

# RADIUS metrics

> [!TIP]
> TPOSS exposes these metrics only when it handles RADIUS traffic. In an HSS-only deployment, when the **hss.enabled** configuration option set to `true`, TPOSS does not start the RADIUS servers, and these metrics are absent.
> 
> For the metrics endpoint, the export formats, and the conventions that apply to all the metrics, see the [Metrics](https://docs.cennso.com/components/tposs/latest/observability/metrics.md) document.

This document provides information about the RADIUS metrics exposed by TPOSS.

## RADIUS server metrics

TPOSS exposes the following RADIUS server metrics:

| Metric | Type | Labels | Description |
|---|---|---|---|
| radiusServUpTime | counter | server_name,server_ip,server_port | Uptime of a RADIUS server in milliseconds |
| radiusServLastRequestTime | counter | server_name,server_ip,server_port | Timestamp of the last RADIUS request handled by a server |
| radiusServRtt | histogram | le,server_name,server_ip,server_port,nas_ip,nas_id | Time spent handling the incoming RADIUS requests in milliseconds |
| radiusServTotalAccessRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Request requests |
| radiusServTotalAccessAccepts | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Accept responses |
| radiusServTotalAccessRejects | counter | server_name,server_ip,server_port,nas_ip,nas_id,reason | Total number of RADIUS Access-Reject responses |
| radiusServTotalAccessChallenges | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Access-Challenge requests |
| radiusServTotalAccountingRequests | counter | acct_type,server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Accounting requests |
| radiusServTotalAccountingResponses | counter | acct_type,server_name,server_ip,server_port,nas_ip,nas_id | Total number of RADIUS Accounting responses |
| radiusServTotalInvalidRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of invalid requests received by a RADIUS server |
| radiusServTotalDupRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of duplicated requests |
| radiusServTotalMalformedAccessRequests | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of malformed requests received by a RADIUS server |
| radiusServTotalBadAuthenticators | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of requests received by a RADIUS server with a secret that is not matched to the one configured for this server |
| radiusServTotalPacketsDropped | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of packets dropped by a RADIUS server |
| radiusServTotalUnknownTypes | counter | server_name,server_ip,server_port,nas_ip,nas_id | Total number of requests of an unknown type received by a RADIUS server |

Look at these metrics when subscribers cannot access the network. They show whether the requests reach TPOSS and how many of them TPOSS rejects.

### Common labels for RADIUS server metrics

All RADIUS metrics include common labels. This allows for accumulating metrics data for different conditions, such as the total number of RADIUS Accounting requests for the given RADIUS server, the mean time of RADIUS requests arriving at the given RADIUS server, and so on.

The following labels are present in the RADIUS metrics:

- `server_name` - the name of a RADIUS server
- `server_port` - the port used by a RADIUS server
- `server_ip` - the IP address a RADIUS server listens for incoming RADIUS requests
- `nas_ip` - the NAS IP address from which TPOSS receives RADIUS requests
- `nas_id` - the NAS identifier from which TPOSS receives RADIUS requests

The format of the `nas_id` label depends on the RADIUS configuration. As described in the [RADIUS settings](https://docs.cennso.com/components/tposs/latest/configuration/radius.md), each RADIUS server must define a list of sources from where RADIUS requests are accepted. Each source may have an optional definition of a NAS identifier, like `proxy` in the example below:

```yaml
radius:
  auth_source:
    ggsn:
      - proxy:secret@192.0.2.0/28
```

If the NAS identifier is specified in the RADIUS source configuration, it is used as the value of the `nas_id` label. If the NAS identifier is not specified, the value of the `nas_id` label is formed by joining the `handler` string, the IP source address from which the RADIUS request was received, and the `auth` or `acct` string.

For example, the value of the `nas_id` label for the following configuration could be `radiusServTotalAccountingRequests{nas_id="auth_192.0.2.0"}`:

```yaml
radius:
  auth_source:
    ggsn:
      - secret@192.0.2.0/28
```

### Additional labels for RADIUS Accounting metrics

Besides the [common labels](#common-labels-for-radius-server-metrics), the **radiusServTotalAccountingRequests** and **radiusServTotalAccountingResponses** metrics have the additional label - `acct_type`. This label provides information about the type of a RADIUS Accounting request. The possible values of this label are:

- `start`
- `update`
- `stop`

### Additional labels for RADIUS Access-Reject metrics

In addition to [common labels](#common-labels-for-radius-server-metrics), the **radiusServTotalAccessRejects** metric has the additional label `reason`. Its value represents the reason for the rejected RADIUS Access-Request. The label may have the following values:

- `not_authenticated` - The subscriber is not authenticated by TPOSS.
- `blocked_tariff` - The subscriber has the `blocked` tariff.
- `missed_mandatory_avp` - Missing mandatory AVP in the incoming RADIUS Access-Request.
- `database_issue` - The database query failed with error.
- `database_connection_issue` - The database connection was closed during the execution of a query.
- `database_busy` - TPOSS does not have free database connections in the database connection pool.
- `ip_pool_exhausted` - No more IP addresses in the IP pool.
- `ip_allocation_issue` - Allocation of IP address failed because of database or TPOSS issues.
- `duplicated_network_session` - Network session for the given IMSI already exists at TPOSS.
- `user_stat_update_issue` - TPOSS failed to update user statistics when handling RADIUS Access-Request.
- `lock_error` - TPOSS failed to acquire a lock to handle incoming RADIUS requests.
- `ccs_error` - Charging handler failed to handle RADIUS Access-Request from TDF.
- `internal_error` - TPOSS handler crashed when handling the incoming RADIUS Access-Request.
- `unknown` - TPOSS rejected the RADIUS Access-Request by unknown reason.

## RADIUS client metrics

TPOSS exposes the following RADIUS client metrics:

| Metric | Type | Labels | Description |
|---|---|---|---|
| radiusClientTotalCoARequests | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA requests sent by TPOSS |
| radiusClientTotalCoAAckResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA-ACK responses received by TPOSS |
| radiusClientTotalCoANakResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of CoA-NAK responses received by TPOSS |
| radiusClientTotalDisconnectRequests | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect requests sent by TPOSS |
| radiusClientTotalDisconnectAckResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect-ACK responses received by TPOSS |
| radiusClientTotalDisconnectNakResponses | counter | client_ip,client_name,server_name,server_ip,server_port | Total number of Disconnect-NAK responses received by TPOSS |

Each RADIUS client metric contains the following labels:

- `client_ip` - the IP address used by TPOSS RADIUS client to send RADIUS requests
- `client_name` - the name of RADIUS client used by TPOSS to send RADIUS requests
- `server_name` - the RADIUS server name where TPOSS sends RADIUS requests
- `server_ip` - the RADIUS server IP address where TPOSS sends RADIUS requests
- `server_port` - the RADIUS server port where TPOSS sends RADIUS requests
