Vnstat no longer works after changing network card

Started by calania, May 31, 2024, 05:06:39 PM

Previous topic - Next topic
Hello! I am running opnsense 24.1.6 and have been using vnstat for roughly a year but am having issues with it since I swapped my network card. My wan (which is the network I'm montering with vnstat) used to use the port of my old network card called em0 however I have now replaced that network card and my wan is now on igb0 on the new network card. My lan used to be Re0 on the motherboard but is now lgb1 on the same network card.

Since switching, the vnstat statistics have been blank in the vnstat tab and nothing is showing. In the log it says

2024-05-23T21:28:09 Notice vnstatd Interface "em0" disabled.
2024-05-23T21:28:09 Notice vnstatd Monitoring (6): wg0 (1000 Mbit) re0 (1000 Mbit) pfsync0 (1000 Mbit) pflog0 (1000 Mbit) enc0 (1000 Mbit) em0 (1000 Mbit)
2024-05-23T21:28:09 Notice vnstatd Data retention: 48 5MinuteHours, 4 HourlyDays, 62 DailyDays, 25 MonthlyMonths, -1 YearlyYears, 20 TopDayEntries
2024-05-23T21:28:09 Notice vnstatd vnStat daemon 2.12 (pid:50245 uid:284 gid:284, SQLite 3.45.1)
2024-05-23T21:28:09 Notice vnstatd SIGTERM received, exiting.


as you can see igb0 and igb1 is missing from the monitoring section. I could probably just press the reset button in the vnstat dashboard but I would if possible like to keep the old statistics.

I have copied the vnstat database from /var/lib/vnstat to my computer and if I look in the interface tab of the database I can see that igb0 and igb1 is missing. If I would want to keep the old statistics could I simply rename the interface called em0  (in the name column) with the id 1 to igb0 and add a new row with the id 7 for igb1? Igb0 should then continue the statistics where em0 left off right? Is there anything else I would need to change? I have attached an image of how the interface tab of the database looks like. Thanks!


I decided to do like I said I would do and modified the db myself and that seem to have worked. It should however probably be changed so that Opnsense automatically adds new interfaces to the db file