Skip to content

Prometheus exporter for DPtech network device. This exporter only need to be installed on one server connected to the device, it will collect all the statistics on the device.

License

Notifications You must be signed in to change notification settings

dptech-dev/dptech_exporter

Repository files navigation

DPtech-Exporter

Prometheus exporter for DPtech network device. This exporter only need to be installed on one server connected to the device, it will collect all the statistics on the device.

Visit http://localhost:12000/ to verify the exporter is running.

Grafana dashboard example:

ID 24399: DPtech Exporter Dashboard (Overview)

ID 24400: DPtech Exporter Dashboard (Device)

Requirements

  • python3
  • prometheus-client (need to be installed with pip)
  • pysnmp (need to be installed with pip)
  • pysnmpcrypto (need to be installed with pip)
  • pyyaml (need to be installed with pip)

Usage

Metrics are exported on the chosen HTTP port.

usage: dptech_exporter.py [-h] [--port PORT]
                              [--file INPUT_FILE]

Prometheus collector for DPtech device

optional arguments:
  -h, --help            show this help message and exit
  --port PORT           Http port, default is 12000
  --file INPUT_FILE
                        Configure file, default is /etc/dptech_exporter.yml

Configuration

Save the network devices and access templates to be monitored. default: /etc/dptech_exporter.yml

# snmp access template define
snmp_templates:
  - name: default
    version: v2c
    community: public_default
#   timeout: 3
#   retry: 1
  - name: temp_v3
    version: v3
    user: user
    auth_protocol: md5
    auth_key: 12345678
    priv_protocol: des
    priv_key: 12345678

targets:
  - host: 192.168.0.1
    sysname: core           # use 'core' as sysname, default read by sysName(MIB)
#   snmp: default           # snmp access template, default is 'default'
  - host: 192.168.0.2

Metrics

DPtech exporter metrics are prefixed with "dptech_".

Global

Labels:

  • host: host name or ip
  • sysname: sysName from SNMP or manual set
  • model: device model
  • version: device software version (snmp_info)
  • sn: device serial number (snmp_info)
  • descr: device description (snmp_info)
  • location: device location info (snmp_info)
  • contact: device contact info (snmp_info)

Metrics:

Name Description
snmp_info The device info.
snmp_status The snmp request status.
snmp_last_time The last snmp request success time.
uptime_seconds The running time of the device since its system initialization.
cpu_usage_percent Current CPU usage percentage.
cpu_temperature_degree Current CPU temperature(°C).
memory_usage_percent Current memory usage percentage.
mainboard_temperature_degree Current Mainboard temperature(°C).

Card

Labels:

  • host: host name or ip
  • sysname: sysName from SNMP or manual set
  • model: device model
  • slot: slot number
  • card: card model

Metrics:

Name Description
card_cpu_usage_percent CPU utilization percentage of card.
card_memory_usage_percent Percentage of memory used by the card.
card_lcpu_usage_percent LCPU utilization percentage of card.
card_lmem_usage_percent Percentage of LMEM used by the card.
card_cpu_temperature_degree CPU temperature of card (° C).
card_temperature_degree Card temperature (° C).

Interface

Labels:

  • host: host name or ip
  • sysname: sysName from SNMP or manual set
  • model: device model
  • ifname: interface name
  • ifdescr: interface description
  • iftype: interface type

Metrics:

Name Description
if_status Interface status.
if_speed_bps Interface speed.
if_in_bps Bits received by the interface per second.
if_out_bps Bits sent by the interface per second.
if_in_discards_pps The number of packets discarded by the interface per second.
if_in_errors_pps Number of error packets received by the interface per second.
if_out_discards_pps Number of packets discarded to be sent by the interface per second.
if_out_errors_pps Number of error packets to be sent by the interface per second.
if_in_usage_percent Interface inbound utilization.
if_out_usage_percent Interface outbound utilization.
if_in_bytes Bytes received by the interface.
if_out_bytes Bytes sent by the interface.
if_in_discards The number of packets discarded by the interface.
if_in_errors Number of error packets received by the interface.
if_out_discards Number of packets discarded to be sent by the interface.
if_out_errors Number of error packets to be sent by the interface.

Usecase

There are multiple ways to run the exporter.

python3

Used in the system python environment or the python virtual environment.

pip install -r requirements.txt
python dptech_exporter.py -f dptech_exporter.yml

uv

Used python uv.

uv sync
uv run dptech_exporter.py -f dptech_exporter.yml

docker

Running with an uv container.

docker run -d --name dptech_exporter --restart unless-stopped \
    -p 12000:12000 \
    -v .:/app \
    -v ./dptech_exporter.yml:/etc/dptech_exporter.yml \
    -w /app \
    astral/uv:python3.12-bookworm-slim \
    uv run --link-mode=copy dptech_exporter.py

docker compose (Recommend)

Running with an uv container by docker compose.

docker compose up -d

Prometheus Configuration

Add the job to prometheus YAML file(prometheus.yml). example:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'dptech-exporter'
    static_configs:
      - targets: ['localhost:12000']

Grafana Dashboard

ID 24399: DPtech Exporter Dashboard (Overview)

ID 24400: DPtech Exporter Dashboard (Device)

Licence

MIT

About

Prometheus exporter for DPtech network device. This exporter only need to be installed on one server connected to the device, it will collect all the statistics on the device.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages