ispCP - Board - Support
Domain Disk and Traffic Usage Report - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Enhancements (/forum-43.html)
+--- Thread: Domain Disk and Traffic Usage Report (/thread-4624.html)

Pages: 1 2 3


Domain Disk and Traffic Usage Report - FeG - 10-06-2008 10:19 PM

Hi all,

after forgetting everytime to look after my customers disk and traffic usage, I've written a little perl script which does this job an prints a little report (like the reseller's domain_statistics.php).

By adding the following cronjob:
Code:
# ispCP - Domain Disk and Traffic Usage Report
0 0 * * 1 /your/path/to/ispcp-domainreport.pl | mail -s "ispCP - Domain Disk and Traffic Usage Report" admin@yourdomain.com

you'll get a mail with the current domain statistics every monday morning.

I hope someone can make use of this; if I can enhance it some way, please tell me so..

This also may be a feature for ispCP > 1.0.0 ...

Regards
FeG

Edit: Attachment and Code removed, see for newer version below...


RE: Domain Disk and Traffic Usage Report - DaSilva - 10-07-2008 03:44 AM

Works very well.
Can you add that >90% used limits are displayed in red?
And how can I change the sender? I always get it from "root" but "ispCP Disk & Traffic Watcher" would be better.
Thanks in advance.


RE: Domain Disk and Traffic Usage Report - FeG - 10-07-2008 04:13 AM

Hi,

(10-07-2008 03:44 AM)DaSilva Wrote:  Can you add that >90% used limits are displayed in red?
This is pure text, no html... I don't think we need html here.. one could add * around the % value, which makes some mail clients display the text in between bold.. I'll have a look, I'm not sure at the moment if it was * ...

Quote:And how can I change the sender? I always get it from "root" but "ispCP Disk & Traffic Watcher" would be better.

Since this is the default *nix mail-command, you can give additional headers as parameters.. So you could do something like this:

Code:
0 0 * * 1 /your/path/to/ispcp-domainreport.pl | mail -a "From: ispCP Disk & Traffic Watcher <admin@yourdomain.com>" -s "ispCP - Domain Disk and Traffic Usage Report" admin@yourdomain.com

Thanks for your response..

Regards
FeG


RE: Domain Disk and Traffic Usage Report - BeNe - 10-07-2008 04:36 PM

Thats it!!! Thanks FeG.
I use it since yesterday on my Server Smile

Greez BeNe


RE: Domain Disk and Traffic Usage Report - FeG - 10-07-2008 06:16 PM

Hi,

I liked the suggestion to add a notice if a domain has high disk or traffic usage, so I've added this to my script: You can set a value in percent above which the script adds a notice to a domain line. By default this is 90 (%).

Regards
FeG

Edit: Attachment removed, see for newer version below...


RE: Domain Disk and Traffic Usage Report - DaSilva - 10-08-2008 05:13 AM

Thanks, very nice!
Can you add a date -1 month like:

"=== ispCP - Domain Disk and Traffic Usage Report for 09.2008 ==="

because I want to add the cronjob every first day in a month at 0:00.

Thanks in advance.

EDIT: I used this code for the last month in subject already:

$(date -d 'now - 1 month' "+%m.%Y")

perhaps you can use it (I don't know Perl)!?


RE: Domain Disk and Traffic Usage Report - victor531 - 10-08-2008 01:02 PM

Hi.

I've installed the script in the home directory, with the correct pass to access at mysql BD, so I've configured the cron , but the mails arrive alone without any report.

I think the script does not run properly,......... where can I look ?

I feel so dumm, because It's look like easy to implement...... sorry

BTW the script's name to me is : ispcp-domainreport.pl
My cron : 46 22 * * * /home/ispcp-domainreport.pl | mail -s "Reporte de trafico y uso" email@domain.tld


Victor


RE: Domain Disk and Traffic Usage Report - BeNe - 10-08-2008 03:41 PM

Quote:but the mails arrive alone without any report.
So the Script is not executed. Please do it make executebale with
Code:
chmod + x

Hope that your Path to the script is correct - then it will work!

Greez BeNe


RE: Domain Disk and Traffic Usage Report - FeG - 10-08-2008 06:46 PM

(10-08-2008 05:13 AM)DaSilva Wrote:  Can you add a date -1 month like:

"=== ispCP - Domain Disk and Traffic Usage Report for 09.2008 ==="

I've added a date to the header, like this:
Code:
=== ispCP - Domain Disk and Traffic Usage Report (YYYY-MM-DD) ===

Quote:because I want to add the cronjob every first day in a month at 0:00.

You shouldn't do this because you'll get zero traffic always... This script reports the traffic of the current months, so you'll have to run it on the last day of each month, but this will be a bit difficult with cron ... you could run it on 28nd of each month, maybe..

victor531 Wrote:..., but the mails arrive alone without any report.

As BeNe said, I assume your script isn't executable... Anyway you can try to execute
Code:
/home/ispcp-domainreport.pl
directly on the command line.. it'll show you the report - or the reason why it shows no report Wink

Regards
FeG


RE: Domain Disk and Traffic Usage Report - aseques - 10-08-2008 07:29 PM

Excellent job, it's currently on my testing server , if you haven't done it, I'd have to do it by myself, so I can invest my time on other ispcp stuff ...
Thank you very much!

Note: It's too late for this to be added to 1.0.0?