Community discussions

MikroTik App
 
steven0
just joined
Topic Author
Posts: 12
Joined: Thu Sep 18, 2014 9:45 pm

monthly data per IP

Thu Aug 12, 2021 9:58 pm

Hi All,
Does anyone know something simple to keep track of data per IP on a central page ?
For a small housing complex i am looking for a simple solution to allow the users to monitor their monthly data.
Each user has a static IP. Each IP has a queue to limit the speed.

Ideal would be a simple page on a server that keeps track of hourly, daily, weekly and monthly data.

Is there something already out there or would i need to start trying to get my head around the scripting again ?
Had something in the past that would run a script on the mikrotik, it fetched a file on the server and placed the data of the queues there
User would put in their "username" and it would display the data. I lost those scripts after a meltdown of a disk and never got around re-doing it.

Greetings
Steve
ps i do not use fasttrack
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: monthly data per IP

Fri Aug 13, 2021 12:22 am

Take a look at graphing. You can limit access to a single IP address for each queue. The end user can see it as a simple web page.
Not very high tech, but might accomplish what you want.
 
steven0
just joined
Topic Author
Posts: 12
Joined: Thu Sep 18, 2014 9:45 pm

Re: monthly data per IP

Fri Aug 13, 2021 11:55 am

K6ccc, i have graphing enabled for some interfaces but it does not give totals?
Max In: 3.46Mb; Average In: 1.14Mb; Current In: 311.58Kb;
Max Out: 33.96Mb; Average Out: 7.15Mb; Current Out: 5.23Mb;
Am i overlooking a way to add the totals to the graphing ?
(indeed it would be a nice way to do it)

Greets
Steve
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: monthly data per IP

Fri Aug 13, 2021 12:36 pm

Take a look at Splunk for MikroTik, see link in my signature.

There I do use the accounting functionality to get traffic and graph it under "MikroTik Accouning Traffic" dashboard.
Works for all Router OS 6.x

Just as a test I looked at my wife phone. She as downloaded 85GB and sent 5.4GB last 30 days.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 985
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: monthly data per IP

Fri Aug 13, 2021 1:02 pm

K6ccc, i have graphing enabled for some interfaces but it does not give totals?
Max In: 3.46Mb; Average In: 1.14Mb; Current In: 311.58Kb;
Max Out: 33.96Mb; Average Out: 7.15Mb; Current Out: 5.23Mb;
Am i overlooking a way to add the totals to the graphing ?
(indeed it would be a nice way to do it)

Greets
Steve
Functions like "accounting" or "volumetric totals" (= adding up to get totals over a time-period) are not done by Mikrotik. You will always see throughput in the graphs (Kbytes/sec / MBytes/sec etc)
Mikrotik will not do the summing/accounting for you, or at least not that I have found out ;-)

There are dozens of scripts (Perls, Python etc) that can perform this action, but they all will be running on a separate machine. Perhaps there exist some "free" cloud-based graphing solution that can be used, but you probably have to pre-process/parse the data a bit before ingestion. You don't have any onsite compute resources running ?
 
steven0
just joined
Topic Author
Posts: 12
Joined: Thu Sep 18, 2014 9:45 pm

Re: monthly data per IP

Fri Aug 13, 2021 2:32 pm

You don't have any onsite compute resources running ?
Onsite nothing, but the location does have its own website, thats why some mikrotik based scripts and a php "collector" page would be ideal.
Just trying not to reinvent the wheel if something is already out there.
There used to be a set of scripts that would run completely inside the mikrotik and email the users but can not find even those any more
(they seem to be removed from the mikrotik wiki)

Jotne, Splunk is great but a bit overdone for this purpose only.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 985
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: monthly data per IP

Fri Aug 13, 2021 3:07 pm

You don't have any onsite compute resources running ?
Onsite nothing, but the location does have its own website, thats why some mikrotik based scripts and a php "collector" page would be ideal.
Just trying not to reinvent the wheel if something is already out there.
There used to be a set of scripts that would run completely inside the mikrotik and email the users but can not find even those any more
(they seem to be removed from the mikrotik wiki)

Jotne, Splunk is great but a bit overdone for this purpose only.
Ah and remember that in ROS 7.x the "accounting" feature is completely GONE and cannot be exported anymore. (so I'm told)
So if (ever) RouterOS 7.x reaches maturity and you need to update your devices for some reason .....
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: monthly data per IP

Fri Aug 13, 2021 5:06 pm

Ah and remember that in ROS 7.x the "accounting" feature is completely GONE and cannot be exported anymore. (so I'm told)
So if (ever) RouterOS 7.x reaches maturity and you need to update your devices for some reason .....
[/quote]

I can confirm that current beta of ROS v7.x does not have accounting (for the moment), so I am looking into how to use netflow with splunk.
Sadly not a simple process.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 985
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: monthly data per IP

Fri Aug 13, 2021 5:10 pm

I can confirm that current beta of ROS v7.x does not have accounting (for the moment), so I am looking into how to use netflow with splunk.
Sadly not a simple process.
:lol: :D
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: monthly data per IP

Fri Aug 13, 2021 5:20 pm

K6ccc, i have graphing enabled for some interfaces but it does not give totals?
Max In: 3.46Mb; Average In: 1.14Mb; Current In: 311.58Kb;
Max Out: 33.96Mb; Average Out: 7.15Mb; Current Out: 5.23Mb;
Am i overlooking a way to add the totals to the graphing ?
(indeed it would be a nice way to do it)
Correct on no totals. As I said, a simple solution that is simple to implement.
 
steven0
just joined
Topic Author
Posts: 12
Joined: Thu Sep 18, 2014 9:45 pm

Re: monthly data per IP

Sun Aug 15, 2021 12:31 pm

Ah and remember that in ROS 7.x the "accounting" feature is completely GONE and cannot be exported anymore. (so I'm told)
So if (ever) RouterOS 7.x reaches maturity and you need to update your devices for some reason .....
That would really be a shame, i use the accounting in combination with the old Attix software on windows
But perhaps something else will come in its place
 
steven0
just joined
Topic Author
Posts: 12
Joined: Thu Sep 18, 2014 9:45 pm

Re: monthly data per IP

Mon Aug 16, 2021 3:37 pm

In the end i took this (its enough to start with)
https://github.com/muhannad0/mikrotik-traffic-counter

Made the script on the mikrotik like this and set a schedule to run every 10 minutes:
{
:local queueList [/queue simple find]
:foreach Client in=$queueList do={
:local ClientBytes [/queue simple get $Client bytes]
:local ClientName [/queue simple get $Client name]
:local BeforeSlash [:find $ClientBytes "/" -1 ]
:local ClientTXbytes [:pick $ClientBytes 0 $BeforeSlash ]
:local AfterSlash [:find $ClientBytes "/" +1 ]
:local ClientRXbytes [:pick $ClientBytes ($AfterSlash + 1) 255 ]
/tool fetch keep-result=no url=("https://yourserverurl/collector.php?sn=$ClientName&rx=$ClientRXbytes&tx=$ClientTXbytes")}
}
/queue simple reset-counters-all

For sure there are better ways to do it, and my "script skills" are very rusty ;)

Greets and thanks for thinking along

Who is online

Users browsing this forum: Bing [Bot], rplant and 33 guests