PDA

View Full Version : Domain Monitoring Tool


l0rdphi1
01-09-2004, 06:55 PM
This tool is designed to monitor domains via the server-status Apache 1.xx feature. The tool can monitor both domain load and the number of processes per domain.

NOTE: This tool does not work with Apache 2. You may wish to check out mod_throttle (Apache 1) or mod_cband (http://mod-cband.com) (Apache 2) as replacements for this tool.

Once a domain reaches certain specified limits, you can opt to warn and suspend users.

Prior to running this script, please run 'table.sql' AND modify each file in the 'conf' directory to your preference. See the included INSTALL file for details.

Download v1.0 here (http://www.l0rdphi1.com/tools/domain.monitor.tar.gz).
Last updated 2003-1-9 at 9:28 PM EST

Have fun, Phi1.

ProWebUK
01-10-2004, 03:34 AM
Added to the DA server checklist (http://www.directadmin.com/forum/showthread.php?s=&threadid=65):D

S2S-Robert
01-10-2004, 07:11 AM
Looking good!

I'm going to set this up and test it for a while.

I do have a suggestion though, perhaps you can add a client interface that enables you to view the loads. I know it's possible to take a look at them using phpmyadmin and going through the database yourself, but perhaps this will be a nice feature to display the stats.

regards

Robert

S2S-Robert
01-11-2004, 05:19 PM
http://www.directadmin.com/forum/showthread.php?s=&threadid=1667

Isn't this kinda the same? You can limit the amount of requests / download speed it has. It won't let you monitor cpu usage that's true, but it will help you with a lot of apache overloading issues.

ProWebUK
01-12-2004, 04:15 AM
Never realised it was request throttling also.... mod_throttle is basically limit your bandwidth by X xbps - would be useful to offer unmetered connections ;)

Never looked at it into to much detail or to be honest, used it although if your interested i'l get a copy on a test server and get playin with it :p

Chris

S2S-Robert
01-12-2004, 10:12 AM
Originally posted by ProWebUK
Never realised it was request throttling also.... mod_throttle is basically limit your bandwidth by X xbps - would be useful to offer unmetered connections ;) Not only that, it can be used to limit the actual number of apache processes as well. This way you could prevent a certain vhost from overloading apache, which is in essence the same thing we're trying to accomplish measuring cpu process time.

But please do start playing around with mod_throttle, who knows we might put it to good use ;)

l0rdphi1
01-13-2004, 09:25 AM
Yeah, I'm going to play with it too :D ..although I don't see how it can monitor load

ProWebUK
01-13-2004, 11:48 AM
I dont think it does, rather processes and bandwidth :)

Chris

l0rdphi1
01-13-2004, 12:15 PM
Yes, that's what I meant. :)

crawl
02-27-2004, 06:36 PM
Installed this today and it looks very cool. I was wondering if it can also email me to let me know a warning notice was sent, or if it's even possible to email me instead of the customer so I can contact them myself.

Thanks!

AtomicRax
03-18-2004, 10:13 PM
On a normal DA install on a Red Hat 9.0... What is the path to PHP?

l0rdphi1
03-19-2004, 05:47 AM
Originally posted by AtomicRax
On a normal DA install on a Red Hat 9.0... What is the path to PHP? /usr/local/bin/php for me

AtomicRax
03-19-2004, 08:15 PM
Ok, as far as I know, I set up the script right. I've checked all passwords and stuff. I run the script and it says "Table Updated" How ever, when I view the table, it doesn't show any records.

Any ideas?

AtomicRax
03-21-2004, 04:57 PM
All my information, as far as I know, is correct and the script is not inserting the information into the db.

And what should $__url_source be? I put it as the url to monitor.php I tried it with just the folder, but it didn't work.

l0rdphi1
03-21-2004, 05:08 PM
The source URL should be set to the location of your server-status monitor. See INSTALL.

Mine is set as:
$__url_source = 'http://server1.liquenox.net/serverstatus';

etegration
05-01-2004, 09:15 AM
Originally posted by l0rdphi1
The source URL should be set to the location of your server-status monitor. See INSTALL.

Mine is set as:
$__url_source = 'http://server1.liquenox.net/serverstatus';

i get an error when i go to http://www.mydomain.com/cpu/


Warning: file_get_contents(http://www.mydomain.com/cpu/): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/ministry/domains/mydomain.com/public_html/cpu/monitor.php on line 23
Table updated.

my httpd.conf:

#
ExtendedStatus On
<Location /home/username/domains/mydomain.com/public_html/cpu>
SetHandler server-status
</Location>

what's wrong? :(

etegration
05-03-2004, 08:50 AM
Originally posted by etegration
i get an error when i go to http://www.mydomain.com/cpu/


Warning: file_get_contents(http://www.mydomain.com/cpu/): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/ministry/domains/mydomain.com/public_html/cpu/monitor.php on line 23
Table updated.

my httpd.conf:

#
ExtendedStatus On
<Location /home/username/domains/mydomain.com/public_html/cpu>
SetHandler server-status
</Location>

what's wrong? :( :(

l0rdphi1
05-07-2004, 10:13 AM
In my httpd.conf, I added:ExtendedStatus On
<Location /serverstatus>
SetHandler server-status
</Location>

Give that a shot.

neorder
05-19-2004, 10:03 AM
Originally posted by l0rdphi1
In my httpd.conf, I added:ExtendedStatus On
<Location /serverstatus>
SetHandler server-status
</Location>

Give that a shot.


actually there is already "ExtendedStatus On", we just comment it out and add
<Location /serverstatus>
SetHandler server-status
</Location>

is it? and is there any live example to show?

jmstacey
06-19-2004, 12:19 AM
I didn't work for me either.
It says table updated but nothing has happened.

I did some trouble shooting and have narrowed it down a bit. The script does not add new domains as it finds them to the database. Once I had manually input a couple of domains the monitoring worked but only for those domains that I had entered.

I haven't looked into a fix yet, hopefully l0rdphi1 will get to it before I do.

Then again it may just be my server, I've had these weird quirks before on this setup.

l0rdphi1
06-19-2004, 01:10 AM
There is a bug. I'll uploaded a fixed copy of this tomorrow. :)

jmstacey
06-19-2004, 01:18 AM
Great, I'm looking foward to it.

Also, what is likely to be the best way to set this up? Where is the best location to put it that it will work and not be a risk? Any possibility of making it so you don't have to have the monitor.php file open to the public to get information?

l0rdphi1
06-19-2004, 10:51 PM
Updated the tarball.

Probably the best place to run this is in /home/admin/domain.monitor or something similar, however I currently have it running from /root/domin.monitor

Phi1.

jmstacey
06-21-2004, 12:46 AM
It is working now. :D

neorder
07-04-2004, 06:24 AM
Next chooce a MySQL database and execute the provided 'table.sql' file on it. Once the SQL executes, modify configure.php to reflect the database information you chose.

And while configure.php is up, fill in your new server-status URL. If you plan to suspend or warn users, you will need to fill in your administrative server control panel login details.

Lastly, run monitor.php via '/path/to/php /path/to/monitor.php' on the command line. If all goes well, you will want to set the command up as a cronjob. I suggest executing 'monitor.php' every 5 minutes, but you can do whatever you want.


do you mean i can view status at like http://serverip/statues.php?

and how to write a cron?

if i want to set up this cron under directadmin, how can i give command? thanks

l0rdphi1
07-04-2004, 03:21 PM
Hello,
Originally posted by neorder
do you mean i can view status at like http://serverip/statues.php?No, I view the program's status through phpMyAdmin.

Originally posted by neorder
and how to write a cron?

if i want to set up this cron under directadmin, how can i give command? thanks I haven't used DA's cron feature, but I think you can enter "5" for minute and "/path/to/php /path/to/monitor.php" for command and it should work.

Phi1.

outpernet
07-12-2004, 05:34 PM
hi.

I have the similar problem. "Table updated." but it didnt write into the database. do you know how can i fix it?

jmstacey
07-12-2004, 07:22 PM
I had this problem because apache was not setup properly.

Make sure you have the following in your httpd.conf

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

outpernet
07-12-2004, 09:03 PM
yes.. i have it ok.. are there any specific place inside httpd.conf to put it?

l0rdphi1
07-13-2004, 01:22 PM
I don't think there is a specific spot. I have it stuck down at the bottom before the DA Alias's for squirrelmail, etc.

Phi1.

jmstacey
07-13-2004, 08:58 PM
Anybody else had this problem.
I'm running Apache 1.3.31 with php 4.3.7
For some reason cpu usage calculations are not working, they remain at 0.01 or 0.00 even though viewing the monitor.php file from the web shows that users have considerable usage.

The number of processes appear to be working fine, just not cpu usage.

jmstacey
07-27-2004, 01:29 AM
I fixed the problem. I had to comment out the the second average line where it divides by 2. After thats commented out it returns and shows the total cpu time as it should.
I'm also trying to get it to convert it to a cpu percentage usage instead of time, does anyone have some ideas how to get the necassary information to do the calculation with?

Also, if anybody else uses this, what are your suspend account settings.

hkivan
09-01-2004, 02:00 PM
If i put and config all the file in /root/

after this i run ./monitor.php

IT show this error :
./monitor.php: line 1: ?php: No such file or directory
./monitor.php: line 3: /aquota.group: Permission denied
./monitor.php: line 4: anaconda-ks.cfg: command not found
./monitor.php: line 5: anaconda-ks.cfg: command not found
./monitor.php: line 6: anaconda-ks.cfg: command not found
./monitor.php: line 7: anaconda-ks.cfg: command not found
./monitor.php: line 8: conf/: is a directory
./monitor.php: line 10: =: command not found
./monitor.php: line 13: require: command not found
./monitor.php: line 15: require: command not found
./monitor.php: line 16: syntax error near unexpected token `('
./monitor.php: line 16: `$DB = new DB_driver($__sql_host,$__sql_dbase,$__sql_user,$__sql_pass);'


What's wrong of my work ?

l0rdphi1
09-01-2004, 05:10 PM
hkivan,

I think you need to type php ./monitor.php

Phi1.

wahaha
09-01-2004, 11:41 PM
I can not run a cron job ...

I have creat a file call " domainmon " in /etc/cron.d/

I have put a line in the file

*/4 * * * * root php /root/monitor.php





but it seems ... it can not work properly ..... :confused:

l0rdphi1
09-02-2004, 03:59 AM
What about putting it in crontab -e?

Phi1.

S2S-Robert
11-29-2004, 11:23 AM
This is more of a DA question than it is specifically for this script, but in which httpd.conf should I put it?

If I put it in /etc/httpd.conf then it will be overwritten right? So what if I added the /server-status/ to both /etc/httpd.conf and /usr/local/directadmin/data/templates/httpd.conf ?

resolveit
11-29-2004, 12:23 PM
Originally posted by wahaha
I can not run a cron job ...

I have creat a file call " domainmon " in /etc/cron.d/

I have put a line in the file

*/4 * * * * root php /root/monitor.php





but it seems ... it can not work properly ..... :confused:

You have to specify the full path to PHP otherwise it will not work in a cron job.

Regards,
Onno

nbhosting
12-05-2004, 06:06 AM
Hi all

i installed all and i'm getting this error

i dont want to messup the rights of directadmin
What rights should i use to fix this problem?


Warning: opendir(/usr/local/directadmin/data/users): failed to open dir: Permission denied in /home/nbhosting/domains/nbhosting.nl/public_html/scan/lib/directadmin.php on line 36

Warning: readdir(): supplied argument is not a valid Directory resource in /home/nbhosting/domains/nbhosting.nl/public_html/scan/lib/directadmin.php on line 37

Warning: closedir(): supplied argument is not a valid Directory resource in /home/nbhosting/domains/nbhosting.nl/public_html/scan/lib/directadmin.php on line 70

jlasman
12-06-2004, 09:49 PM
1) make sure you've got the latest copy.

2) does the code in line 70 resolve to a directory name? The error message says it doesn't.

Jeff

jmstacey
12-06-2004, 10:10 PM
My guess is that you are not running the domain.php file as the root user as you are supposed to.

RayManZ
01-16-2005, 04:32 PM
Just wondering. But what are the best config settings?

Or is there no need to change configure.php at all?

Example. How do i config it right that if a site get a load of 1+ it get suspended?

How does it work?

// 0 = disabled
$__cpu_warning = 0;
$__cpu_suspend = 0;

// 0 = disabled
$__proc_warning = 0;
$__proc_suspend = 0;


What are your settings at this?

Tnx :)

RosT
03-29-2005, 04:50 AM
How to install it?:

Details

domain successfully downloaded
plugin.tar.gz extracted
No install.sh script was found. Script not executed.

jmstacey
03-29-2005, 09:46 PM
Originally posted by RosT
How to install it?:

This tool is not a plugin. Simply download the package from the link in the first post, extract it manually and read the installation instructions therin using the rest of this thread as a supplement.

XBL
05-05-2005, 01:03 PM
@ RayManZ: You set the 'zero' to the actual suspend limit (is kind of confusing, I had to read it from monitor.php).

@ Everyone: I made a small script to monitor the database. Current functions:

Order by:
Domain
CPU Usage
Processes
Descending and Ascending

Search by domain

Any ideas on what to add are very welcome (e-mail (jochem at vuilnisbak dot com) or PM).

Download: domainmonitor.php (http://vanleeuwen.at/domainmonitor/domainmonitor.phpd)
Test: domainmonitor/ (http://vanleeuwen.at/domainmonitor/).
Username: admin
Password: password

The stats are live from the database.

I also recommend to set the $__url_source (in conf/configure.php) to http://localhost/server-status (replace server-status with whatever you're using). And change

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

To

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

Security before everything ;).

Jochem

inetworx
05-29-2005, 02:35 AM
Originally posted by XBL
@ RayManZ: You set the 'zero' to the actual suspend limit (is kind of confusing, I had to read it from monitor.php).

@ Everyone: I made a small script to monitor the database. Current functions:

Order by:
Domain
CPU Usage
Processes
Descending and Ascending

Search by domain

Any ideas on what to add are very welcome (e-mail (jochem at vuilnisbak dot com) or PM).

Download: domainmonitor.php (http://vanleeuwen.at/domainmonitor/domainmonitor.phpd)
Test: domainmonitor/ (http://vanleeuwen.at/domainmonitor/).
Username: admin
Password: password

The stats are live from the database.

I also recommend to set the $__url_source (in conf/configure.php) to http://localhost/server-status (replace server-status with whatever you're using). And change

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

To

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

Security before everything ;).

Jochem

My server goes down on this change in configure.php :confused:

snaaps
08-14-2005, 05:45 PM
where most I place the next code:

ExtendedStatus On
<Location /serverstatus>
SetHandler server-status
</Location>

IN: /usr/local/directadmin/data/users/User-Name-Of-The-Domain/httpd.conf
or /usr/local/directadmin/data/templates/httpd.conf


Like this:

# Frontpage requires these parameters in every httpd.conf file or else
# it won't work.
Port 80
ServerRoot /etc/httpd

ExtendedStatus On
<Location /serverstatus>
SetHandler server-status
</Location>

<VirtualHost MyIP:80>


ServerName www.mydomain.nl
etc etc......



Has anyone a example for me!

resolveit
08-15-2005, 03:39 AM
This should be placed in /etc/httpd/conf/httpd.conf and then restart apache.

Regards,
Onno Vrijburg

snaaps
08-15-2005, 04:21 AM
it dos't mather were I place this code?

exaple on the top?

Starting httpd: Syntax error on line 20 of /etc/httpd/conf/httpd.conf:
Invalid command 'ExtendedStatus', perhaps mis-spelled or defined by a module not included in the

resolveit
08-15-2005, 04:24 AM
I placed it just above the VirtualHost configuration.

regards,
Onno

snaaps
08-15-2005, 04:27 AM
cant, you show me a piece of your confg file?

I get evertime errors when I tried to restart httpd

Starting httpd: Syntax error on line 20 of /etc/httpd/conf/httpd.conf:
Invalid command 'ExtendedStatus', perhaps mis-spelled or defined by a module not included in the

resolveit
08-15-2005, 04:39 AM
...

<IfDefine HAVE_PUT>
AddModule mod_put.c
</IfDefine>
<IfDefine HAVE_PYTHON>
AddModule mod_python.c
</IfDefine>

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

Port 80

Listen 80
Listen 443

...



I see on this server I put is somewhere else...

Check to see that you don't have the entry "ExtendedStatus On" twice.

Regards,
Onno

snaaps
08-15-2005, 04:42 AM
thanks, that works!!

resolveit
08-15-2005, 04:43 AM
You'/re welcome :)

snaaps
08-15-2005, 04:55 AM
OK, great service and a great tool!
A few days ago I have a atack on my server. After 4 hour we found the problem.
Whith this tool I will found the problem in 5 minutes!

I think it's a good idea to modify the INSTALL text, so that noobs also can install this script.

Titam
08-18-2005, 07:10 AM
sniff i have this :


PHP Warning: main(./conf/configure.php): failed to open stream: No such file or directory in /home/hollinae/domains/testhollinae.com/public_html/monitordom/monitor.php on line 13

Warning: main(./conf/configure.php): failed to open stream: No such file or directory in /home/hollinae/domains/testhollinae.com/public_html/monitordom/monitor.php on line 13
PHP Fatal error: main(): Failed opening required './conf/configure.php' (include_path='.:/usr/local/lib/php') in /home/hollinae/domains/testhollinae.com/public_html/monitordom/monitor.php on line 13

Fatal error: main(): Failed opening required './conf/configure.php' (include_path='.:/usr/local/lib/php') in /home/hollinae/domains/testhollinae.com/public_html/monitordom/monitor.php on line 13


In /home/hollinae/domains/testhollinae.com/public_htlml/monitordom/ i have all files and directory for this script :\

If someone can help me, thank you :)

Titam
08-18-2005, 07:16 AM
Edit / Nevermind ... i worked with bad domains :rolleyes:

But I Would like to know when it's really dangerous ? By example, I have a user who has
Average CPU : 6.75
Average Process : 0.84

Is it a lot, or not ?

redeye
09-05-2005, 03:22 AM
Originally posted by XBL
@ RayManZ: You set the 'zero' to the actual suspend limit (is kind of confusing, I had to read it from monitor.php).

@ Everyone: I made a small script to monitor the database. Current functions:

Order by:
Domain
CPU Usage
Processes
Descending and Ascending

Search by domain

Any ideas on what to add are very welcome (e-mail (jochem at vuilnisbak dot com) or PM).

Download: domainmonitor.php (http://vanleeuwen.at/domainmonitor/domainmonitor.phpd)
Test: domainmonitor/ (http://vanleeuwen.at/domainmonitor/).
Username: admin
Password: password

The stats are live from the database.

I also recommend to set the $__url_source (in conf/configure.php) to http://localhost/server-status (replace server-status with whatever you're using). And change

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

To

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

Security before everything ;).

Jochem

Nice, but your demo is different then mine :(. I only get the same output as with monitor.php, so no login or anything.
Any ideas?

redeye
09-05-2005, 07:44 AM
Very very usefull, thanks but, yes i have one ;)

I get allot of dots

Server Version: YuBsa
Server Built: Apr 7 2005 09:21:20
Current Time: Monday, 05-Sep-2005 15:38:23 CEST
Restart Time: Monday, 05-Sep-2005 11:15:15 CEST
Parent Server Generation: 0
Server uptime: 4 hours 23 minutes 8 seconds
Total accesses: 19601 - Total Traffic: 604.3 MB
CPU Usage: u238.41 s2.73 cu6.8 cs3.14 - 1.59% CPU load
1.24 requests/sec - 39.2 kB/second - 31.6 kB/request
1 requests currently being processed, 19 idle servers

__W_________________............................................
................................................................
................................................................

..... until (200 lines further)

................................................................

Scoreboard Key: etc


Everything after scoreboard is diplaying good :), but how can I get rid of the dots ? :confused:

What is wrong?

redeye
09-06-2005, 11:37 AM
Anyone, please?

justadollar
09-06-2005, 03:00 PM
That's just something that happens on DA servers. I'm not sure why it does, but every da server I've examined mod_status on does it.

nieuwhier
09-08-2005, 02:03 PM
HELP!!

This monitor sounds just right for me. Buttttttttt i can't get it to work.

What did I do:

I created a map in a domain from admin, in de private_html section.

I created the database and configured the configure.php. I cannot get a http address in there. Only the local address gave no errors.

I also added this to the /usr/local/directadmin/data/templates/httpd.conf:
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>
Exactly like this. Should I perhaps give a location ?
I then restarted httpd service.

I then run monitor.php and ' table updated' apears. But nothing changes. Am i missing something ?

nieuwhier
09-20-2005, 02:25 PM
ok... I found the answer myself.

$__url_source in configure.php had to point to http://localhost/server-status

And you can test on http://yourserver.xxx/server-status if it works. (add you're ip to allow in httpd.conf otherwise you won't see anything).

db is filled now. I am now figuring out what to do with the limits.

wchost
10-11-2005, 03:16 PM
It wont allow me to open the directory...

Warning: opendir(/usr/local/directadmin/data/users): failed to open dir: Permission denied in /home/admin/domains/mydomain.com/public_html/monitor2/lib/directadmin.php on line 36

Warning: readdir(): supplied argument is not a valid Directory resource in /home/admin/domains/mydomain.com/public_html/monitor2/lib/directadmin.php on line 37

Any one knows how to fix? The ownership of those folders /usr/local/directadmin/data/users to diradmin

thanks

wchost
10-11-2005, 03:24 PM
solved

chatwizrd
10-21-2005, 06:31 PM
I have some bug or something...

[root@matrix:/home/admin/domain.monitor] php monitor.php
fatal error: UPDATE cpu_monitor SET status='warned' WHERE domain='games******.net'<p>mysql error: Unknown column 'status' in 'field list'<br>mysql error code: 1054[root@matrix:/home/admin/domain.monitor]

Also I would like to know what proper settings would be for:

// 0 = disabled
$__cpu_warning = 1;
$__cpu_suspend = 0;

// 0 = disabled
$__proc_warning = 1;
$__proc_suspend = 0;

Just pick any number I want or what?

@how@
10-24-2005, 02:51 PM
Originally posted by XBL
@ RayManZ: You set the 'zero' to the actual suspend limit (is kind of confusing, I had to read it from monitor.php).

@ Everyone: I made a small script to monitor the database. Current functions:

Order by:
Domain
CPU Usage
Processes
Descending and Ascending

Search by domain

Any ideas on what to add are very welcome (e-mail (jochem at vuilnisbak dot com) or PM).

Download: domainmonitor.php (http://vanleeuwen.at/domainmonitor/domainmonitor.phpd)
Test: domainmonitor/ (http://vanleeuwen.at/domainmonitor/).
Username: admin
Password: password

The stats are live from the database.

I also recommend to set the $__url_source (in conf/configure.php) to http://localhost/server-status (replace server-status with whatever you're using). And change

ExtendedStatus On
<Location /server-status>
SetHandler server-status
</Location>

To

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

Security before everything ;).

Jochem


i get error
Warning: array_sum(): The argument should be an array in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 116

Warning: Division by zero in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 117

Warning: array_sum(): The argument should be an array in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 118

Warning: Division by zero in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 119

Titam
10-25-2005, 09:36 AM
FYI this :

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>


Doesn't work for me. I have to put :

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from IP ADRESS
</Location>

jmstacey
10-25-2005, 12:48 PM
localhost might not be properly configured on your server.

Titam
10-25-2005, 12:53 PM
maybe lol, but i have no problem with localhost in my php/mysql script ^^

jschurawlow
10-26-2005, 11:11 AM
Ok have this working fine. Only question really is does this script require the actual "admin" user account pass or will it be fine if setup on it's own admin level account (which is what i had done).

DRKT
01-03-2006, 02:34 AM
Originally posted by @how@
i get error
Warning: array_sum(): The argument should be an array in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 116

Warning: Division by zero in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 117

Warning: array_sum(): The argument should be an array in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 118

Warning: Division by zero in /home/admin/domains/******.***/public_html/server-status/domainmonitor.php on line 119


I have same error!! Why?? i Change info on httpd.conf

Spook
01-12-2006, 05:19 AM
Originally posted by chatwizrd
I have some bug or something...

[root@matrix:/home/admin/domain.monitor] php monitor.php
fatal error: UPDATE cpu_monitor SET status='warned' WHERE domain='games******.net'<p>mysql error: Unknown column 'status' in 'field list'<br>mysql error code: 1054[root@matrix:/home/admin/domain.monitor]

Try the following to make the table.. or just add the status field to your existing table.

CREATE TABLE cpu_monitor (
domain varchar(70) NOT NULL default '',
status varchar(10) NOT NULL default '',
cpu_x1 float(4,2) NOT NULL default '0.00',
cpu_x2 float(4,2) NOT NULL default '0.00',
cpu_x3 float(4,2) NOT NULL default '0.00',
processes_x1 float(4,2) NOT NULL default '0.00',
processes_x2 float(4,2) NOT NULL default '0.00',
processes_x3 float(4,2) NOT NULL default '0.00',
PRIMARY KEY (domain)
) TYPE=MyISAM;


Also I would like to know what proper settings would be for:

// 0 = disabled
$__cpu_warning = 1;
$__cpu_suspend = 0;

// 0 = disabled
$__proc_warning = 1;
$__proc_suspend = 0;

Just pick any number I want or what? I wouldn't set the __proc values too low or the script will send out emails for trivial reasons. I don't know what reasonable numbers should be for the processes, best to look at the database and see what looks 'normal'.

The CPU though I am assuming that it's a 0-100% scale so a simple way to figure it would be to divide 100 by the number of sites hosted -- then probably add a little to that number for the suspended value.

There is also an 'ignore' portion in the monitor.php worth using maybe. It appears to be useful for opting-out your own main site.

stubrud
01-31-2006, 04:14 AM
cant get it working
Warning: opendir(/usr/local/directadmin/data/users): failed to open dir: Permission denied in /home/admin/domains/webpriser.info/public_html/server-status/lib/directadmin.php on line 36

Warning: readdir(): supplied argument is not a valid Directory resource in /home/admin/domains/webpriser.info/public_html/server-status/lib/directadmin.php on line 37

Warning: closedir(): supplied argument is not a valid Directory resource in /home/admin/domains/webpriser.info/public_html/server-status/lib/directadmin.php on line 70

i got this all over the site.
please advice

hostpc.com
01-31-2006, 08:19 AM
Sounds like safe mode is enabled for that domain

stubrud
01-31-2006, 03:42 PM
Originally posted by hostpc.com
Sounds like safe mode is enabled for that domain
php safemode is disabled.

XBL
01-31-2006, 11:36 PM
The user which executes the script (probably 'apache') appears not to be allowed to read /usr/local/directadmin/data/users. You have to make sure apache can read the directory.

Jochem

stubrud
02-01-2006, 06:40 PM
Originally posted by XBL
The user which executes the script (probably 'apache') appears not to be allowed to read /usr/local/directadmin/data/users. You have to make sure apache can read the directory.

Jochem
no kidding?
how without blocking DA access to thoose files

jlasman
02-01-2006, 06:56 PM
Lots of ways; read a good book on linux administration.

The only reason I'm not explaining in detail is because I believe it to be a system security issue.

Jeff

waterkei
02-06-2006, 08:04 AM
I want to know the configure.php file have this

server_type = 'DirectAdmin'

What's mean of server_type? Is it no need to change 'DirectAdmin'?

And I want to know what's go to be next after I use
./php monitor.php

I get this result

Warning: file_get_contents(): HTTP request failed! HTTP/1.1 403 Forbidden
in /home/admin/domains/domainname/public_html/server-status/monitor.php on line 23

Warning: file_get_contents(http://www.domainname/server-status): failed to open stream: Success in /home/admin/domains/domainanme/public_html/server-status/monitor.php on line 23
Table updated.

Is it right? I have no idea on it

waterkei
02-06-2006, 09:26 PM
solved!

BlueNoteWeb
03-20-2006, 04:30 PM
I don't want to keep this file available to just anybody, so I've added the code that was previously suggested to allow access only from localhost. Is it possible to add a password on the file so I can access it from elsewhere? I know I could allow from a specific IP address, but I don't have a static IP here and I'm often traveling to other places anyway. Can I do something like an .htaccess solution?

icepick
05-21-2006, 04:04 PM
Hey guys,

I'm running this on my webserver now, however are there any scripts to email the admin rather than the users? I'd like to see how this will effect my users, i.e. when will they receive emails, how often, and what would cause the system to email the user (apache process using over half the CPU for x amount of minutes?)

Secondly the domainmonitor.php that someone made on this list is no longer available, was it a pretty output, does anyone have a copy of it for me?

I want to see what it does before I start suspending users or sending them emails about over utilization when I dont know what the thresholds are.

Cheers
Barry

l0rdphi1
05-22-2006, 02:06 AM
Originally posted by icepick
Hey guys,

I'm running this on my webserver now, however are there any scripts to email the admin rather than the users? I'd like to see how this will effect my users, i.e. when will they receive emails, how often, and what would cause the system to email the user (apache process using over half the CPU for x amount of minutes?) Hello,

To change the email address notices are sent to you will need to edit the lib/directadmin.php file included in the archive. All of the PHP mail() functions will need changed to:mail("your@emai.com", ...
Instead of this tool you may also be interested in the Apache mod_throttle module. You can do similar stuff with that.

Cheers, Phil.

jschurawlow
06-06-2006, 07:10 PM
Ok, while I do really like this script there is one major flaw about how the suspend/unsuspend is handled.

When an admin suspends an account manually (for whatever reason non-payment, etc) this script will just unsuspend it automatically if the user is not at the resource limits. (eg no tracking is done on the script to see if it was actually suspended by the script or by an admin).

This would be something that I would see as being a majorly needed feature to this script, otherwise it makes it kind of unuseable.

powerdomein
06-24-2006, 07:57 AM
Dear guys,

I have read it... I try to install but i faild.. (Fedora 3 server)

I have on my server http://ip/httpd-server (its works)
the http.conf is also edited.
But it dont works..

Can someone just write the installation for "noopies"

- Where must i upload the files?
- Can is use /var/www/html/<directory>
- I have used my reseller account to create a mysql. Is this ok?

Could you chek this config file:

$__server_type = 'DirectAdmin';
$__server_addr = "IP;
$__server_user = ; <--RESELLER ACCOUNT?
$__server_pass = '; <--RESELLER PASSWORD??

$__url_source = 'http://IP/httpd-status';

$__sql_host = 'localhost';
$__sql_dbase = 'powerdomei_serv'; <Reseller DBASE
$__sql_user = 'powerdomei_serv';
$__sql_pass = '12345';

With these config file i get this error:

Warning: opendir(/usr/local/directadmin/data/users): failed to open dir: Permission denied in /var/www/html/cpu/lib/directadmin.php on line 36

Warning: readdir(): supplied argument is not a valid Directory resource in /var/www/html/cpu/lib/directadmin.php on line 37

Warning: closedir(): supplied argument is not a valid Directory resource in /var/www/html/cpu/lib/directadmin.php on line 70

Warning: opendir(/usr/local/directadmin/data/users): failed to open dir: Permission denied in /var/www/html/cpu/lib/directadmin.php on line 36

Warning: readdir(): supplied argument is not a valid Directory resource in /var/www/html/cpu/lib/directadmin.php on line 37
mysql error: Unknown column 'status' in 'field list'
mysql error code: 1054

Please i need just some help!

SeLLeRoNe
07-07-2006, 12:16 PM
i've a question before test it...

work with freebsd? :D

PauGasol
07-08-2006, 03:55 PM
Can anyone explain me what represent exactly the values of average cpu load and process in the monitor tool?

I can compare and its nice but i would like know more, in some box this values variaty a lot of.

Thanks

sbz
09-12-2006, 06:57 PM
Hello everybody

I cannot create a cron job for domain monitor

Can anyone help me?


This is the cron job I already create:
*/5 * * * * root /usr/local/bin/php -f /usr/local/monitor/monitor.php

DRKT
09-16-2006, 10:45 AM
Do you have a live example?

Thanks!

snaaps
09-19-2006, 03:33 AM
has anyone the file domainmonitor.php for me?

Pascal
09-20-2006, 02:15 PM
Originally posted by snaaps
has anyone the file domainmonitor.php for me?

it is on the first page of this thread...

anyway, this doesnt work anymore. the layout from the status view is changed :(

snaaps
01-02-2007, 02:42 PM
those links are not working anymore.
has somewone these modifed files?


Originally posted by XBL
@ RayManZ: You set the 'zero' to the actual suspend limit (is kind of confusing, I had to read it from monitor.php).

@ Everyone: I made a small script to monitor the database. Current functions:

Order by:
Domain
CPU Usage
Processes
Descending and Ascending

Search by domain

Any ideas on what to add are very welcome (e-mail (jochem at vuilnisbak dot com) or PM).

Download: domainmonitor.php (http://vanleeuwen.at/domainmonitor/domainmonitor.phpd)
Test: domainmonitor/ (http://vanleeuwen.at/domainmonitor/).
Username: admin
Password: password


Jochem

Yolte
02-28-2007, 02:07 PM
Ok, while I do really like this script there is one major flaw about how the suspend/unsuspend is handled.

When an admin suspends an account manually (for whatever reason non-payment, etc) this script will just unsuspend it automatically if the user is not at the resource limits. (eg no tracking is done on the script to see if it was actually suspended by the script or by an admin).

This would be something that I would see as being a majorly needed feature to this script, otherwise it makes it kind of unuseable.

Same problem is here.

Is there any way to solve unsuspend problem?

@how@
03-19-2007, 07:31 AM
error in mysql

[root@server15 ~]# /usr/local/bin/php -f monitor.php
fatal error: UPDATE cpu_monitor SET status='warned' WHERE domain='xxxxxx.xxx'<p>mysql error: Unknown column 'status' in 'field list'<br>mysql error code: 1054



Wael

Rprp
06-02-2007, 08:07 PM
dedi262:/home/ricky/domain# php monitor.php
Table updated

But cpu_monitor is empty :eek:

aleto
07-01-2007, 10:16 AM
Any updates on this ? e.g. successfull working reports on Apache 2.x / 2.2.x ?

Thx for feedback!

SeLLeRoNe
07-01-2007, 11:40 AM
i got 2 question:

may i do server-status link showin in only a domain?

example: my-company-domain/serverstatus ok
client-domain/serverstatus doesnt work

is possible?

second, there is a php file for see the stats sorted and graphics?

thanks

AndyII
08-05-2007, 11:50 AM
1st, does this script actually work?
2nd, going through directadmin.php, I dont see how to change the php mail() functions
I have a particular server that seems to go into high load average (30+) on Sunday of each week, by the time I get there its almost impossible to sort where the troubles are, so I'm hoping that this will help sort the problems. I to want to be notified as to which domain is causing the troubles, any updates on a package that is more configurable?

Hello,

To change the email address notices are sent to you will need to edit the lib/directadmin.php file included in the archive. All of the PHP mail() functions will need changed to:mail("your@emai.com", ...
Instead of this tool you may also be interested in the Apache mod_throttle module. You can do similar stuff with that.

Cheers, Phil.

kalaj
08-08-2007, 01:44 AM
it seems doesn't works for Apache 2 :(

l0rdphi1
08-08-2007, 09:50 AM
it seems doesn't works for Apache 2 :(

Yeah, this doesn't work with Apache 2. If you're looking for something similar, I suggest checking out mod_cband (http://mod-cband.com/).

Cheers, Phil

AndyII
08-08-2007, 10:05 AM
l0rdphi1, I will send you a PM, ok?
Andy

l0rdphi1
08-08-2007, 10:21 AM
l0rdphi1, I will send you a PM, ok?
Andy

I replied. :)

Cheers,

AndyII
08-08-2007, 10:56 AM
There is also an 'ignore' portion in the monitor.php worth using maybe. It appears to be useful for opting-out your own main site.
so the commented out portion in the monitor.php, would be where you put the ignored domain (s)?.
and for multiple domains would you ad them between the single quotes?
/*if ( $domain != 'l0rdphi1.com' )
{
continue;
}*/

l0rdphi1
08-09-2007, 12:29 PM
so the commented out portion in the monitor.php, would be where you put the ignored domain (s)?.
and for multiple domains would you ad them between the single quotes?
/*if ( $domain != 'l0rdphi1.com' )
{
continue;
}*/
Yes, you could do that there. To have it ignore a specific domain, you'd want to add:if ( $domain == 'dom2skip.tld' ) continue;

Duboux
08-09-2007, 12:56 PM
For multiple domains, this would be the php-code, but I don't know if that language is suitable for this.

Anyway:
$IgnoredDomains = array('one.com', 'two.com', 'three.com');
if (in_array($domain, $IgnoredDomains)) continue;


Though, I'd think there should be a ! before in_array

AndyII
08-10-2007, 09:13 AM
1st, does this script actually work?
2nd, going through directadmin.php, I dont see how to change the php mail() functions
I have a particular server that seems to go into high load average (30+) on Sunday of each week, by the time I get there its almost impossible to sort where the troubles are, so I'm hoping that this will help sort the problems. I to want to be notified as to which domain is causing the troubles, any updates on a package that is more configurable?

want to add what I was advised as far as email notices, I know I dont like having a problem, finding a thread that describes what I am looking for and then a reply with "FIXED" or "Never Mind, I resolved it" so I am putting here the answer given to me by l0rdphi1...thx 10x
Regarding where email notices are sent, you can change that on line 118 of directadmin.php; change $result['email'] to the actual email address you wish to receive notices at.

PauGasol
12-27-2007, 08:05 AM
Im seeing the output of server-status of Apache 1 and Apache 2 and seems to by very similar.. i think the script should be adapted easy l0rdphi1? are you the creator? Thanks