charlie-haley / omada_exporter

Prometheus Exporter for TP-Link Omada Controller SDN.
MIT License
94 stars 16 forks source link

Only a few metrics exported for Omada ER7412-M2 gateway #103

Open gmoscalu opened 1 month ago

gmoscalu commented 1 month ago

Hello,

First of all a big thank you for this exporter!

I noticed that while it seems to pull out interesting data for my EAP225 Access points (EAP225, EAP225-WALL and EAP225-OUTDOOR), for my TL-SG2428P and TL-SG2210P switches, when it comes to my brand new router, ER7412-M2, i only get a few infos:

$ grep ER7412 metrics.txt
omada_device_cpu_percentage{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 1
omada_device_download{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 2.9249723703e+10
omada_device_mem_percentage{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 22
omada_device_need_upgrade{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
omada_device_upload{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 4.194277945e+09
omada_device_uptime_seconds{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 28386

Versions:

Device firmware versions:

Is there anything i can help with to fix the following issues:

Thanks, Gabriel

gmoscalu commented 1 month ago

hi @unfixa1

here's what the gw shows:

image image image image image image

i just downloaded the latest docker yesterday and i posted what it returned for M7412-M2. if needed, i can provide the full output from browser.

gmoscalu commented 1 month ago

Adding JSON response sample for the gateway: ER7412_api_samples_public.json

My setups is the following:

Comparing the JSON with GUI, i notice (for port 3, my main ISP):

In my setup, i can get the WAN ports by querying:

${OMADA_HOST}/${CONTROLLER_ID}/api/v2/sites/${SITE_ID}/setting/wanlanstatus

and the response includes the list of WAN ports in the result.wanlist structure:

{
    "errorCode": 0,
    "msg": "Success.",
    "result": {
        "portName": {
            "11_af4cf28326b1434b8931a5c9f5bf5a0c": "SFP WAN/LAN11",
            "2_24263b08f55a406a99cb3b6b62160fbb": "2.5G WAN/LAN2",
            "5_baf15e001ee44b92aa589f4a917e067b": "WAN/LAN5",
            "6_f345afdc25e64c568a5bca002f81bf1f": "WAN/LAN6",
            "1_9838d139e7da4600a1bb089058a3c87e": "2.5G WAN/LAN1",
            "10_9357f54a036c4af8a7cfa3c27f44ae71": "WAN/LAN10",
            "9_e4709ef3266a40d98cc3669aed5540b3": "WAN/LAN9",
            "7_84d675cd3c284eb2a4f225ed13e71896": "WAN/LAN7",
            "8_c49524e5c4b14915994db576500da93c": "WAN/LAN8",
            "12_bb45d53320bd4813a478c32553c7f579": "SFP WAN/LAN12"
        },
        "networkComptent": 1,
        "adoptedGateway": true,
        "supportIpv6": 1,
        "wanList": [
            {
                "portUuid": "3_3908645569e64bdbae10b08da65b4840",
                "portName": "WAN/LAN3",
                "enable": 1,
                "proto": "pppoe",
                "pdEnable": 1,
                "prefix": "2a02:2f04:125:d300::/64",
                "pdSize": 64,
                "type": 1
            },
            {
                "portUuid": "4_489318901fda4fd496cba28ab6715f6c",
                "portName": "WAN/LAN4",
                "enable": 1,
                "proto": "bridge",
                "prefix": "",
                "type": 1
            }
        ],
        "iptvPorts": [],
        "osgAddInAdvance": false,
        "wirelessRouter": false
    }
}

I hope this helps.

I would try to add the corresponding code in a PR, but i am not capable to code in GOLANG.

gmoscalu commented 3 weeks ago

So, to help, even if I am not a GO developper, but i am able to understand code, adjust & adapt to my needs, i propose the following files attached here (i do not know how i can contribute to this project in a different manner):

gmoscalu commented 3 weeks ago

Finalizing the work on the site gateway part (2 more metrics to implement), will upload the gateway and its collectors too.

So far, i added:

Still want to do:

Example:

# HELP omada_gateway_cpu_percentage Percentage of device CPU used.
# TYPE omada_gateway_cpu_percentage gauge
omada_gateway_cpu_percentage{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 1
# HELP omada_gateway_download Device download traffic.
# TYPE omada_gateway_download counter
omada_gateway_download{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 3.63308195257e+11
# HELP omada_gateway_isp_global_bandwidth Site's GLOBAL ISP bandwidth.
# TYPE omada_gateway_isp_global_bandwidth gauge
omada_gateway_isp_global_bandwidth{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 1500
# HELP omada_gateway_isp_global_usage Site's GLOBAL ISP bandwidth usage (perc 0-100).
# TYPE omada_gateway_isp_global_usage gauge
omada_gateway_isp_global_usage{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_isp_port_internet_state Site's ISP link Internet state (1= Connected, 0=Disconnected).
# TYPE omada_gateway_isp_port_internet_state gauge
omada_gateway_isp_port_internet_state{GW_Port_Desc="RDS Uplink",GW_Port_Name="WAN/LAN3",GW_Port_Number="3",ISP_ID="1",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 1
omada_gateway_isp_port_internet_state{GW_Port_Desc="VDF Uplink",GW_Port_Name="WAN/LAN4",GW_Port_Number="4",ISP_ID="2",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 1
# HELP omada_gateway_isp_port_rx_rate Site's ISP link RX rate (byte/s).
# TYPE omada_gateway_isp_port_rx_rate gauge
omada_gateway_isp_port_rx_rate{GW_Port_Desc="RDS Uplink",GW_Port_Name="WAN/LAN3",GW_Port_Number="3",ISP_ID="1",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
omada_gateway_isp_port_rx_rate{GW_Port_Desc="VDF Uplink",GW_Port_Name="WAN/LAN4",GW_Port_Number="4",ISP_ID="2",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_isp_port_rx_usage Site's ISP link RX bandwidth usage (perc 0-100).
# TYPE omada_gateway_isp_port_rx_usage gauge
omada_gateway_isp_port_rx_usage{GW_Port_Desc="RDS Uplink",GW_Port_Name="WAN/LAN3",GW_Port_Number="3",ISP_ID="1",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
omada_gateway_isp_port_rx_usage{GW_Port_Desc="VDF Uplink",GW_Port_Name="WAN/LAN4",GW_Port_Number="4",ISP_ID="2",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_isp_port_tx_rate Site's ISP link TX rate (byte/s).
# TYPE omada_gateway_isp_port_tx_rate gauge
omada_gateway_isp_port_tx_rate{GW_Port_Desc="RDS Uplink",GW_Port_Name="WAN/LAN3",GW_Port_Number="3",ISP_ID="1",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
omada_gateway_isp_port_tx_rate{GW_Port_Desc="VDF Uplink",GW_Port_Name="WAN/LAN4",GW_Port_Number="4",ISP_ID="2",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_isp_port_tx_usage Site's ISP link TX bandwidth usage (perc 0-100).
# TYPE omada_gateway_isp_port_tx_usage gauge
omada_gateway_isp_port_tx_usage{GW_Port_Desc="RDS Uplink",GW_Port_Name="WAN/LAN3",GW_Port_Number="3",ISP_ID="1",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
omada_gateway_isp_port_tx_usage{GW_Port_Desc="VDF Uplink",GW_Port_Name="WAN/LAN4",GW_Port_Number="4",ISP_ID="2",device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_mem_percentage Percentage of device Memory used.
# TYPE omada_gateway_mem_percentage gauge
omada_gateway_mem_percentage{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 23
# HELP omada_gateway_need_upgrade A boolean on whether the device needs an upgrade.
# TYPE omada_gateway_need_upgrade gauge
omada_gateway_need_upgrade{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 0
# HELP omada_gateway_upload Device upload traffic.
# TYPE omada_gateway_upload counter
omada_gateway_upload{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 8.7849442718e+10
# HELP omada_gateway_uptime_seconds Uptime of the device.
# TYPE omada_gateway_uptime_seconds gauge
omada_gateway_uptime_seconds{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 717028
# HELP omada_gateway_vpns Defined VPNs.
# TYPE omada_gateway_vpns counter
omada_gateway_vpns{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 2
# HELP omada_gateway_vpns_online Active IPSec tunnels.
# TYPE omada_gateway_vpns_online counter
omada_gateway_vpns_online{device="ER7412-M2",device_type="gateway",ip="10.10.200.1",mac="40-AE-30-B3-5B-42",model="ER7412-M2",site="Vila",site_id="670783f2a7b8ad5249e1e202",version="1.0.1"} 2