Need Some insight

I would like to know if anyone currently using any script to pull information from user-manager that they can share.

My thinking is, if a search can be done for all users whose uptime is greater than lets say ‘4w’, any matching result could then be printed to a file with the users’ info then email to a specific address. The information gathered would then be email to the user telling them the billing cycle is approaching and further action can be taken on their part.

As I am learning the scripting interface, I’ll be testing some operators along with some ICE command to see what comes up. I would like anyones input, no matter how small or even just an idea of where to start.

Thanks

Hey

Here's a little something I whipped up to see if I can write something like this,
coz I need something similar. Haven't gotten to the E-mailing thing yet,
but I'll take a stab at it.
Here's what I have so far:

This is my source code just pasted. With some comments.

#define a couple of variables
:local uptime
:local count
:local usrname

Loop through all the users in User Manager

/tool user-manager user
:foreach i in=[ /tool user-manager user find subscriber=admin ] do={

#pull some data from it, and print it on screen
:set usrname [get $i name]
:set uptime [get $i uptime-used]
:put $uptime
:put $usrname

2419200 is the amount of seconds in 4 weeks.

:if ([$uptime] > 2419200) do={ :set count "Uptime over 4 Weeks" }
:if ([$uptime] < 2419200) do={ :set count "Uptime under 4 Weeks"}

tell us on screen if the user is under or over 4 weeks:

:put $count
}

So run that, and check the output. Let me know if there's a bug.
I've only tested it for Over or Under 30 Second durations - works fine.
Have two test accounts - Test1 and Test2, logged in for 34s and 12s respectively.
Generates the correct output.

I'll post my follow-ups.
Cheers!

-K

Thanks

I try this tonight

Here is a Follow Up

#define a couple of variables
:local uptime
:local count
:local usrname
:local clientname
:local clientsurname

Loop through all the users in User Manager

/tool user-manager user
:foreach i in=[ /tool user-manager user find subscriber=admin ] do={

#Pull some data from it, and print it on screen -
#You can take the PUT commands out to not display it on screen
:set usrname [get $i name]
:set uptime [get $i uptime-used]
:set clientname [get $i first-name]
:set clientsurname [get $i last-name]
:put $uptime
:put $usrname
:put $clientname
:put $clientsurname

30s is the amount of uptime that I am testing for:

:if ([$uptime] > 30) do={ :set count "Uptime over 30 Seconds" }
:if ([$uptime] < 30) do={ :set count "Uptime under 30 Seconds"}

tell us on screen if the user is under or over 30 Seconds: - again, you can take this out

:put $count

#Now, send an E-mail to the user that greets the user by name with his Over-Uptime status:
:if ([$count] = "Uptime over 30 Seconds") do={/tool e-mail send to=client@yourISP.com from=you@yourISP.com server=1.2.3.4 body="Dear $clientname $clientsurname

You have reached your allowed uptime.
Your current uptime is $uptime

To purchase more uptime, please go to http://www.mywebsite.co.za

Thanks
MyWISP Admin"
}
}

I hope this is of any help to you.
It's helping me a lot!!

-Krige

Hi Krige

I used your accounting script from the WiKi and rewrote several parts of it.

I managed to use the transfer-limit from UM instead of the one you specified using the comment field.

Currently the script sends out notifications when a user reach 50%, 75%, 90% and also when a user is capped. It also sends me an email telling me what was sent to the user, and the moment a user is capped, I also get an e-mail.

I went one step further and wrote another script to send me all the 50%, 75%, 90% and capped users in seperate E-Mails DAILY. It is sometimes nice to know who’s approching their cap and who already got capped.

Usermanager lacks the functionality to sort by the amount of GB or MB is left of users’ cap, so this is my little workaround for that.

If anyone is interested in the script, please let me know so I can past it!

G