My solution to this problem was to encode the LTE band, cell id, etc into the plugin name:
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_rsrq\" N:${RSRQ}"
It produces a lot a of graphs, because my modem often thinks it's connected to cells that it doesn't get any signal from. But that's still useful data to me. If that annoyed you you could easily filter out results with no signal, or a cell id of 0, etc.
My exec script that gets signal info from my Huawei E5186 modem is below:
#!/bin/sh
# response when no session cookie set:
# <?xml version="1.0" encoding="UTF-8"?>
# <error>
# <code>125002</code>
# <message></message>
# </error>
# response when connected to LTE and session cookie set:
# <?xml version="1.0" encoding="UTF-8"?>
# <response>
# <pci>123</pci>
# <sc></sc>
# <cell_id>12345678</cell_id>
# <lac>12345</lac>
# <rsrq>-16dB</rsrq>
# <rsrp>-106dBm</rsrp>
# <rssi>-75dBm</rssi>
# <sinr>-3dB</sinr>
# <rscp></rscp>
# <ecio></ecio>
# <mode>7</mode>
# <band>28</band>
# </response>
MODEM=192.168.8.1
TMPOUTPUT=/tmp/collectd-signal.xml
TMPERR=/tmp/collectd-signal-err.txt
TMPCOOKIES=/tmp/collectd-signal-cookies.txt
curl --silent --cookie $TMPCOOKIES http://${MODEM}/api/device/signal 2> $TMPERR > $TMPOUTPUT || exit 1
if grep -F '<code>125002</code>' $TMPOUTPUT 2> /dev/null > /dev/null
then
curl --silent --cookie-jar $TMPCOOKIES http://${MODEM}/html/home.html 2> $TMPERR > $TMPOUTPUT || exit 1
curl --silent --cookie $TMPCOOKIES http://${MODEM}/api/device/signal 2> $TMPERR > $TMPOUTPUT || exit 1
fi
# strip windows line endings
sed -i 's/\r$//g' $TMPOUTPUT
# cell info
CELL_ID=$(sed -r -n 's@<cell_id>(.*)</cell_id>@\1@p' $TMPOUTPUT 2>> $TMPERR)
CELL_ID=${CELL_ID:0}
LAC=$(sed -r -n 's@<lac>(.*)</lac>@\1@p' $TMPOUTPUT 2>> $TMPERR)
LAC=${LAC:0}
BAND=$(sed -r -n 's@<band>(.*)</band>@\1@p' $TMPOUTPUT 2>> $TMPERR)
BAND=${BAND:0}
MODE=$(sed -r -n 's@<mode>(.*)</mode>@\1@p' $TMPOUTPUT 2>> $TMPERR)
MODE=${MODE:0}
# LTE
PCI=$(sed -r -n 's@<pci>(.*)</pci>@\1@p' $TMPOUTPUT 2>> $TMPERR)
PCI=${PCI:U}
RSRQ=$(sed -r -n 's@<rsrq>(.*)dB</rsrq>@\1@p' $TMPOUTPUT 2>> $TMPERR)
RSRQ=${RSRQ:U}
RSRP=$(sed -r -n 's@<rsrp>(.*)dBm</rsrp>@\1@p' $TMPOUTPUT 2>> $TMPERR)
RSRP=${RSRP:U}
RSSI=$(sed -r -n 's@<rssi>(.*)dBm</rssi>@\1@p' $TMPOUTPUT 2>> $TMPERR)
RSSI=${RSSI:U}
SINR=$(sed -r -n 's@<sinr>(.*)dB</sinr>@\1@p' $TMPOUTPUT 2>> $TMPERR)
SINR=${SINR:U}
# UMTS
SC=$(sed -r -n 's@<sc>(.*)</sc>@\1@p' $TMPOUTPUT 2>> $TMPERR)
SC=${SC:U}
RSCP=$(sed -r -n 's@<rscp>(.*)dB.?</rscp>@\1@p' $TMPOUTPUT 2>> $TMPERR)
RSCP=${RSCP:U}
ECIO=$(sed -r -n 's@<ecio>(.*)dB.?</ecio>@\1@p' $TMPOUTPUT 2>> $TMPERR)
ECIO=${ECIO:U}
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_rsrq\" N:${RSRQ}"
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_rsrp\" N:${RSRP}"
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_rssi\" N:${RSSI}"
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_sinr\" N:${SINR}"
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_rscp\" N:${RSCP}"
echo "PUTVAL \"${COLLECTD_HOSTNAME}/exec-signal_lac${LAC}_cell${CELL_ID}_band${BAND}/signal_ecio\" N:${ECIO}"
I added the following lines to add the following lines to /usr/share/collectd/types.db:
signal_rsrq value:GAUGE:U:U
signal_rsrp value:GAUGE:U:U
signal_rssi value:GAUGE:U:U
signal_sinr value:GAUGE:U:U
signal_rscp value:GAUGE:U:U
signal_ecio value:GAUGE:U:U
As I'm using a snapshot build, I had to use the new javascript version of the graphing interface- apparently the lua is being replaced with javascript (see for example here https://github.com/openwrt/luci/issues/3719). But they are very similar. This link shows how to do the lua version: https://openwrt.org/docs/guide-user/perf_and_log/statistic.custom.
This went in /www/luci-static/resources/statistics/rrdtool/definitions/exec.js :
/* Licensed to the public under the Apache License 2.0. */
'use strict';
'require baseclass';
return baseclass.extend({
title: _('Signal'),
rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
var rsrq = {
per_instance: true,
title: "%H: RSRQ %pi",
vlabel: "dB",
data: {
types: [ "signal_rsrq" ],
options: {
signal_rsrq: {
color: "ff0000",
title: "RSRQ (dB)",
noarea: true,
overlay: true
}
}
}
};
var rsrp = {
per_instance: true,
title: "%H: RSRP %pi",
vlabel: "dBm",
data: {
types: [ "signal_rsrp"],
options: {
signal_rsrp: {
color: "00ff00",
title: "RSRP (dBm)",
noarea: true,
overlay: true
}
}
}
};
var rssi = {
per_instance: true,
title: "%H: RSSI %pi",
vlabel: "dBm",
data: {
types: [ "signal_rssi" ],
options: {
signal_rssi: {
color: "0000ff",
title: "RSSI (dBm)",
noarea: true,
overlay: true
}
}
}
};
var sinr = {
per_instance: true,
title: "%H: SINR %pi",
vlabel: "dB",
data: {
types: [ "signal_sinr" ],
options: {
signal_sinr: {
color: "ff00ff",
title: "SINR (dB)",
noarea: true,
overlay: true
}
}
}
};
var rscp = {
per_instance: true,
title: "%H: RSCP %pi",
vlabel: "dBm",
data: {
types: [ "signal_rscp" ],
options: {
signal_rscp: {
color: "00ff00",
title: "RSCP (dBm)",
noarea: true,
overlay: true
}
}
}
};
var ecio = {
per_instance: true,
title: "%H: ECIO %pi",
vlabel: "dB",
data: {
types: [ "signal_ecio" ],
options: {
signal_ecio: {
color: "ff0000",
title: "ECIO (dB)",
noarea: true,
overlay: true
}
}
}
};
return [ rsrq, rsrp, rssi, sinr, rscp, ecio ];
}
});
This is just one of the 4 signal graphs it produces for the cell I always connect to:
Which is lovely, makes it clear the variations in speed I experience are due to load on the cell- the peaks in RSRQ are from about midnight to 5am.