HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=15)
-   -   Statistics Wrong (http://www.howtoforge.com/forums/showthread.php?t=25688)

tal56 1st August 2008 08:31

Statistics Wrong
 
Hi guys,

I just changed the config.inc.php to allow for correct statictics according to this page : http://www.howtoforge.com/ispconfig-2.x-first-steps-p2

However my stats seem to be wrong. For example my site Web13 says 0 disk space used, but I know it should be around 2 megs or so, in a users maildir.

The command "repquota -avug" gets me this :

Quote:

*** Report for group quotas on device /dev/hda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
Group used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 4078256 0 0 79586 0 0
bin -- 860 0 0 222 0 0
daemon -- 28 0 0 4 0 0
sys -- 16 0 0 2 0 0
tty -- 24 0 0 2 0 0
disk -- 4 0 0 1 0 0
lp -- 84 0 0 18 0 0
mail -- 216 0 0 7 0 0
man -- 256 0 0 32 0 0
games -- 6012 0 0 543 0 0
lock -- 8 0 0 1 0 0
nobody -- 96 0 0 2 0 0
utmp -- 240 0 0 5 0 0
avahi -- 8 0 0 1 0 0
smmsp -- 1188 0 0 55 0 0
utempter -- 8 0 0 1 0 0
rpcuser -- 20 0 0 4 0 0
slocate -- 2024 0 0 3 0 0
rpm -- 34424 0 0 121 0 0
techiweb -- 36 0 0 5 0 0
sshadmin -- 32 0 0 4 0 0
screen -- 352 0 0 2 0 0
ntp -- 8 0 0 2 0 0
named -- 168 0 0 47 0 0
mysql -- 26940 0 0 742 0 0
dovecot -- 16 0 0 5 0 0
postdrop -- 352 0 0 4 0 0
postfix -- 8 0 0 29 0 0
apache -- 24 0 0 4 0 0
admispconfig -- 112200 0 0 3271 0 0
web1 -- 13604 1024000 1025024 251 0 0
web2 -- 39544 512000 513024 1023 0 0
web3 -- 12240 0 0 798 0 0
web4 -- 21784 1024000 1025024 961 0 0
web6 -- 3988 512000 513024 203 0 0
web7 -- 1052 512000 513024 105 0 0
web8 -- 3948 512000 513024 314 0 0
web9 -- 52680 512000 513024 3131 0 0
web10 -- 4012 512000 513024 421 0 0
web11 -- 4972 512000 513024 93 0 0
web13 -- 2088 512000 513024 147 0 0
ispconfigend -- 16 0 0 4 0 0
So it seems to show a correct usage of around 2MB for Web13. So why does ispconfig stats show 0 used? Is it because the disk space stats are only updated once a day and I need to wait for the update to occur? I'm runnig the newest ispconfig and Centos 5.2. Thanks

till 1st August 2008 11:44

Maybe you run ISPConfig with mbox format instaed of maildir. mailboxes in mbox format are not shown in the statistics as they are not within the website tree.

tal56 1st August 2008 16:21

Hi Till,

Sorry I should have mentioned, I'm definitely using maildir not mbox. Before I made the change to sudo it showed around 700kb being used for Web13, which basically dosen't account for the maildir stuff, however now it shows 0 used, and the sudo change is the only thing I've done.

Also my other websites statistics are wrong also, one show like 500kb used when it should be a few megs worth in web/email space, and the rest all show 0kb used.

Please help with this, I can provide any log or screen prints requested. Thanks


EDIT : From what I can see the only space ispconfig is seeing as used is the mysql space. The web/email space always shows 0kb. So the only sites that are showing anything other than 0kb are sites that have a mysql database.

tal56 1st August 2008 18:52

Ok, I've changed everything back and it seems to be working again, but with the incorrect stats because it's missing the maildir space used.

The only things i've changed back are :

config.inc.php changed the use sudo option to a "0" again instead of 1

config.inc.php changed the encryption back to crypt from md5

visudo removed the admispconfig line added from the initial settings howto

Kinda stumped why any of those would affect it, but it would seem that ispconfig can't get the files diskspace used as they are not even listed, only the mysql space is listed before I changed those settings back. Now all the folders are listed again.

Thanks for any suggestions from anyone who's done this.

till 1st August 2008 19:20

To find out why the procedure does not work on your system:

1) add the admispconfig settings for sudo.
2) run:

su admispconfig

to become ispconfig user, so you get the same resiults as the controlpanel. Then change to a web directory:

cd /var/www/www.domain.com

and execute the command:

du -h --max-depth=1

and check if the output is correct or if you get any error messages. ISPConfig is just displaying the output of this cammend in the interface.

tal56 2nd August 2008 01:51

Done some more testing, this is what i've found so far :

When I add the line :

admispconfig ALL=(root) NOPASSWD:/usr/bin/du

to my visudo file and run the command you suggested Till, I still don't seem to have permission to the maildir files, getting this :

Quote:

bash-3.2$ du -h --max-depth=1
4.0K ./ssl
4.0K ./phptmp
20K ./log
152K ./web
4.0K ./cgi-bin
du: cannot read directory `./user/mydomain.com_admin/Maildir': Permission denied
du: cannot read directory `./user/mydomain.com_admin/.spamassassin': Permission denied
du: cannot read directory `./user/mydomain.com_user1/Maildir': Permission denied
du: cannot read directory `./user/mydomain.com_user1/.spamassassin': Permission denied
du: cannot read directory `./user/mydomain.com_user2/Maildir': Permission denied
du: cannot read directory `./user/mydomain.com_user2/.spamassassin': Permission denied
du: cannot read directory `./user/mydomain.com_user3/Maildir': Permission denied
du: cannot read directory `./user/mydomain.com_user3/.spamassassin': Permission denied
524K ./user
724K .
Which is exactly the same as I get without that line in visudo.

Also what I've noticed is it seems to be this line that totally blanks out the diskspace :

$go_info["server"]["sudo_du_enabled"] = 0; // enable sudo for gathering website file usage

When I change that to a 1 instead of the 0, then my stats don't show anything at all except the mysql data.

till 2nd August 2008 09:19

It looks like your sudo is not working or installed correctly pn your system as it has no affect at all. Which Linux distribution do you use?

Quote:

Also what I've noticed is it seems to be this line that totally blanks out the diskspace :

$go_info["server"]["sudo_du_enabled"] = 0; // enable sudo for gathering website file usage

When I change that to a 1 instead of the 0, then my stats don't show anything at all except the mysql data.
Thats just the symptom and not the cause.

tal56 2nd August 2008 09:22

Centos 5.2 upgraded recently from 5.0

Any chance for fixing the /etc/sudoers file? Should I reinstall sudo? Thanks

tal56 2nd August 2008 19:12

Till, I've done some looking around on sudo and it would seem even if I add admispconfig to the /etc/sudoers file according to the howto, I still need to type "sudo" to run the du command, the only difference is I don't need a password.

So instead of the

du -h --max-depth=1

command you asked me to test with, which still says permission denied. I tried the line :

sudo du -h --max-depth=1

and that worked beautifully. Is this in fact how it's supposed to work? If so is there a bug in ispconfig that's calling that command incorrectly when I turn on that option in the config.inc.php file? Should it be calling it via "sudo du -h --max-depth=1" instead of just "du -h --max-depth=1" ?

Maybe this is just for Centos as well? But it would seem my /etc/sudoers file does work as the NOPASSWD option certainly is working.

Quote:

Originally Posted by till (Post 139031)
To find out why the procedure does not work on your system:

1) add the admispconfig settings for sudo.
2) run:

su admispconfig

to become ispconfig user, so you get the same resiults as the controlpanel. Then change to a web directory:

cd /var/www/www.domain.com

and execute the command:

du -h --max-depth=1

and check if the output is correct or if you get any error messages. ISPConfig is just displaying the output of this cammend in the interface.


tal56 3rd August 2008 11:14

Ok more searching into this, I found out centos logs the sudo command to /var/log/secure and I have this error that seems to occur when I check statistics in ispconfig while the option to use sudo is set to 1 in config.inc.php

Aug 1 10:33:14 server1 sudo: admispconfig : sorry, you must have a tty to run sudo ; TTY=unknown ; PWD=/home/admispconfig/ispconfig/web/multidoc/edit ; USER=root ; COMMAND=/usr/bin/du -h --max-depth=1 /var/www/web2

but i'm not sure what's the best way to fix this. I've found some info that suggest this :

Quote:

...
requiretty If set, sudo will only run when the user is logged in to a
real tty. This will disallow things like "rsh somehost
sudo ls" since rsh(1) does not allocate a tty. Because it
is not possible to turn off echo when there is no tty
present, some sites may with to set this flag to prevent a
user from entering a visible password. This flag is off by
default.
...
tty_tickets If set, users must authenticate on a per-tty basis. Nor-
mally, sudo uses a directory in the ticket dir with the
same name as the user running it. With this flag enabled,
sudo will use a file named for the tty the user is logged
in on in that directory. This flag is off by default.
from the sudo man pages, and someone suggested turning those options off. Is that safe to do? Or is there any other way to fix that? Thanks


All times are GMT +2. The time now is 22:23.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.