How to collect metrics on gl.inet routers

Hi there,

I want to be able to collect metrics in my routers: GL-AR750S and mango. By metrics I mean: cpu loads, temperature, network interface metrics, etc…

I typically do this on a regular unix box via telegraf (for influxdb) or collectd. Then I visualize things with grafana.

What is the recommended way to achieve this with gl.inet routers?

-drd

Give me a few hours and I will give you my grafana my collect d config and my HTTP Prometheus exporter.

Cool. Please let me know how and what package you install on the router.

Thank you!

##install collectd on router

opkg update
opkg install collectd-mod-ethstat collectd-mod-ipstatistics collectd-mod-irq collectd-mod-load collectd-mod-ping collectd-mod-powerdns collectd-mod-sqm collectd-mod-thermal collectd-mod-wireless collectd-mod-iptables
opkg install luci-app-statistics

##install iptmon on router

VERSION=0.1.6
wget https://github.com/oofnikj/iptmon/releases/download/v${VERSION}/iptmon_${VERSION}-1_all.ipk -O iptmon_${VERSION}-1_all.ipk
opkg install ./iptmon_${VERSION}-1_all.ipk

##Config luci_statistics on router
Copy my config file “luci_statistics” to /etc/config/

file → (config statistics 'collectd' option BaseDir '/var/run/collectd' option Inc - Pastebin.com)
(update the export location to your server ip where prom/collect-export is located.)

--------------------Server side setup-----------------------------------------------
##Install Grafana, Promethesus, Prom/collect-exporter on Docker. You also need to configure Prometheus to scrape the collectd exporter.

https://hub.docker.com/r/prom/collectd-exporter/

Import my grafana dashboard
File → (pastebin: { "__inputs": [ { "name": "DS_VPS", "label": "VPS", - Pastebin.com)

1 Like

Thank you.
I saw a similar post online but run into this issue when trying to install the packages (see below).
Any idea how to solve this?

root@GL-AR750S:~# opkg update
Downloading https://fw.gl-inet.com/releases/v19.07.8/packages-3.0/ath79/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/glinet_packages
Downloading https://fw.gl-inet.com/releases/v19.07.8/packages-3.0/ath79/glinet/Packages.gz
Updated list of available packages in /var/opkg-lists/glinet_private
Downloading https://fw.gl-inet.com/releases/v19.07.8/kmod-3.0/ath79/nand/Packages.gz
Updated list of available packages in /var/opkg-lists/glinet_kmod
root@GL-AR750S:~# opkg install luci-app-statistics
Installing luci-app-statistics (git-21.189.23240-7b931da-1) to root...
Downloading https://fw.gl-inet.com/releases/v19.07.8/packages-3.0/ath79/packages/luci-app-statistics_git-21.189.23240-7b931da-1_all.ipk
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-statistics:
 *      collectd
 *      collectd-mod-rrdtool
 *      collectd-mod-iwinfo
 *      collectd-mod-cpu
 *      collectd-mod-memory
 *      collectd-mod-interface
 *      collectd-mod-load
 *      collectd-mod-network
 * opkg_install_cmd: Cannot install package luci-app-statistics.

I’ll be honest, I’m not familiar with that error. Probably need to see if @alzhao can help. Maybe those sub packages aren’t available for your device?

You can try installing each of the collectd* packages individually, then try installing the luci-app-statistics package again.

I do not work for and I do not have formal association with GL.iNet

1 Like

That would make sense. I updated my notes above to include running collects first.

The collectd package is missing. Here is a temp solution for you.

Edit /etc/opkg/distfeeds.conf. Added package from openwrt, comment out first line

#src/gz glinet_packages https://fw.gl-inet.com/releases/v19.07.8/packages-3.0/ath79/packages
src/gz glinet_private https://fw.gl-inet.com/releases/v19.07.8/packages-3.0/ath79/glinet
src/gz glinet_kmod https://fw.gl-inet.com/releases/v19.07.8/kmod-3.0/ath79/nand
src/gz openwrt_packages https://downloads.openwrt.org/releases/19.07.8/packages/mips_24kc/packages/
src/gz openwrt_luci https://downloads.openwrt.org/releases/19.07.8/packages/mips_24kc/luci/
src/gz openwrt_base https://downloads.openwrt.org/releases/19.07.8/packages/mips_24kc/base/

Then you can install luci-app-statistics.

After reboot router it works.

1 Like

I am able to install the collectd package on my GL-AR750S running Firmware 3.201 without changing the /etc/opkg/distfeeds.conf file:

It seems to be missing in Firmware 3.211.

I do not work for and I do not have formal association with GL.iNet

I decided to take the nuclear option.
I setup a pi in bridge mode for the interface I want to monitor. Now I can monitor everything using whatever software I want.
Not ideal but it is going to give me more flexibility.

Thank you all for your replies.
-drd

Interesting, do you have a link to a tutorial?

Sure this covers everything: Router - Community Help Wiki.

And here are my notes. Basically we are setting up two network interfaces on a raspberry pi to work in bridge mode. That means all packets entering either of the interfaces will be sent to the other device.
The interesting thing is that you have access to the bridge device (br0) and you can inspect and do whatever you want with those packets.

# For testing manually
 sudo apt install bridge-utils
 sudo ifconfig eth1 0.0.0.0
 sudo ifconfig eth2 0.0.0.0
 sudo brctl addbr bridge0
 sudo brctl addif bridge0 eth1
 sudo brctl addif bridge0 eth2
 sudo ifconfig bridge0 up

# To make it permanent:
$ sudo cat  /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:

source /etc/network/interfaces.d/*

# This is the new part
auto br0
iface br0 inet static
    address 0.0.0.0
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.0.255
    bridge-ports eth1 eth2

I do not set an ip address because I have another interface (eth0, the one that comes with the pi) connected to another network so I can ssh into the box using that interface. I also have the wlan0 interface setup for redundancy.

Once all is setup you just need to power the pi and connect ethernet cables to the right places: one coming from your router(gl-inet device) and another one coming from the your network switch.

Let me know if that makes sense.