Overview

Puppet has the ability to send reports back to the master for each client run, these reports include performance metrics and all the logs of what was done in that run. I needed a simple PHP based tool to view these.

I needed something very simple with few requirements, and I needed the presentation to be completely template driven so I can use it for different clients where look and feel should be customised.

The graphs shown are generated by Puppet using its rrdgraph reporting option, I am simply linking those into the page.

http://www.devco.net/images/puppetview-2-small.png

screenshot 1 screenshot 3

The image above shows a list of reports for one host, this is the default look and feel out the box but it's completely customisable.

The code is still very new, specifically it has little by way of error checking at the moment and most importantly it does not have input validation, this is a tool you want to run somewhere far from the live internet and password protected.

Current State

This is very early code, Beta state, it works, you can see the reports but setup and error handling is not yet smooth. In the near future I want to add paging abilities so that on a host with many reports your machine does not crawl while PHP opens each YAML file, for now though I just keep a few days worth of logs.

Version 0.6 adds a new feature that lets you view your most recent facts that the client sent to the server.

Download

The latest version of the code is 0.6 and can be downloaded here. Look in the Related Links section for a puppet module that will install it all for you.

Installation

Requirements

I wrote this on a CentOS 5.2 machine with stock standard php 5 as supplied by CentOS. Included in the tar ball is a copy of Smarty, jQuery and a YAML Parser. You shouldn't need anything else to get this going.

Virtual Host

Create a vhost to host this in, you can host it in any sub directory on any vhost, I will assume your vhost is in /srv/www/you.com/html/, download and untar the code into there and move it all to a sub directory of your liking.

Now you need to set some permissions for Smarty, assuming your webserver runs as nobody

# cd /srv/www/you.com/html
# chown nobody:nobody smarty/templates_c smarty/cache

Puppetmaster

You need to enable both rrdgraph and store reporting types in your Puppet Master, this is the bits in my /etc/puppet/puppet.conf

[puppetmasterd]
        reports         = rrdgraph,store
        reportdir       = /srv/www/you.com/puppetreports
        rrddir          = /srv/www/you.com/html/rrd
        rrdinterval     = $runinterval
        rrdgraph        = true

Be warned that getting RRD reporting can be a mission, especially on RedHat Enterprise you can find some more information on the wiki and in this thread on the mailing list

I have not been able to find a way to change the ownership of these directories that puppet make to someone sensible, additionally they are all made with strict permissions and puppet will put them back that way if you change it. The only option then to let apache read the logs that I am aware of is to put your Apache (nobody on RHEL) into the puppet group.

Puppet View Config

Configuring the app is trivial, just edit config.php and change the locations mentioned in the top part of the code.

        # where your reports are stored, same as reportdir in puppet.conf
        $reportdir = "/path/to/reports";

        # where your rrd files are stored, same as rrddir in puppet.conf
        $rrddir = "/path/to/rrd";

        # where to find the rrd's on the web, can be full url or relative
        $rrdroot = "/rrd";

        # where the puppetmaster yaml directory is
        $yamldir = "/path/to/yaml";

Note the reports directory does not need to be in the webroot. The yamldir is where puppet stores the state of clients, on Red Hat that is /var/lib/puppet/yaml/.

Upgrading

From 0.5 to 0.6 is a simple upgrade, you should be able to just untar the new over the old but first make a backup of your config.php, simply add the yamldir to the config file and you should be fine.

Running

You should now be able to point a browser at the installation you did and see a list of hosts to browse. If you see a blank page look in your webserver erorr log, I do print a lot of Exceptions if permissions etc is wrong but as the code is new, there might still be some race condition that is not being caught.

Templates

There are only 4 templates that handles all presentation, as mentioned they are Smarty templates so should be easy to modify to your needs, they are stored in smarty/templates/ directory.

Related Links

Even Hisey made a puppet modules that will install Puppet View for you, at writing it includes version 0.5 and can be found at http://unix.eng.ua.edu/~barnowl/puppetview_module.tgz. He has also made RHEL compatible RubyRRDtool RPM files available at http://unix.eng.ua.edu/~barnowl/RubyRRDtool-0.6.0-1.i386.rpm and http://unix.eng.ua.edu/~barnowl/RubyRRDtool-0.6.0-1.src.rpm

Acknowledgements

Todo

Priority

Description

Version

1

Create a pager for the reports list and host list

2

View most recently received facts in /var/lib/puppet/yaml/

0.6

2

Synchronise configuration names for reportdir in puppet and puppet view to be less confusing

0.5

2

Separate configuration directives into single simple file for ease of templating in a puppet module

0.5

Changes

2008/07/14

Release 0.6 that can view facts

2008/07/14

Add a section for upgrades

2008/06/25

Add a section for Related Links

2008/06/24

Release version 0.5

2008/06/23

Add a Todo section to the wiki

2008/06/21

Initial Release

Puppet/PuppetView (last edited 2008-07-14 22:46:46 by RIPienaar)