Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I can view "Currently failing" nodes in the puppet dashboard web GUI, and even drill into it to see what policy has gone awry. I can also see if nodes are not reporting.

Is there any way I could get these failures as email alerts as well?

share|improve this question
    
Haven't played much with Puppet yet, but is there a command-line equivalent to the dashboard that could be fed to a Nagios plugin (or something similar)? –  voretaq7 Nov 29 '11 at 17:03

3 Answers 3

up vote 2 down vote accepted

Puppet's "tagmail" report might do what you want. See http://docs.puppetlabs.com/references/0.25.5/report.html#tagmail for more information.

share|improve this answer
    
The tagmail.conf supports err: foo@foo.com which seems to do what I am looking for. –  Kyle Brandt Dec 1 '11 at 2:31
    
Awesome, glad I could help! –  Paul Lathrop Dec 1 '11 at 18:32

I had the same issue, and rather than going through the effort of installing Foreman, I ended up writing a quick and dirty shell/cron script to curl and grep puppet dashboard, and email the results. Thought it might be helpful to post. Surely can be cleaed up but works for me at the moment.

#!/bin/bash

UNRESPURL="http://puppet/nodes/unresponsive"
ERRORURL="http://puppet/nodes/failed"
EMAIL=my@email.address.com

NUMUNRESPNODES=`curl ${UNRESPURL} 2> /dev/null | grep -Po '(?<=<a href="/nodes/unresponsive">)([^</a>]*)' | grep -v "Unresponsive"`
NUMERRORNODES=`curl ${ERRORURL} 2> /dev/null | grep -Po '(?<=<a href="/nodes/failed">)([^</\a>]*)' | grep -v "Failed"`

# Check if there are any unresponsive nodes, before emailing
if [ ${NUMUNRESPNODES} -gt 0 ]; then
        # Email an alert
        echo "There are ${NUMUNRESPNODES} puppet nodes that haven't reported back to the puppetmaster. Please check ${UNRESPURL} for more info." | mail -s "ALERT: ${NUMUNRESPNODES} puppet nodes are unresponsive" ${EMAIL}
fi

# Check if there are any nodes with errors, before emailing
if [ ${NUMERRORNODES} -gt 0 ]; then
    # Email an alert
    echo "There are ${NUMERRORNODES} puppet nodes that are reporting errors. Please check ${ERRORURL} for more info." | mail -s "ALERT: ${NUMERRORNODES} puppet nodes are reporting errors" ${EMAIL}
fi

exit 0
share|improve this answer

Foreman Email is possibly the best way to get such reports. You could run it along side Dashboard.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.