PPPoE Session Count

Sampling the number of PPPoE sessions is an example for a metric from a dedicated index table. The subscriber daemon maintains statistics of subscriber sessions grouped by access interface, access type and session lifecycle state. The show subscriber count command lists the session summary statistics

Listing 12 - Subscriber session count statistics
supervisor@BNG>rbms-tst00.vm.nbg.rtbrick.net: cfg> show subscriber count
                       Total        Setup        Established  Terminating  Standby
Summary                1000         22           978          0            0
  PPPoE                1000         22           978          0            0
  L2TP                 0            0            0            0            0
  IPoE                 0            0            0            0            0
  L2BSA                0            0            0            0            0
  Test                 0            0            0            0            0
hostif-0/0/1           1000         22           978          0            0
  PPPoE                1000         22           978          0            0
  L2TP                 0            0            0            0            0
  IPoE                 0            0            0            0            0
  L2BSA                0            0            0            0            0
  Test                 0            0            0            0            0

The Listing below configures a metric to sample the PPPoE counters from the subscriber session statistic.

Listing 13 - JSON object to enable PPPoE session count sampling
{
    "rtbrick-config:metric": {
        "name": "pppoe_session_count",
        "table-name": "local.access.subscriber.count",
        "bds-type": "object-metric",
        "prometheus-type": "gauge",
        "description": "PPPoE sessions",
        "attribute": [
            {
            "attribute-name": "pppoe_setup",
            "label": [
                {
                "label-key": "ifp_name",
                "label-value": "ifp_name",
                "label-type": "dynamic"
                },
                {
                "label-key": "access_type",
                "label-value": "pppoe",
                "label-type": "static"
                },
                {
                "label-key": "state",
                "label-value": "setup",
                "label-type": "static"
                }
            ]
            },
            {
            "attribute-name": "pppoe_established",
            "label": [
                {
                "label-key": "ifp_name",
                "label-value": "ifp_name",
                "label-type": "dynamic"
                },
                {
                "label-key": "access_type",
                "label-value": "pppoe",
                "label-type": "static"
                },
                {
                "label-key": "state",
                "label-value": "established",
                "label-type": "static"
                }
            ]
            },
            {
            "attribute-name": "pppoe_terminating",
            "label": [
                {
                "label-key": "ifp_name",
                "label-value": "ifp_name",
                "label-type": "dynamic"
                },
                {
                "label-key": "access_type",
                "label-value": "pppoe",
                "label-type": "static"
                },
                {
                "label-key": "state",
                "label-value": "terminating",
                "label-type": "static"
                }
            ]
            }
        ]
    }
}
The PPPoE session count can increase and decrease. Therefore the metric type must be gauge rather than counter.

Each count is labelled with the access type, the session state and the access interface name. This allows aggregation over all time-series to compute the total counts per interface and also for the entire switch in Prometheus.

Run show datastore subscriberd table local.access.subscriber.count to display the statistics raw data. The local.access.subscriber.count table contains one object for each interface. Each object contains an attribute for each combination of access type and lifecycle state.

Listing 14 - Subscriber session raw data.
show datastore subscriberd.1 table local.access.subscriber.count
Object: 0, Sequence 1, Last update: Fri Jan 12 09:48:35 GMT +0000 2024
  Attribute                                Type                           Length     Value
  ifp_name (1)                             string (9)                         13     hostif-0/0/1
  interval (2)                             interval (26)                       4     3000
  pppoe_setup (3)                          uint32 (4)                          4     22
  pppoe_established (4)                    uint32 (4)                          4     978
  pppoe_terminating (5)                    uint32 (4)                          4     0
  pppoe_standby (6)                        uint32 (4)                          4     0
  l2tp_setup (7)                           uint32 (4)                          4     0
  l2tp_established (8)                     uint32 (4)                          4     0
  l2tp_terminating (9)                     uint32 (4)                          4     0
  l2tp_standby (10)                        uint32 (4)                          4     0
  ipoe_setup (11)                          uint32 (4)                          4     0
  ipoe_established (12)                    uint32 (4)                          4     0
  ipoe_terminating (13)                    uint32 (4)                          4     0
  ipoe_standby (14)                        uint32 (4)                          4     0
  l2bsa_setup (15)                         uint32 (4)                          4     0
  l2bsa_established (16)                   uint32 (4)                          4     0
  l2bsa_terminating (17)                   uint32 (4)                          4     0
  l2bsa_standby (18)                       uint32 (4)                          4     0
  test_setup (19)                          uint32 (4)                          4     0
  test_established (20)                    uint32 (4)                          4     0
  test_terminating (21)                    uint32 (4)                          4     0
  test_standby (22)                        uint32 (4)                          4     0