On Tue, Feb 15, 2011 at 11:03 AM, Rus Hughes <[email protected]> wrote:
[snip]
>
> require 'puppet'
>
> Puppet::Reports.register_report(:nagios) do
> Puppet.settings.use(:reporting)
> desc "Sends reports directly to Nagios"
>
> def process
> begin
> exec "/usr/lib/nagios/eventhandlers/submit_puppet_result
> 10.30.0.101 puppet-report 0 \"There has been no change\""
> end
> end
> end
>
> http://pastie.org/1567064 in case email formatting munges things
>
You may want to avoid the use of exec, if Kernel.exec is the receiver
of this message, then the running Puppet Master process itself will be
replaced with your nagios check.
Check out the documentation for Kernel#exec:
699 puppet:2.6.next % /usr/bin/ri Kernel\#exec
------------------------------------------------------------ Kernel#exec
exec(command [, arg, ...])
------------------------------------------------------------------------
Replaces the current process by running the given external
_command_. If +exec+ is given a single argument, that argument is
taken as a line that is subject to shell expansion before being
executed. If multiple arguments are given, the second and
subsequent arguments are passed as parameters to _command_ with no
shell expansion. If the first argument is a two-element array, the
first element is the command to be executed, and the second
argument is used as the +argv[0]+ value, which may show up in
process listings. In MSDOS environments, the command is executed in
a subshell; otherwise, one of the +exec(2)+ system calls is used,
so the running command may inherit some of the environment of the
original program (including open file descriptors).
exec "echo *" # echoes list of files in current directory
# never get here
exec "echo", "*" # echoes an asterisk
# never get here
--
Jeff McCune
http://www.puppetlabs.com/
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.