May 2011 Archives

Disk space monitoring using Cfengine

Problem

You want to monitor free disk space.

Solution

Cfengine has storage promises that can mount file systems and monitor disk space.

Starting processes using Cfengine

Problem

You want to ensure that a process is running.

Solution

This promise searches the process table for the regular expression “snmpd”. If this is not found the class “start_snmpd” is set. This class being set causes the command “/etc/init.d/snmpd start” command to be run.

Banning processes using Cfengine

Problem

You want to prevent certain processes from running.

Solution

In formal Cfengine parlance this promise ensures that there are zero instances of processes running that match the regular expression “snmpd”. If such processes are found a term signal is sent. If that signal is ignored a kill signal is sent.

Template files using Cfengine

Problem

Sometimes a file’s contents depends upon the class of host that the file resides on. This makes file copy promises impractical. Who wants to copy a different file for so many hosts? Sysadmins are a lazy lot.

Solution

Template files consist of two promises. One promise copies a base file whilst the second promise edits the base file. The key is the contents of the base file. It contains the names of Cfengine variables. These variables are expanded during the edit.

Managing crontables with Cfengine

Problem

You want Cfengine to manage crontables.

Solution

The recipe we used edit authorized_keys can also be used for crontables.

SSH public key distribution using Cfengine

Problem

You want to distribute public SSH keys.

Solution

There are two possible methods for distributing SSH public keys. The first involves a simple copy.

Creating links using Cfengine

Problem

You Cfengine binaries are in /var/cfengine/bin but you want them in the PATH.

Solution

Symbolic linking the binaries is a good approach. The most simple method follows. Please note that you should look at the introduction entry to this series to better understand the setup.

Cfengine 3 cookbook begins

In 2008 I wrote the original Cfengine cookbook. That edition covered Cfengine version 2. With the release of Cfengine 3 and its growing popularity it is time for a rewrite. This new edition takes the same approach as the first but it will be published one recipe at a time on this site. You’ll find practical examples of how Cfengine is used. You’ll be able to expand on these examples to create your own Cfengine policies.

New website

Welcome to my new website. Any old URL’s you might have bookmarked will not be available. Please use the search feature or browse around to find the new location of the old content. If you can't find something please contact me..

Special thanks to Jester Creative for their design help and to Steven Matic for his honest critiques.

A brief overview of Red Hat Enterprise Virtualization

Red Hat Enterprise Virtualization is a fairly new product offering from Red Hat. Red Hat acquired RHEV when they purchased Qumranet in September 2008. Qumranet created KVM when they created a Windows desktop virtualization product . RHEV is the evolution of that product and in the hands of Red Hat it offers a virtualization solution for both desktops and servers, Linux and Windows.