Puppet - Setup / Test Notes

Posted by John
on Wednesday, 09 July 2008

'Put simply, Puppet is a system for automating system administration tasks'

Install

Depends on Ruby (at least 1.8.2), install with:

Client:

sudo aptitude install puppet facter

Server:

sudo aptitude install facter puppet puppetmaster

A Simple Manifest: Managing Ownership of a File

Step one: Create /etc/puppet/manifests/classes/sudo.pp
sudo nano /etc/puppet/manifests/classes/sudo.pp

class sudo {
    file { "/etc/sudoers":
        owner => "root",
        group => "root",
        mode  => 440,
    }
}
Step two: Create /etc/puppet/manifests/site.pp
sudo nano /etc/puppet/manifests/site.pp

import "classes/*"

node default {
    include sudo
}
Step three: Start the Puppetmaster
master % sudo puppetmasterd --mkusers

master % sudo /etc/init.d/puppetmaster restart  (for ubuntu / debian)
Step four: Run a client
client% sudo puppetd --verbose

master% sudo puppetca --list

master% sudo puppetca --sign <client>

Keeping track of resources with Monit

Posted by John
on Sunday, 08 June 2008

Another handy tool i've grown to like is Monit, which makes keeping tabs on memory-hungry processes much easier.

Basically once configured it helps keep an eye on particular process (e.g PostFix, PostGreSQL, Apache or your disk space). If one is starting to use too much memory, your running low on disk space or it's just no longer responding it can automatically restart it for you and alert you in the process; making system administration that little bit easier.

Installing

Install with Aptitude using,

sudo aptitude install Monit

After which it will tell you it's won't start until it's been configured,

Starting daemon monitor: -e monit won't be started/stopped
  unless it it's configured
  -e  please configure monit and then edit /etc/default/monit
  -e  and set the "startup" variable to 1 in order to allow
  -e  monit to start

Configuring

First make a backup copy of it's initial config, in case you need to rollback:

sudo cp /etc/monit/monitrc /etc/monit/monitrc.orig

Now edit it with:

sudo nano /etc/monit/monitrc
  • uncomment set daemon 120, so monit will run every two minutes.
  • uncomment set alert and enter the email address you want to use for email alerts.
  • uncomment include /etc/monit.d/* so it will read in all config files within that directory.
  • save and create the monit.d directory,

    sudo mkdir /etc/monit.d

By using a wildcard for that last config change you can build up separate .monitrc files for each service you want to monitor, making future modifications easier.

For example, monitor disk usage using:

sudo nano /etc/monit.d/system.monitrc

check system mysite.com
  if loadavg (1min) > 4 then alert
  if loadavg (5min) > 2 then alert
  if memory usage > 85% then alert

check device rootfs with path /dev/sda1
  if space usage > 85% then alert

Starting

After making your changes, check the syntax you used is correct with,

sudo monit -t

...if you uncommented the last line include /etc/monit.d/* and you've got no config files in there you'll get an error stating it can't find any config files there. don't worry too much about that, no need running it if you haven't got anything for it to do.

Now edit,

sudo nano /etc/default/monit

And change startup=0 to 1 to enable it, save the file and run,

sudo /etc/init.d/monit start

To start the service, stop it with,

sudo /etc/init.d/monit stop

...based partly on an example from Monit for Peace of Mind & Monitoring Ubuntu Services with Monit. More info at the official Monit site.

Plus a good example pastie here,

Moveme.com - We Won!

Posted by John
on Wednesday, 16 January 2008

Moveme.com - Winners of the People's Choice Award 2007

moveme.com

Move Me, this year's People's Choice winner, beat competition from far and wide to take the number one prize, proving that moving doesn't have to be as stressful as we may think.

In addition to taking the People's Choice crown, it also proved a popular site with the expert panel of judges, winning the Innovative category award announced earlier in January.

Move Me aims to take away the stress of moving house with its free Move Planner. The planner takes everything into account from finding reputable removal firms to who you need to notify of your change of address.

Enjoy!

Looking forward to the award arriving this week ;-)