On 9/1/15 1:21 PM, staceytian4...@gmail.com wrote:
> Hi,
> 
> I made some progress.
> 
> 1. Add the metaparameter tag => send_me_email (or any arbitrary set of
> tag values) to the resource you want to monitor via email.
> 2. Enable reports = tagmail in puppet.conf [master] section,
> 3. In tag.conf set tag and email address: send_me_email: us...@test.com
> 
> class javalinks {
> 
> file {      
>     "/usr/java/latest":
>     ensure => link,
>     noop   => true,
>     tag => send_me_email,
>   }
> }
> 
> Now I get email for this class even if my overall tag log level is set
> to err and above, while this class is giving Notice log.
> 
> However, there is another Notice for this class which I don't want to
> get email notification:
> 
> Notice: /File[/usr/java/latest]/seluser: current_value unconfined_u,
> should be system_u (noop)
> 
> I only want to get email for this message in this class:
> *Notice: /Stage[main]/Javalinks/File[/usr/java/latest]/ensure:
> current_value absent, should be link (noop)
> 
> *So here is the quesetion:
> How to tag a specify notice in a class?
> 
> Thanks,
> Stacey
> 
> On Monday, August 31, 2015 at 2:59:21 PM UTC-4, staceyt...@gmail.com wrote:
> 
>     Hi all,
> 
>     I am using Puppet 3.7.3 and have a question about tagmail.
> 
>     My tagmail.conf is setup to send email only when there is err and above:
>     *err, alert, emerg, crit: us...@test.com <mailto:us...@test.com>*
> 
>     I have a module to check javalinks:
> 
>     class javalinks {
> 
>     file {      
>         "/usr/java/latest":
>         ensure => link,
>         noop   => true,
>       }
>     }
> 
>     I want the module to ensure /usr/java/latest is a link, but don't do
>     anything (noop => true).
>     I want to get an email notifcation if the link is missing.
> 
>     If I don't have such a link, run "puppet agent -t" on the machine
>     will display this on console:
> 
>     *      Notice: /Stage[main]/Javalinks/File[/usr/java/latest]/ensure:
>     current_value absent, should be link (noop)*
> 
>     Since it is "Notice" level log, I don't get any email notification.
> 
>     So here is my question:
> 
>     *How could I get email notification for this specific Notice
>     message, without changing my tagmail.conf log level?*
> 
>     Thanks,
>     Stacey
> 
> -- 

Hi Stacey,

The tag() function might be of use to you in conjunction with tagmail.

http://docs.puppetlabs.com/references/latest/function.html#tag

Best regards,
-g


-- 
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/55E64FF5.60803%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to