Monitor traffic through ports/interfaces

I have a cellular router in the wild and it has a built in 4 port switch. Is there a way to monitor the amount of bandwidth that passes through one or all of these interfaces? I have an alert that this device used 50GB of data, but when I look at my graphs for the past one day, two days, one week, one month, I don’t see any obvious data spikes indicating that a particular day/days/weeks/etc had high, consistent usage.

In this case, I believe the ISP data is correct, but I’m not about to get the data out of librenms. I know that the graphs only monitor every 5 minutes, that should be fine for this request, it would take more than 5 minutes of use to hit 50GB in a 30 day billing cycle.


The billing module should do exactly what you need.

1 Like

Where is config.php located and is this being done as the libre user or root? Thanks.

/opt/librenms, and as librenms user.

Thanks, now that I’ve done that, I do see ‘Traffic Bills’ under the ports section, I’m going to click + Create Bill and see if I can get the system to do what I need, thanks for the information.


I’m not sure how to proceed to make sure I get the information I need.

What do I put in the CDR value box? Is this the data that this cellular card is limited to? At this point, I’m not concerned with actually billing the user of the cellular card, I just want to see where/how much usage is being used by the cellular card.


Edit- I set the CDR value to 10 Gbps, I guess I’ll see how this works after there is enough data.


It has almost been 24 hours since I’ve enabled the billing module and I’m seeing one device with almost 60GB under the ‘Total’ column in the bill viewing section. I’m not seeing the data over the course of a day, two days, etc… indicating that 50GB of traffic has passed through the device. Am I missing something?


Hi @dt-lib
I never used it. So I cannot help you. May be you could open a new post describing your issue, with “Billing” in the title. I know some operators around are using it and may be able to help you.


I just realized this…I only made the edit to the config.php file, I completely missed this edit

*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1

What happens if I don’t add those two lines?


The 1st one collects the values (counters every 5 minutes) and the 2nd one computes the reports every minute. You could compute the reports less often without any impact (other than having reports out of date). But both lines are necessary for sure.

Understood, thanks. I tried to add those lines and received an error. Can that file not be edited while certain services are running?

Those 2 script must run freely as librenms user. You can try them directly from your CLI, without the error redirection. If you have any error, then you’ll have to fix them.


Ok, I can try to run them manually and see what happens, but when I attempt to follow the instructions and add those two lines to the file, I can’t save the file w/o getting an error.

Edit- I can run them, manually, seems ok to me. However, I need to save to the config, w/o getting the error.

“Nice, valid counters ‘in/out_measurement’, lets use them”
“Updated! Updated history!”

Just re-reading this message : Those 2 lines must be added to crontab (/etc/crond.d/librenms). If you add them to config.php, it will certainly fail :slight_smile:

I was not clear in my post, that was my fault. I meant to say I only made the first change to the config.php file, with success. I missed the second change that needed to be made, which I tried to add here, /etc/cron.d/librenms.

I guess I’ll try it again and this time I will include the error.



When I attempt to edit the file, I see this ’ W10: Warning: Changing a readonly file’


You have to be root to change the crontab files.

I don’t mean this in a negative way and maybe it has a lot/everything to do with my limited understanding of librenms and linux, but why isn’t that information included in the documentation? For the config.php change, the librenms user was used and I just assumed the same could be done for the librenms file.

You are right. Probably just because whoever wrote it knew it and didn’t even think of writing it.

It would be very helpful if you can add it to the documentation (you can edit it directly) and submit your correction so it will be corrected for next time ? As well as any other difficulty you may have faced ? We need as many eyes and fingers as possible :smiley:

I never knew I could make changes and have them go for review, I won’t be doing that, I’m not the right person, look at all the struggling I’m going through now.

I donated to librenms, it has helped me tremendously. I wish I had better success with updates, but I get stuck in certain spots and have tried my best to get past those updates in the forums, but no luck. It is what it is, it still works for now, which is what matters.

Thank you for your comment on the user change, now I was able to add those two lines and save.