opnsense / plugins

OPNsense plugin collection
https://opnsense.org/
BSD 2-Clause "Simplified" License
832 stars 618 forks source link

Vnstat: Statistics tabs not showing #3174

Closed MichaelTrip closed 1 year ago

MichaelTrip commented 1 year ago

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

When i try to open the Services menu --> VNStat --> Hourly statistics, or daily or monthly or Yearly Statistics, the screen remains empty.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'services'
  2. Click on 'VnSat'
  3. click on 'any of the statistics'
  4. Empty

Expected behavior Seeing statistics of vnstat. It is working on the cli though.

Screenshots

2022-10-25T15:28:53,258008749+02:00 2022-10-25T15:28:58,736087541+02:00

Environment

OPNsense 22.7.6-amd64 FreeBSD 13.1-RELEASE-p2 OpenSSL 1.1.1q 5 Jul 2022

patschi commented 1 year ago

Do you have more than 4 interfaces selected in the vnstat settings? I know there's some known restriction/bug that when you select too much interfaces, it stops working. Apparently some *nix-kernel restriction, if I recall.

Seeing statistics of vnstat. It is working on the cli though.

What is the exact command you're running on the CLI?

MichaelTrip commented 1 year ago

Do you have more than 4 interfaces selected in the vnstat settings? I know there's some known restriction/bug that when you select too much interfaces, it stops working. Apparently some *nix-kernel restriction, if I recall.

I have selected al of my 10 interface. I have now selected only 4 of them. Still no change.

Seeing statistics of vnstat. It is working on the cli though.

What is the exact command you're running on the CLI?

just running vnstat

root@OPNsense:~ # vnstat

                      rx      /      tx      /     total    /   estimated
 enc0:
       Oct '22           0 B  /         0 B  /         0 B  /     --     
     yesterday           0 B  /         0 B  /         0 B
         today           0 B  /         0 B  /         0 B  /     --     

 igb0:
       Oct '22      1.17 TiB  /    1.25 TiB  /    2.42 TiB  /    3.03 TiB
     yesterday    118.78 GiB  /   99.10 GiB  /  217.89 GiB
         today    121.04 GiB  /  122.21 GiB  /  243.25 GiB  /  288.29 GiB

 igb0_vlan1100:
       Oct '22           0 B  /         0 B  /         0 B  /     --     
     yesterday           0 B  /         0 B  /         0 B
         today           0 B  /         0 B  /         0 B  /     --     

 etc..
DjSni commented 1 year ago

here too have the same issue

OPNsense-bot commented 1 year ago

This issue has been automatically timed-out (after 180 days of inactivity).

For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.

If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.

QuarkZ26 commented 1 year ago

Please reopen this, it's still hasn't been fixed. Or provide an alternative.

mimugmail commented 1 year ago

Its a problem of vnstat itself

mpfusion commented 7 months ago

I'm having the same problem and can reproduce it with OPNsense 24.1.1-amd64 and vnStat 2.11. I've selected a single interface and the tabs are empty. The vnstat command does produce output, so that's working.

I'm surprised to see this bug closed if it's still an unsolved issue.

QuarkZ26 commented 6 months ago

It's actually working now for me, though I don't really know why since I hadn't used it since it was broken. I reinstalled Opnsense from scratch at some point and it's likely the reason.

A few days ago, I decided to try again, installed the plugin, deselected/reselected WAN in the options, and it's working. If it's not working for you, then I'm guessing there's some remnant files that needed cleaned up on the system itself.

mpfusion commented 6 months ago

I reset the config and now the stats appear, indeed. This sadly deleted the history, though. But at least the stats show up now.

vergoh commented 6 months ago

Do you have more than 4 interfaces selected in the vnstat settings? I know there's some known restriction/bug that when you select too much interfaces, it stops working. Apparently some *nix-kernel restriction, if I recall.

Mainly for future reference, this limitation was caused by the interface name being limited to 31 characters which often resulted in around 4 interfaces being the limit when the interface1+interface2+... syntax was used (which is something this plugin does). This limitation no longer exists start from vnStat 2.10.

Its a problem of vnstat itself

As already pointed out, vnstat will still produce results from CLI which suggests the issue is somewhere in the plugin's implementation.

I reset the config and now the stats appear, indeed.

I've tried to understand how the plugin has been implemented and "Reset" appears to only be removing the database directory and then proceeding the same flow as pressing "Save" would. There aren't any plugin related files being stored in vnStat's database directory so it's rather strange "Reset" would result in the situation something fixing itself, unless it's somehow some file/directory permission issue. In that case, one of the system logs should contain some error message indicating what the issue is.

lexxxel commented 1 month ago

Do you have more than 4 interfaces selected in the vnstat settings? I know there's some known restriction/bug that when you select too much interfaces, it stops working. Apparently some *nix-kernel restriction, if I recall.

Mainly for future reference, this limitation was caused by the interface name being limited to 31 characters which often resulted in around 4 interfaces being the limit when the interface1+interface2+... syntax was used (which is something this plugin does). This limitation no longer exists start from vnStat 2.10.

I have this issue with one single interface. I added a second WAN and whenever I switch over to that OR any other interface except the original WAN, I see empty tabs. Only if I select the first WAN, I do get the tabs with the correct tables.

Turns out, vnstat interface might not correlate with the options given in opnsense. For example, I have an PPPoE connection via a VLAN and that interface is the same as my LAN. If I select that PPPoE interface, I will get an empty response. If you have this error, run vnstat on the machine and check if the interface match with the selected ones in the opnsense UI or run vnstat -h and see if you get an error.