Page 1 of 1

creating e-mail every 1st of month with amount of each user

Posted: Wed Jan 26, 2005 1:13 pm
by bluenobbe
I need a script that create email with the amount of up and download traffic every 1st day in month after that action the script resets the traffic counter of each pppoe-user.

Thank you for help!

I hope my English is good enough to understand...


Posted: Wed Jan 26, 2005 1:24 pm
by edzix
i woul suggest you to use some accounting software to accomplish this. You are welcome to take a look at our application called HotSpot Manager:


Posted: Wed Jan 26, 2005 2:56 pm
by bluenobbe
i don`t want to use a Radius Server

Posted: Wed Jan 26, 2005 2:57 pm
by normis
what's the problem with that? it will only make your life easier

Posted: Wed Jan 26, 2005 3:22 pm
by bluenobbe
the mikrotik hotspot manager have no option to count the amount of traffic up and download together. And my ISP count the traffic in MB not in online-time.I have only 8 User to count and so i think a radius server is too complex. :roll:

Posted: Wed Jan 26, 2005 3:46 pm
by edzix

you are wrong! HS Manager supports such a feature. Select necessary users, click on the Sessions button. Then press Print Logs, make sure that Download and Upload are checked and you will be able to the to total count of TX and RX traffic at the bottom of the table.


Posted: Wed Jan 26, 2005 4:09 pm
by bluenobbe
but in that way i have no automatical report of user-traffic.
My ISP calculate from the 1st to the next 1st in month.
In my opinion is a script the better way to count the traffic.
So i have a minimum of Expenditure.

Posted: Wed Jan 26, 2005 4:29 pm
by edzix
we will add a new field where you will be able to choose time period when exporting logs to the PDF.


Posted: Wed Jan 26, 2005 5:38 pm
by bluenobbe
It sounds good!!!
When do implement that feature?

Posted: Wed Jan 26, 2005 6:10 pm
by edzix
ok, added!
It's placed right there when you will click Print Logs button. In the next window check advanced logs check-box and you will see selected users' logs during specified time period.


Hotspot Manager

Posted: Sat Feb 05, 2005 7:47 pm
by Elfchen
i woul suggest you to use some accounting software to accomplish this. You are welcome to take a look at our application called HotSpot Manager:

Fine - but there is no download link .... how should I use a software without download?

Posted: Sun Feb 06, 2005 3:46 pm
by cmit
The MikroTik HotSpot Manager is not an application you can download and install - it's an online service you just use.

New Desires to the Online Hotspotmanager

Posted: Thu Feb 10, 2005 11:54 am
by bluenobbe
1. Count the traffic and pay for traffic ($ per MB) in the section "hour cost"
2. Count the traffic amount from 00:000 to 23:59 every day (one option is to disconnect all users at midnight)

Posted: Thu Feb 10, 2005 5:46 pm
by edzix
1.there is an idea to implement also MB based cost table; can see it in the reports if are choosing to show the report for some specific day.


amount a day

Posted: Mon Feb 14, 2005 1:29 pm
by bluenobbe
2. i've checked that but it is not correct.
example: User1 logged in at 23:00 and have a amount of traffic in the first hour of 100 MB and in the next 1 hour only 1MB
after that hour the user1 logged out.

in the logfile the amount uf 101MB is calculated in the next day and thats not correct because the amount of 100 MB is caused in the day before.
thats my problem

Posted: Mon Feb 14, 2005 2:27 pm
by cmit
The reason for this is that normally accouting data is from the Accounting-Stop packets that the NAS (here: RouterOS) sends to the RADIUS server. And this packet does contains the complete user session (i.e. all online time and data transfer) and is timestamped just when the connection is dropped. That is, the RADIUS server (where the accounting data is collected) doesn't get to know anything about the session until it's finished. This leads to the effect you see.

There' not much to do about it, though. You could use Interim RADIUS packets to update the stats while the connection still is active (i.e. every 5 minutes or so), but I'm not sure if this could be easily (i.e. out-of-the-box) used to split accounting data the way you want it.

Basically all ISPs (at least those doing tarifs by data volume) have this effect, but none of those I know do have a problem with it. That's a kind of "jitter" that will level out over some months. It's right that in theory this could lead to users not using up their "free" volumen for a day or so...

While I'm typing this I come up with an idea how you could do accurate accounting, though (at least if you operate your own RADIUS server):
You could set the Session-Timeout for each session so that the session ultimately is closed (forcefully, from the NAS) just before midnight. Then all accounting data is "billed" to the correct day, and the user could instantly login again. If that's a feasible solution, is up to you...

Posted: Mon Feb 14, 2005 5:22 pm
by bluenobbe
I have another idea to drop all user connections at midnight
Is it possible to disconnect all leases per script at midnight (timer or something else)??

Posted: Wed Feb 16, 2005 12:56 am
by YazzY
You could remotely execute command removing all the interfaces of your connected users with a cronjob.
Login with ssh/telnet -> remove ifaces and wait for calls from angry customers.
I wrote a shell script for remote login and command execution.
It works with both ssh and telnet.
It's bit fancy since I also included dialog menus (I had some spare time).
The whole thing can be easly changed to make it more suitable for running within a cronjob.
Just read the connect_ssh and connect_telnet functions.

The script is avaliable at: ... uteros.txt

I tested it with sh on FreeBSD and Gentoo Linux (where /bin/sh -> bash).