Pulling Strings With Puppet - James Turnbull [43]
The tagmail report uses these same tags to generate e-mail reports. The tags assigned to your resources are added to the log results, and then Puppet generates e-mails based on matching particular tags with particular e-mail addresses. The tags are matched with particular e-mail addresses in a configuration file called tagma 11. con-F. By default, the tagmail.conf file is located in $confdir directory, usually /etc/puppet. This is controlled by the tagmap configuration option in the puppet. conf file.
The tagma it. conf file contains a list of tags and e-mail addresses separated by colons. Multiple tags and e-mail addresses can be specified by separating them with commas. You can see an example of this file in Listing 5-2.
The first tag in Listing 5-2, all, is a special tag that tells Puppet to send all messages to the specified e-mail address.
Tip - There is another special tag, called err. Specifying this tag will send all error messages generated during a configuration run to a particular e-mail address.
The next tags tell Puppet to send all log messages tagged with the tags melbourne and sydney to the e-mail address aust_config@testing. org. The last tags tell Puppet to send messages for all log entries with the dbserver tag but not the oracle tag to both the db_config@testing.org and mysgl_config@testing.org e-mail addresses. You can see that the oracle tag has been negated using the ! symbol.
rrdgraph
One of the more useful built-in report processors is the rrdgraph type that takes advantage of Tobias Oetiker's RRD graphing libraries. The rrdgraph report processor generates RRD files, graphs, and some HTML files to display those graphs. It is a very quick and easy way to implement graphs of your Puppet configuration activities.
In order to make use of this report processor, we'll first need to install the RRDTools and the Ruby bindings for RRD. We can install RRDTools via package, and most platforms and distributions have a package for RRDTools. The Ruby bindings, unfortunately, are less well supported on a lot of platforms. They can be installed from source, or some distributions have packages available. There are also suitable rrdtool-ruby RPMs that should work on most RPM-based distributions like Red Hat, CentOS, and Mandriva versions available at Dag Wieer's repository at http://dag.wieers.com/rpm/packages/rrdtool/. There is also a development package for Gentoo called ruby-rrd that provides the required bindings that you should be able to install via emerge.
You can see a list of the required packages for various platforms in Table 5-1.
(Continued)
Note • Your package manager may also prompt you to install additional packages when installing RRDTool.
If there is not a Ruby bindings package for your platform, you can install the bindings via source. First, download the latest bindings package from RubyForge (at the time of writing, this was version 0.6.0), unpack it, and change into the resulting directory.
You will also need to configure three configuration options in the puppet. conf configuration file.
The rrddir directory specifies the default location for the generated RRD files; it defaults to $vardir/rrd, which is usually /var/puppet/rrd. The rrdinterval specifies how often RRD should expect to receive data. This defaults to $runinterval so as to match how often clients report back to the master. The last option, rrdgraph, turns on RRD graphing if set to true.
Underneath the $vardir/rrd directory, Puppet will create a directory for each node that reports to the master. Graphs (and associated HTML files to display them) will be generated in that directory. A graph will be generated for each metric that Puppet collects. You can then serve this directory out using your web server and display the graphs.
Custom Reporting