Visualizing OpenWRT Router Data with Grafana and InfluxDB
Overview/
├── System Environment Setup/
│ ├── Debian 10 VM Configuration
│ │ ├── InfluxDB Installation
│ │ └── Grafana Installation
│ └── OpenWRT Network Device Configuration
├── Installation and Configuration of InfluxDB on the VM/
│ ├── Package Installation and Dependencies
│ │ ├── Install InfluxDB and Dependencies
│ │ ├── Configuration of InfluxDB
│ │ └── Setting Up Database and Retention Policy
│ └── Starting InfluxDB Service
├── Grafana Installation and Setup on the VM/
│ ├── Grafana Package Installation
│ │ ├── Install Grafana
│ │ ├── Configuring Grafana for Port 80
│ │ └── Setting Grafana to Run as Non-Root
│ └── Enabling Grafana Service on Startup
├── Installing and Configuring Collectd on OpenWRT/
│ ├── Collectd Package Installation
│ │ ├── Install Collectd and Modules
│ │ └── Configuring Collectd Service
│ └── Starting Collectd Service
├── Verifying the Configuration/
│ ├── Checking OpenWRT Configuration
│ └── Verifying Data Update in InfluxDB
└── Setting Up the Grafana Dashboard/
├── Creating a New Data Source
└── Importing an Existing Dashboard
└── Note on Dashboard Functionality
Proceed with the installation of necessary packages and dependencies:
sudo wget -qO- <https://repos.influxdata.com/influxdb.key> | sudo apt-key add -
echo "deb <https://repos.influxdata.com/debian> buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt update
sudo apt install -y influxdb
Important Note: If you encounter an error such as: E: gnupg, gnupg2, and gnupg1 are not installed, but one of them is required for this operation, you should install the ‘gpg’ package:
sudo apt install gpg
Post-installation of InfluxDB, configure the /etc/influxdb/influxdb.conf
file to activate the Collectd plugin (find and uncomment the lines below):
[[collectd]]
enabled = true
bind-address = ":25826"
database = "${YOUR_DB_NAME}"
retention-policy = ""
typesdb = "/usr/local/share/collectd/types.db"
security-level = "none"
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0
Creation of the ‘types.db’ file:
sudo mkdir -p /usr/local/share/collectd/
sudo wget -O /usr/local/share/collectd/types.db <https://raw.githubusercontent.com/CactusProjects/openwrt_influxdb/master/types.db>
Initiate and enable the InfluxDB service to start on boot:
sudo systemctl enable --now influxdb
Generating a new Influx database: