Current time: 11-27-2024, 07:43 PM Hello There, Guest! (LoginRegister)


Post Reply 
Domain Disk and Traffic Usage Report
Author Message
FeG Offline
Banned

Posts: 222
Joined: Aug 2007
Post: #1
Domain Disk and Traffic Usage Report
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...
(This post was last modified: 10-08-2008 07:39 PM by FeG.)
10-06-2008 10:19 PM
Find all posts by this user Quote this message in a reply
DaSilva Offline
Member
***

Posts: 302
Joined: Dec 2007
Reputation: 0
Post: #2
RE: Domain Disk and Traffic Usage Report
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.
10-07-2008 03:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
FeG Offline
Banned

Posts: 222
Joined: Aug 2007
Post: #3
RE: Domain Disk and Traffic Usage Report
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
10-07-2008 04:13 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: Domain Disk and Traffic Usage Report
Thats it!!! Thanks FeG.
I use it since yesterday on my Server Smile

Greez BeNe
10-07-2008 04:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
FeG Offline
Banned

Posts: 222
Joined: Aug 2007
Post: #5
RE: Domain Disk and Traffic Usage Report
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...
(This post was last modified: 10-08-2008 07:38 PM by FeG.)
10-07-2008 06:16 PM
Find all posts by this user Quote this message in a reply
DaSilva Offline
Member
***

Posts: 302
Joined: Dec 2007
Reputation: 0
Post: #6
Smile RE: Domain Disk and Traffic Usage Report
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)!?
(This post was last modified: 10-08-2008 06:28 AM by DaSilva.)
10-08-2008 05:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
victor531 Offline
Junior Member
*

Posts: 167
Joined: Oct 2007
Reputation: 3
Post: #7
RE: Domain Disk and Traffic Usage Report
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
10-08-2008 01:02 PM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #8
RE: Domain Disk and Traffic Usage Report
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
10-08-2008 03:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
FeG Offline
Banned

Posts: 222
Joined: Aug 2007
Post: #9
RE: Domain Disk and Traffic Usage Report
(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


Attached File(s)
.txt  ispcp-domainreport.pl.txt (Size: 2.99 KB / Downloads: 119)
10-08-2008 06:46 PM
Find all posts by this user Quote this message in a reply
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #10
RE: Domain Disk and Traffic Usage Report
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?
10-08-2008 07:29 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)