May 182013
 

This is a simple email alert for when your server process load reaches a defined threshold.

I wish I had retained the (StackExchange?) link I had found to give me the code below. Thank you to the original author. If you have a link to the source post for this code, please give credit in the comments below.

Save the code below as cpucheck.sh and execute via crontab every 15 minutes. It will email you at [email protected] a list of the top 10 cpu consuming running processes when the load average reaches 6.0 or higher.

#!/bin/bash
SUBJECT="`hostname` server load is high"
[email protected]
uptime > /tmp/load
if [ `uptime | awk '{ print$10 }' | cut -d. -f1` -gt 6 ];
then
echo "============================================" >> /tmp/load
`ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> /tmp/load `
mail -s "$SUBJECT" $TO < /tmp/load
exit
fi

Adjust -gt 6 to be any minimum load number you prefer to receive the alert.

Remove “| head -10″ if you would prefer to see the entire list of running processes.

Helpful resources:

Apr 032012
 

Passive mode ftp requires some or all “unprivileged” (1024-65534) ports to be open on the webserver. The default Plesk firewall configuration blocks all ports except for those single ports required for system services (HTTP, POP, etc.)

To enable passive mode ftp on a Plesk server:

SSH into your server and as root, edit /etc/proftpd.conf.

Add the line in the <global> section:

PassivePorts 60000 65534

* I prefer to limit the number of available ports for greater security.

 

Enable passive FTP in Plesk with this firewall rule

Enable passive FTP in Plesk with this firewall rule

Login to your Plesk Panel.

Go to Modules -> Firewall to access your firewall configuration.
Select Edit Firewall Configuration.

Add a new Rule:

 Name of the rule: FTPD Passive Ports
 Match direction: Incoming (only)
 Action: Allow
 Ports:
 Add port or port range: 60000-65534
 Select TCP
 Click Add

Click OK and then click Activate (twice)

More information about Passive vs. Active FTP

Oct 112010
 

Phoca PDF is a great tool to use if you want to quickly add a custom header and footer to your PDFs. The component, the plugin, and your select font should all be installed, but installation is easy.

What didn’t quite work for me is that my requirement was to print the logo header only on the first page (rather than at the top of every page), and to have no footer. The other issue is that while Phoco had options to cache the generated PDFs, it appeared that they were always generated on-the-fly, and with much longer processing time before showing the PDF to the visitor than with default Joomla.

Rather than try to get Phoca to do what I needed (which would’ve been a bit more time consuming as Phoca is more complex), I made the following modifications to these Joomla files:
(line numbers are approximate)

libraries/joomla/document/pdf/pdf.php

Lines 33-47, adjust var $_margin_top and $_margin_bottom depending on the height of your logo
Line 211
, comment out these lines:

// Set PDF Header data
// $pdf->setHeaderData(”,0,$this->getTitle(), $this->getHeader());  // this line prints the header on each page

libraries/tcpdf/tcpdf.php

line 561, set var $print_footer = false;
leave as true to get the default Joomla PDF footer,
setting var $print_header=false; will render blank PDFs, leave that value as true.

components/com_content/views/article/view.pdf.php

line 81, modify the code section to look like this:

// prepare header lines
// $document->setHeader($this->_getHeaderText($article, $params));
echo ‘<img src=”http://www.domainname.com/images/stories/printlogo.png” /><br /><br />';
echo ‘<h1>’ . $article->title . ‘</h1>';
echo $article->text;

There you go!

Jul 152010
 

Created by the same team that also brought us the indispensable YSlow tests, Boomerang allows us to collect the page load times from actual visitors.

While performing page load testing on your development machines using Firebug, YSlow, and other tools is important, nothing beats getting real world “perceived” page load times from your real visitors, along with other useful metrics.

The software works by adding some javascript to the page(s) that you’d like to benchmark and then deploying some php or other code that will save the incoming results into a database. The website below offers example code:

Try Boomerang.