Extracting Smarty variables from source

You can extract all of the variables in use from a Smarty template using a simple call to *nix grep with a trivial regex expression. Here is the command-

grep -o "\{\$[-_a-zA-Z0-9]*\}" my-template.tpl

Installing vzdump on CentOS 5.4 (32-bit)

There are a few items required for installing vzdump for OpenVZ on 32bit CentOS.

First, make sure you read the installation post covering the 64bit install. Here are the commands for 32bit. Here is how you get vzdump on a clean version of 32bit CentOS (via the hostnode):

rpm -ivh "ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/i386/RPMS.dag/cstream-2.7.4-3.el5.rf.i386.rpm"
wget http://dag.wieers.com/rpm/packages/perl-LockFile-Simple/perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm
rpm -ivh perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm
/bin/rm perl-LockFile-Simple-0.206-1.el5.rf.noarch.rpm
rpm -ivh "http://chrisschuld.com/centos54/vzdump-1.2-6.noarch.rpm"

Make sure you add in the PERL5LIB in your export (see the 64bit post):

export PERL5LIB=/usr/share/perl5/

Dumping Addresses from phplist

We recently moved away from phplist (goodbye phplist — we loved you for a while but now we need more power). Here is the SQL used to rip our users out of the main list. Attributes 1 and 2 are the first and last name.

SELECT DISTINCT
    phplist_user_user.email AS Email,
    phplist_user_user_attribute1.value AS FirstName,
    phplist_user_user_attribute2.value AS LastName
FROM
    phplist_user_user
JOIN
    phplist_user_user_attribute AS phplist_user_user_attribute1 ON ( phplist_user_user_attribute1.userid = phplist_user_user.id AND phplist_user_user_attribute1.attributeid = 1 )
JOIN
    phplist_user_user_attribute AS phplist_user_user_attribute2 ON ( phplist_user_user_attribute2.userid = phplist_user_user.id AND phplist_user_user_attribute2.attributeid = 2 )
JOIN
    phplist_listuser ON ( phplist_listuser.userid = phplist_user_user.id AND phplist_listuser.listid = 1 )
WHERE
    phplist_user_user.blacklisted = 0

Adding NRPE (Nagios) to CentOS \/ RHEL Servers

We use nagios to watch our networks and I always forget the simple steps necessary to drop NRPE on the virtual servers or physical services. This post is simply my process I use to drop NRPE on our servers.

yum install nrpe nagios-plugins-all
echo -e "nrpe\t\t5666/tcp\t\t\t# nrpe" >> /etc/services
chkconfig nrpe on
vi /etc/nagios/nrpe.cfg
/etc/init.d/nrpe start