<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>QRDN - OpenWRT</title><link href="https://blog.qrdn.de/" rel="alternate"/><link href="https://blog.qrdn.de/feeds/tag/openwrt.atom.xml" rel="self"/><id>https://blog.qrdn.de/</id><updated>2024-09-26T00:00:00+02:00</updated><subtitle>quite random domain name</subtitle><entry><title>Monitoring a freifunk node</title><link href="https://blog.qrdn.de/2024/monitoring-a-freifunk-node.html" rel="alternate"/><published>2024-09-26T00:00:00+02:00</published><updated>2024-09-26T00:00:00+02:00</updated><author><name>dragon</name></author><id>tag:blog.qrdn.de,2024-09-26:/2024/monitoring-a-freifunk-node.html</id><summary type="html">&lt;p&gt;I own/operate a freifunk router, running the &lt;a href="https://darmstadt.freifunk.net/"&gt;Freifunk Darmstadt&lt;/a&gt; firmware which is based on gluon, which itself is based on OpenWRT.&lt;/p&gt;
&lt;p&gt;I'd like to monitor the operation of my node (e.g. wifi client count on 2.4 and 5 GHz), but I want to avoid building my own …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I own/operate a freifunk router, running the &lt;a href="https://darmstadt.freifunk.net/"&gt;Freifunk Darmstadt&lt;/a&gt; firmware which is based on gluon, which itself is based on OpenWRT.&lt;/p&gt;
&lt;p&gt;I'd like to monitor the operation of my node (e.g. wifi client count on 2.4 and 5 GHz), but I want to avoid building my own firmware image. I already have prometheus and grafana running, so all I need is a node_exporter on the device exporting metrics over HTTP. I can install such with &lt;code&gt;opkg install prometheus-node-exporter-lua&lt;/code&gt;, but whenever the autoupdater installs a new firmware version (often), I'd have to manually repeat that installation.&lt;/p&gt;
&lt;p&gt;As noted &lt;a href="https://github.com/freifunk-gluon/gluon/wiki/Commandline-administration#update-proof-way"&gt;in the gluon wiki&lt;/a&gt; this can be automated using &lt;code&gt;/etc/rc.local&lt;/code&gt; which is run on each boot. Just add the following snippet (before the closing &lt;code&gt;exit 0&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;!&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;test&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/prometheus-node-exporter-lua&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
sh&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;sleep 60 &amp;amp;&amp;amp; \&lt;/span&gt;
&lt;span class="s1"&gt;  logger &amp;quot;installing prometheus-node-exporter-lua&amp;quot;&lt;/span&gt;
&lt;span class="s1"&gt;  opkg update&lt;/span&gt;
&lt;span class="s1"&gt;  opkg install prometheus-node-exporter-lua \&lt;/span&gt;
&lt;span class="s1"&gt;    prometheus-node-exporter-lua-nat_traffic \&lt;/span&gt;
&lt;span class="s1"&gt;    prometheus-node-exporter-lua-netstat \&lt;/span&gt;
&lt;span class="s1"&gt;    prometheus-node-exporter-lua-openwrt \&lt;/span&gt;
&lt;span class="s1"&gt;    prometheus-node-exporter-lua-wifi \&lt;/span&gt;
&lt;span class="s1"&gt;    prometheus-node-exporter-lua-wifi_stations&lt;/span&gt;
&lt;span class="s1"&gt;  logger &amp;quot;installing prometheus-node-exporter-lua returned $?&amp;quot;&lt;/span&gt;
&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Waiting 60 seconds after boot hopefully is enough for the WAN network to be up.&lt;/p&gt;
&lt;p&gt;Correct operation can be tested by running the file manually: &lt;code&gt;bash /etc/rc.local&lt;/code&gt; and checking for the "installing ... returned ..." line with &lt;code&gt;logread -f&lt;/code&gt;.&lt;/p&gt;</content><category term="misc"/><category term="en"/><category term="computer"/><category term="OpenWRT"/></entry></feed>