[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] [raq550] stats for ftp and mail for awstats ?
- Subject: [cobalt-users] [raq550] stats for ftp and mail for awstats ?
- From: "Bob Lenaerts" <bob@xxxxxxxxxx>
- Date: Thu Oct 16 05:10:06 2003
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
Hi List,
On our raq4r's we have installed ftp alizer and mail alizer.
They give the stats for ftp and mail use in /siteadmin => site usage in
a webalizer GUI.
Now we have boght a few raq550's and installed awstats on them.
Is it possible to also get stats for ftp and mail use ?
Is there also a script that mails the systemadmin ALL the stats like
this script for raq4 ?
<?
/***********************************************************************
*
*
*
* Infomaniak Network SA
*
* Traffic overload announcer
*
* Marco Baurdoux
*
* linux@xxxxxxxxxxxxx
*
* 16.10.1977
*
*
*
************************************************************************
/
/***********************************************************************
*
Main Configuration
************************************************************************
/
$quota = "0.2"; //Put it in Gigabytes, ie 20
means 20 GB
$mail_address = "info@xxxxxxxxxx"; //Pretty straight forward
/***********************************************************************
*
!!! DO NOT EDIT BELOW THIS LINE !!!
************************************************************************
/
//Now lets convert the quota into bytes.
$limit = ($quota * 1000 * 1024);
//Now let us run throuh the websites that are hosted on my raq
//All I do is make a array out the webalizer.hist file and fetch
//the 5 entry from it, that correponds to the "kbytes" entry, because
//that's what I wanted to check.
$body = "Infomaniak Network SA\n";
$body .= "Traffic overload announcer\n";
$body .= "Written by : Marco Baurdoux\n";
$body .= "linux@xxxxxxxxxxxxx\n\n";
$body .= "********************************************\n";
$body .= "The transfer limit has been set to $quota GB\n";
$body .= "********************************************\n\n";
$body .= "Website\tLast month\tCurrent month\n\n";
if($handle = opendir("/home/sites"))
{
$dot = readdir($handle);
$dotdot = readdir($handle);
while($entry = readdir($handle))
{
if(is_link("/home/sites/$entry"))
{
//bande($entry);
if($webalizer =
@file("/home/sites/$entry/users/stats/web/webalizer.hist"))
{
$this_month = date("n");
$previous_month = $this_month -1;
for($r=0;$r<=count($webalizer);$r++)
{
if($line = explode(" ",
$webalizer[$r]))
{
if($line[0] ==
$this_month)
{
$line0 =
$line[5];
}
elseif($line[0] ==
$previous_month)
{
$line1 =
$line[5];
}
}
}
if($line0 > $limit || $line1 > $limit)
{
$body .= $entry;
$body .= "\t";
$body .= $line1;
$body .= "\t";
$body .= $line0;
$body .= "\n";
}
}
}
}
if(mail($mail_address, "Sites overload for $SERVER_NAME",
$body))
{
print "Youpi";
}
else
{
print "Merde";
}
}
?>
Many thanks for your help
Bob lenaerts