Fixing CPanel Overloads
Feb 28th, 2007 by Greg Bulmash
I host the site for an online entrepreneurs group I'm in, and one of the services the site offers to members is an AdSense alternative. Basically, we can create AdSense-like ads for our sites and put them in a pool. When Google AdSense has no ad to put in a space on one of our sites, it can be instructed to hit our AdSense alternative which will grab random ads from the pool and put them in the space instead.
This generates about a million hits or more a month on my server (an AMD 3800 with 2 gigs of RAM, using cPanel to manage multiple accounts). It's not a big deal because the average hit is under 1k a pop and the script is fairly simple, so the alt ads can be served very quickly and don't significantly interfere with the speed of other sites I'm hosting on that server.
But where it became a problem was in the logfile analysis. It creates a pretty big log file which can take a while to process for the multiple stats packages offered by CPanel. When the processing load gets too big, cPanel e-mails me this message...
IMPORTANT: Do not ignore this email.
This is cPanel stats runner on ****.*****.com!
While processing the log files for user ****, the cpu has been
maxed out for more than a 6 hour period. The current load/uptime line on the server at the time of
this email is
11:40:02 up *** days, **:**, *** users, load average: ****, ****, ****
You should check the server to see why the load is so high and take
steps to lower the load.
Now, first off... no one looks at these stats regularly. And if someone wanted to, they could always just download the logs and process them locally with a log analysis program. There's no need to bog down the server with nightly processing.
But how do you turn off log analysis in cPanel? How do you disable stats reporting? And more importantly, how do you disable log analysis for just one account in cPanel? I went through the account's control panel and didn't find much.
I Googled for ways to deal with this message, but many of them involved kiling processes and restarting cPanel. Another suggested erasing the logs via a Cron job before the analysis run started. Both of them were hacks that didn't get at the root problem, so I poked around in the root control panel some more and found the answer.
Here's how you do it:
- Go to the Packages section of the side menu in the root cPanel account.
- Select Feature Manager and create a new feature set.
- You get very granular control over the features available to an account and can create a set that does not offer any of the log analysis packages.
- Save this new feature set.
- Select Add Packages in the Packages section (where you already are) and create a hosting package that uses the feature set you just created.
- Go up the menu to the Account Functions section, and select the Upgrade/Downgrade An Account option.
- Select the account that's been generating the problem and switch it to the hosting package you just created.
Voila. This should lower the daily CPU load of the account significantly and reduce or eliminate the cPanel "maxed out" warning messages.
UPDATE: Seems you can also turn off these stats packages for all accounts. In the topmost menu of the root cPanel account (a.k.a. "WebHost Manager"), labeled "Server Configuration", select the "Tweak Settings" option. This will let you enable or disable a number of packages that come standard with cPanel, including the stats packages, various anti spam tools, various webmail packages (like Horde and Squirrel Mail), etc.
I would suggest that you disable everything you don't specifically want to offer. Remember that a number of sites get hacked not through attacks on their operating system or their web server, but through vulnerabilities in their web applications, like bulletin boards and web mail, that let hackers insert malicious code. So anything you don't plan to use or let other sites on your server use should be turned off just for safety's sake.
So, for locking down your system, go through "Tweak Settings" and turn off anything you don't want to offer to any of your users. Then, if you need to disable specific things for specific users, but leave them available to others, use the "Packages" solution I detail above.