DirectAdmin Forums

Go Back   DirectAdmin Forums > General > Feedback & Feature Requests

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2003, 08:44 PM
interfasys's Avatar
interfasys interfasys is offline
Verified User
 
Join Date: Oct 2003
Location: CH
Posts: 1,187
CPU Limit

I'd love to be able to set a CPU limit on some accounts, so that those don't take a server down.
__________________
interfaSys sаrl
Switzerland
Solutions integration / Business analysis / IT Governance consulting

The best DirectAdmin user experience for small businesses
Custom Exim, Dovecot, antispam, webmail, DNS and stats configurations

on FreeBSD 8 (ZFS+RAID+IPv6)
Reply With Quote
  #2  
Old 12-29-2003, 09:54 AM
loopforever loopforever is offline
Verified User
 
Join Date: May 2003
Location: /home/admin
Posts: 298
This isn't possible, since CPU load changes based on a number of factors. For example, you may have 100 users on your machine, each using MySQL - but MySQL runs as a single daemon, queuing up queries and executing them as a single user. We can say "Hey, MySQL is driving the load up." but we can't say "Hey, demouser is driving the load up." You can view MySQL processes, but this won't assist you in determining which user is increasing the load.

PHP and Apache is also another great example. You can see that Apache is driving the load up, but you can't see what script is doing it. The process just appears as Apache, doing something, which was commanded my someone, whom we cannot determine.

So really, it's not possible to limit CPU load on a per user basis.
__________________
Matt Savona
serveIO
Creator of the DirectAdmin Enhanced Theme
Reply With Quote
  #3  
Old 12-29-2003, 11:51 AM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
What it would be possible to do is install a process resouce monitor which monitors resource usage of applications then using variables set by you recieve email alerts etc.

If you wanted something like that i would be happy to put up a how-to guide

Just as a note - that would be server specific not user specific due to the reasons listed above.

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #4  
Old 12-29-2003, 12:06 PM
interfasys's Avatar
interfasys interfasys is offline
Verified User
 
Join Date: Oct 2003
Location: CH
Posts: 1,187
I think I saw some scripts that could could alert me in case Apache was overloading, but that script would let me know which domain was causing it, so I thought it would be possible to throttle it.
__________________
interfaSys sаrl
Switzerland
Solutions integration / Business analysis / IT Governance consulting

The best DirectAdmin user experience for small businesses
Custom Exim, Dovecot, antispam, webmail, DNS and stats configurations

on FreeBSD 8 (ZFS+RAID+IPv6)
Reply With Quote
  #5  
Old 01-02-2004, 06:58 PM
S2S-Robert S2S-Robert is offline
Verified User
 
Join Date: Jun 2003
Location: The Netherlands
Posts: 415
One of my users actually crashed my apache somehow with 150 apache processes and rising, so if you could tell me which scripts you found that would be great.
Reply With Quote
  #6  
Old 01-02-2004, 07:35 PM
interfasys's Avatar
interfasys interfasys is offline
Verified User
 
Join Date: Oct 2003
Location: CH
Posts: 1,187
Head over to WHT. In the service offer forum, you'll find script and services for sale that will help you (sorry for not having more info right now).
__________________
interfaSys sаrl
Switzerland
Solutions integration / Business analysis / IT Governance consulting

The best DirectAdmin user experience for small businesses
Custom Exim, Dovecot, antispam, webmail, DNS and stats configurations

on FreeBSD 8 (ZFS+RAID+IPv6)
Reply With Quote
  #7  
Old 01-03-2004, 02:41 AM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
Well some news that you may be suprised by

open httpd.conf with your fav text editor search for the line:

#ExtendedStatus On

once you find it uncomment the line and add the following:

<Location /serverstatus>
allow from YOURIP
deny from all
SetHandler server-status
</Location>

you should now have

Quote:
ExtendedStatus On
<Location /serverstatus>
allow from YOURIP
deny from all
SetHandler server-status
</Location>
In your httpd.conf

Ensure you replace YOURIP with your actual IP address (this is so only you have access to the page - all other IP addresses will be disallowed access)

once your done run:

# service httpd restart

now go to:

yourdomain.com/serverstatus
SERVERIP/serverstatus

you will see a page showing each vhost whats happening etc.... aswell as CPU usage for each vhost.. so in reality... this feature is possible, although if you have followed this you will have noticed its off as default for performance issues - basically you have this but it will slow apache down and affect its performance.

This should come in handy when your servers resources seem to have shot up though

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #8  
Old 01-03-2004, 03:07 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Very, very interesting. If only the 'CPU' column could be monitored, a script could VERY EASILY keep a running total per domain. Then you could "limit X CPU per minute" or something.

Also, if you could do this on a per-domain basis, you'd only set it up for people you know are high CPU eaters.

Hmm...
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #9  
Old 01-03-2004, 03:12 AM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
Quote:
Originally posted by l0rdphi1
Very, very interesting. If only the 'CPU' column could be monitored, a script could VERY EASILY keep a running total per domain. Then you could "limit X CPU per minute" or something.
Since your the php man...... would it be possible get that area out using php... dont forget you can use php in shell scripting..... so if its possible to split that part of the code up with any lang and basically leave with a domain variable with the CPU usage of that domain (could even interact with a database here)

The only thing i dont like about the idea is the performance issues... but then i have no idea what kind of performace effects this causes.

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #10  
Old 01-03-2004, 03:19 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Yeah, that is all very feasible.

Also found this - http://httpd.apache.org/docs/mod/mod_status.html

"if you have lynx installed, you can also get a server statics report from the command line by running the command apachectl status, or, for the extended status report, apachectl fullstatus"

I need to isntall lynx and check that out


As for performance, I'm going to leave http://your.server.name/server-status?refresh=1 on for a bit and see what happens
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #11  
Old 01-03-2004, 04:49 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Well, I have been invoking this every second for the past hour and I can say I'm seeing absolutely no increase in load. I think I may go a head and start playing with a program to monitor CPU on a per-domain basis.
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #12  
Old 01-03-2004, 05:04 AM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
Performance issues wont neccessarily mean server load.... it could be page loading times (since each time a page is accessed its on that file etc.. if you have it running every 1 second for the application you are planning on developing this could cause problems there.... may want to do a bit of comparison between load times with pages etc before assuring yourself its not needed........

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
  #13  
Old 01-03-2004, 05:34 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Hmm. Good idea.

Hopefully I can get apache to generate this stuff directly in a log file, but we'll see.

Thanks.
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #14  
Old 01-03-2004, 06:41 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
I decided to give a go at parsing the httpd data, and here's what I came up with:

http://www.liquenox.net/cpu.monitor..../server-status

Replace 'http://your.server.name/server-status' with the URL to your stats page. Remember, this is only showing the totals for the data that would normally show on the page. Running totals over a set period of time is the next step, I guess.
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #15  
Old 01-03-2004, 06:43 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Yes, and below is the source I'm running ...removed.. VB screws it up too bad...

http://www.l0rdphi1.com/junk/cpu.monitor.phps
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

Last edited by l0rdphi1; 01-03-2004 at 06:48 AM.
Reply With Quote
  #16  
Old 01-03-2004, 06:58 AM
S2S-Robert S2S-Robert is offline
Verified User
 
Join Date: Jun 2003
Location: The Netherlands
Posts: 415
Well this is looking tremendously good! The page is however still not working when I C&P, it does work using your php script.

And if this script is not a resource hog, you could just let it run every second and print out the results 'realtime'. Or run a graph next to it.
Reply With Quote
  #17  
Old 01-03-2004, 07:03 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
I wish you could get Apache itself to print to a log with the data found on the server-status page. It's impossible to get *everything* the way I'm doing now, even running the script every second. Seems silly that Apache wouldn't let you do that.
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #18  
Old 01-03-2004, 07:07 AM
S2S-Robert S2S-Robert is offline
Verified User
 
Join Date: Jun 2003
Location: The Netherlands
Posts: 415
Perhaps there is some apache documentation that allows you to do this?

But even if you're not getting everything, it still provides a good way of seeing which sites take too much cpu time etc.
Reply With Quote
  #19  
Old 01-03-2004, 07:11 AM
l0rdphi1 l0rdphi1 is offline
Verified User
 
Join Date: Jun 2003
Posts: 1,467
Yeah, even setting it to run every 5 minutes would give you a good idea. Haven't seen any docs on this (besides the one I linked), so I'll just go a head with the current method.
__________________
Installatron Applications Installer gives you and your users an intuitive interface to install, upgrade, and backup/restore a growing collection of web apps. It's a native DirectAdmin plugin and is absolutely FREE for one domain!

Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool
Reply With Quote
  #20  
Old 01-03-2004, 12:34 PM
ProWebUK's Avatar
ProWebUK ProWebUK is offline
Administrator
 
Join Date: Jun 2003
Location: UK
Posts: 2,326
Quote:
Originally posted by S2S-Robert
And if this script is not a resource hog, you could just let it run every second and print out the results 'realtime'. Or run a graph next to it.
The graph could be done with mrtg, you just need the number (X) where X would be X% CPU usage...... thats not really wanted or needed for this though and just something that could be a nifty script for later on

lordphi: would it be possible to intergarte with mysql.... leaving the results to be used more easily

======================
Domain || <CPU USAGE>
======================
test.com || 0.01
your.com || 0.04
======================

etc

from there a shell script could simply be put in place with a 'max_cpu' variable.... a quick run through that table for a load higher than the var is specified as sends an email out to the admin (could also be a variable for the user to specify) possible admin@<DOMAIN_OVER_USAGE> and even suspend the account in directadmin for 2 minutes or a specified short period of time.. for the last idea we would need a command to suspend / unsuspend manually from command line

It may not be the best of things but I think its the best we could be getting without having individual daemons running for each domain.

Would make a brilliant 3rd party script if you ask me.... and it should work for all panels (at least everything but the domain suspension / unsuspension if thats possible )

Chris
__________________
OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
ProWebUK - Quality Web Services
DirectAdmin Server Checklist
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache modules to limit the (cpu/ip/etc) usage [need help] Canglan Apache (WWW) 4 10-01-2008 06:12 AM
Server crashing multiple times daily, started 5 days ago - please help gkane General Technical Discussion & Troubleshooting 2 09-05-2007 11:20 AM
JM Stacy Freebsd Kernal Errors goodgirl FreeBSD 4.x 10 08-08-2005 06:27 AM
Errors in daily report RosT DirectAdmin General Discussion 1 07-30-2005 01:29 PM
Apache modules to limit the (cpu/ip/etc) usage [need help] Canglan General Technical Discussion & Troubleshooting 0 01-18-2005 02:48 AM


All times are GMT -7. The time now is 07:35 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
DirectAdmin © 2007 JBMC Software