vnStat statistic tabs empty

Started by dMY1, February 10, 2024, 10:05:37 AM

Previous topic - Next topic
The vnStat statistic tabs are empty. I found a bug report from 2022 reporting the same issue: https://github.com/opnsense/plugins/issues/3174. However, the bug report is closed, although several people (including me) appear to still have the issue. Why is it closed then?

I've selected only a single interface and the tabs are empty. vnstat itself produces output. So that's working. Any idea how to get the statistic tabs show the desired stats?

OPNsense 24.1.1-amd64
vnStat 2.11

February 13, 2024, 03:33:55 AM #1 Last Edit: February 13, 2024, 03:35:55 AM by Dantichrist
It's working fine here. The info shows up on all tabs.

I didn't want to invest time in figuring it out. I reset them from the General tab and now they work again. Next time I'll backup the db first I think.

I haven't yet managed to reproduce the issue but I suspect it has something to do with the way the plugin has been implemented. At least the "Interface" setting has some sort of misunderstanding in its implementation as it's modifying the "Interface" keyword in the vnStat configuration file when set and leaving it out when nothing is selected. The help text claims "Set the interface to listen on." while in reality the "Interface" configuration selects only the interface that is expected to be shown in the command outputs when none is specified and when the automatic selection doesn't result in the expected interface getting selected. The daemon will always ignore this setting when it selects which interfaces to monitor. I can also see that it hasn't been configured to automatically start monitoring all new interfaces after the first startup so it will have only visibility of those interfaces that were present when first enabled. "Reset" may also misbehave as it doesn't appear to be stopping the daemon first before removing the database directory.

Check "Web GUI", "General" and "Backend" logs from System -> Log Files after first visiting any of the vnStat tabs that are empty. In the logs, you'll want to search for "vnstat" using the "Notice" log level. The "General" log should show that the daemon has started and hasn't produced any error. There's a line starting with "Monitoring" which will list all the interfaces that are currently being monitored. For the plugin page not working, I'd expect there to be some error or other clue of the issue in either the "Web GUI" or "Backend" log.

If those don't show anything unexpected, you could also try clearing the interface selecting on the General tab for the plugin and hitting save. That will result in the configuration file getting recreated from an old version template but without the "Interface" line which then forces the default interface output selection back to play. If the traffic tabs still show no content after this and the logs don't contain anything relevant then the issue is somewhere deeper within the plugin's implementation.