Rich Rauenzahn
2011-Jul-19 18:03 UTC
[Puppet Users] Not getting errors/warnings/etc in reports
I assumed this would have been fixed by 2.7.1, but it appears that when we call the functions err(), warning(), etc., that they don''t get added to the report object, which we are using to generate nagios alerts. I''m guessing I''ll have to write my own to do that -- does anyone have any examples of logging the error message and also adding it to the report object? (... and I don''t really want to use the exec { "/bin/false": } workaround) Rich -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rich Rauenzahn
2011-Jul-20 17:17 UTC
[Puppet Users] Re: Not getting errors/warnings/etc in reports
On Tue, Jul 19, 2011 at 11:03 AM, Rich Rauenzahn <rrauenza@gmail.com> wrote:> I assumed this would have been fixed by 2.7.1, but it appears that > when we call the functions err(), warning(), etc., that they don''t get > added to the report object, which we are using to generate nagios > alerts. > > I''m guessing I''ll have to write my own to do that -- does anyone have > any examples of logging the error message and also adding it to the > report object? (... and I don''t really want to use the exec { > "/bin/false": } workaround)Digging through the code it looks like puppet adds messages internally using Puppet.warning(), Puppet.error(), so I made a custom function to call these directly. I''m still not getting my error() messages in the report yaml ... why? And is there any workaround? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Peter Meier
2011-Jul-21 14:37 UTC
Re: [Puppet Users] Re: Not getting errors/warnings/etc in reports
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1>> I''m guessing I''ll have to write my own to do that -- does anyone have >> any examples of logging the error message and also adding it to the >> report object? (... and I don''t really want to use the exec { >> "/bin/false": } workaround) > > Digging through the code it looks like puppet adds messages internally > using Puppet.warning(), Puppet.error(), so I made a custom function to > call these directly. > > I''m still not getting my error() messages in the report yaml ... why?Probably, because functions are evaluated on the master, while the report is created on the client when the catalog is applied. So these messages never get sent down the client... ~pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4oOb0ACgkQbwltcAfKi3+UkgCfVa2tz5Nr6NyklpBwgGuHMoNL klQAoICzzOX7fckqU//hHxRSGFj8tskV =1kTp -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rich Rauenzahn
2011-Aug-01 17:24 UTC
Re: [Puppet Users] Re: Not getting errors/warnings/etc in reports
On Thu, Jul 21, 2011 at 7:37 AM, Peter Meier <peter.meier@immerda.ch> wrote:>> I''m still not getting my error() messages in the report yaml ... why? > > Probably, because functions are evaluated on the master, while the > report is created on the client when the catalog is applied. So these > messages never get sent down the client... > > ~peteAh, yes, that makes sense I guess. Puppet.error() calls within the resources executed on the clients get added to the client report, but Puppet.error() calls executed during compile time don''t because they executed on the server. For now I''ve done: define report::err($withpath=false) { notify { $name: tag => ''err'', withpath => $withpath, loglevel => ''err'', } } It''s a little annoying because it causes the creation of this resource to also be logged with loglevel = err, along with the message. But I think I can live with that. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.