0

We're using Puppet + Foreman to monitor changes in environment by checking custom facts. For example, whenever a custom fact equals 'true' puppet calls the Notify resource with a message sent to the agent log. Puppet includes this message in the agent report and Foreman shows this in UI.

Problem is that whenever a message is thrown, Foreman considers this action as "Applied" and the node status changes to "Active" (blue icon). We want to keep the node at "No Changes" (Green) plus show the Notify message.

Is that possible in some way? Maybe define a new custom resource type?

Here is the puppet code:

class mymodule::myclass::mysubclass {
if $::fact023 == 'fail' {
    notify {'mynotify1':
     message => "WARNING: Node ${::fqdn} failed fact023",
     loglevel => hiera('warnings_loglevel'),
   }   } }

See screenshot of Foreman here

Update: I'll refine the question: Is there a way to use the Notify resource without causing puppet to report that the node has changed? Meaning just print the message to client log (and therefore the message will be visible in report) but without puppet classify the event as an applied configuration?

The reason is that when puppet triggers the Notify resource, Foreman flags the node as being active (changed)

UPDATE #2 I'm thinking about changing Foreman report file so that the UI will ignore Notify events so that the node's status will remain unchanged but still show the message in the report. Can someone point me to the right direction? Thanks!

UPDATE #3 Problem fixed after switching from the "Notify" resource type to custom type "echo" created by some dude in Puppet Forge. Thanks!

1 Answer 1

0

It's not completely clear what you are trying to accomplish. One option would be to use the notice function instead of a resource. Functions execute on the puppet master, so you the log will end up in the puppet master's logs instead of the agent report. That also means that it will not count as an applied resource, and the node should appear to be stable.

3
  • We're tried using the notice command but just like you said, this is not visible in the client report. What we are trying to achieve is that when a client report contains a Notify message, the status in Forman will remain intact. Maybe the direction here is to change Foreman report code?
    – amirb
    Feb 4, 2016 at 11:23
  • I'll refine the question: Is there a way to use the Notify resource without causing puppet to report that the node has changed? Meaning just print the message to client log (and therefore the message will be visible in report) but without puppet classify the event as an applied configuration? The reason is that when puppet triggers the Notify resource, Foreman flags the node as being active (changed)
    – amirb
    Feb 4, 2016 at 22:24
  • I've found this to be my exact situation: projects.theforeman.org/issues/1443 Is there any workaround?
    – amirb
    Feb 11, 2016 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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