Giter Site home page Giter Site logo

rknpu-exporter's Introduction

RKNPU Exporter

Rust

Prometheus exporter for Rockchip NPU load metrics, written in Rust.

Grafana Screenshot

How it works

The Rockchip NPU load is available by this command:

sudo cat /sys/kernel/debug/rknpu/load
# output
NPU load:  Core0:  0%, Core1:  0%, Core2:  0%,

With a little help of Rocket and client_rust, the load metrics could be parsed and exported for Prometheus.

Prerequisites

To run the exporter natively:

  • RK3588 SoC
  • Debian 11

To develop:

  • rustc 1.73.0 (cc66ad468 2023-10-03)

Install

  1. Download the executable binary file from the Release page and extract the content.

  2. Create a configuration file named Rocket.toml in the same directory, and fill it with your custom settings.

    # Example setup.
    [release]
    address = "0.0.0.0"
    port = 9102

That's all.

Notes

Run

In the directory where the binary file located

sudo ./rknpu-exporter

A message looks like 🚀 Rocket has launched from http://127.0.0.1:8000 will be printed, then the exporter is ready.

Quick test

Open a browser and visit 127.0.0.1:9102/metrics, you shall see the raw metrics.

# HELP rockchip_npu_load Rockchip NPU Load.
# TYPE rockchip_npu_load gauge
rockchip_npu_load{manufacturer="rockchip",device="npu",id="1"} 0
rockchip_npu_load{manufacturer="rockchip",device="npu",id="2"} 0
rockchip_npu_load{manufacturer="rockchip",device="npu",id="0"} 28
# EOF

If you are running the exporter in a remote machine, replace 127.0.0.1 with actual IP address.

Run as a systemd service

Consider using a systemd service file.

Modify the following sample so the executable file and the config file locations are correct. Name this service file as you wish (rkxporter.service as an example) and put it in directory /etc/systemd/system.

# File name: rkxporter.service
# This is a sample file. Please modify before using.
[Unit]
Description=Rockchip NPU Exporter
After=network.target
Before=shutdown.target

[Service]
WorkingDirectory=/usr/local/npuexporter
ExecStart=/usr/local/npuexporter/bin/rknpu-exporter
Type=simple
Restart=always
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

Then start it with systemd command.

sudo systemctl start rkxporter

License

See LICENSE for more information.

Authors

Yin Guobing (尹国冰) - yinguobing

rknpu-exporter's People

Contributors

yinguobing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dorokhin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.