Puppet: System Administration Automated

Support

Using Growl to Get Syntax Error Notifications from Puppetmaster

Newer puppets to a better job of notifying you about syntax problems with the config the puppetmaster is parsing, but there are still cases where items slip through the net. The symptom is that running "puppetd -t" on a node doesn't seem to apply the changes you know you've put into the config. The culprit, inevitably, is a syntax error that isn't finding it's way to the client to be reported.

Using this on your puppetmaster machine might help. Running it in a cron once a minute will cause growl notifications to come to your workstation (or wherever).

It could easily be adapted to use IM, SMS, twitter, or whatever.

A next step would be to have it take a user/host mapping from somewhere and coordinate that with your SCM logs.

Check Syntax and Report

#!/usr/bin/ruby

require 'rubygems'
require 'ruby-growl'

# use a dyndns host if you are mobile (or nsupdate)
host = "10.142.14.23" 

result = %x{/usr/bin/puppet --color false --parseonly /etc/puppet/manifests/site.pp}.chomp

if result.any?
    g = Growl.new host, "ruby-growl", ["ruby-growl Notification"]
    g.notify "ruby-growl Notification", "Puppetmaster Config Problem", result
end