Ask Your Question
1

Can I stop an exec from being classed as a change?

asked 2013-09-06 04:05:03 -0500

Simon gravatar image

updated 2013-09-12 01:00:24 -0500

golja gravatar image

I have a class that execs a script that in turn sends a passive check to a nagios/opsview server. This confirms if puppet has run ok.

class opsview_notify{
  exec { "/app/nrpe/bin/send_nsca.sh puppet 0 OK":
    loglevel  => "info",
    logoutput => "on_failure",
  }
}

The Opsview server then alerts if it has not received this update within 1 hour.

As this class does not change any configuration, I was wondering if there is a way that I could prevent Puppet from seeing this as a change?

Foreman/Puppet Dashboard both report this as a change which makes it impossible to spot when ... (more)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-09-06 08:26:55 -0500

jonuwz gravatar image

updated 2013-09-06 08:27:40 -0500

hack ..

class opsview_notify{
  exec { "send_nsca.sh puppet 0 OK":
   command   =>  '/bin/true'
   unless        => "/app/nrpe/bin/send_nsca.sh puppet 0 OK"
   loglevel  => "info",
   logoutput => "on_failure",
  }
}

if send_nsca.sh always succeeds, you'll never see a change.

edit flag offensive delete link more

Comments

Excellent. I'll give that a try. Many thanks.

Simon gravatar imageSimon ( 2013-09-09 07:38:02 -0500 )edit

Works great. Thanks again.

Simon gravatar imageSimon ( 2013-09-09 08:06:30 -0500 )edit
0

answered 2013-09-06 05:00:29 -0500

golja gravatar image

The reports output can definitely differentiate between a successfully run, but also if there were any changes made.

For example the puppet enterprise console shows you also the outcome of the report which can be; failed, unchanged, changed.

One way to do it in a more sophisticated way is to write an custom made report handler which will analyse the YAML output and if there are changes you can trigger a different alert to the Opsview. Have a look at the metrics -> values -> changed value in the YAML report.

For furher reading http://docs.puppetlabs.com/guides/reporting.html

edit flag offensive delete link more

Comments

Many thanks for the info. I'll take a look.

Simon gravatar imageSimon ( 2013-09-06 05:11:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-09-06 04:05:03 -0500

Seen: 673 times

Last updated: Sep 06 '13