Ah, you're doing it on a per-promise basis. I may do that for specific 
promises, but I was wondering if there's any mechanism for having cf-agent send 
an alert whenever any promise is repaired. For example (not suggesting this 
method, just thinking "out loud") there could be a promise attribute "alert" 
for which you could set the default in the agent control body to true or false. 
Then you could change it on a per-promise basis.

Hmm, must cogitate. Thanks for the feedback, Neil!

Justin

-----Original Message-----
From: nwat...@symcor.com [mailto:nwat...@symcor.com] 
Sent: Tuesday, January 19, 2010 1:53 PM
To: Justin Lloyd
Cc: help-cfengine; help-cfengine-boun...@cfengine.org
Subject: RE: Triggering an alert when repairs occur

Something like this:
    files:
        "${trg}"
            perms => m( "${mod}" ),
            action => warn_now, # Passive only at this point.
            classes => cdefine( 
                "${trg}_mode_kept",
                "${trg}_mode_repaired",
                "${trg}_mode_failed"
            ),
            comment => "Check mode for ${trg}";

        "${trg}"
            perms => chown( "${usr}", "${grp}" ),
            action => warn_now, # Passive only at this point.
            classes => cdefine( 
                "${trg}_chown_kept",
                "${trg}_chown_repaired",
                "${trg}_chown_failed"
            ),
            comment => "Check owner and group for ${trg}";


    reports:

        all::
            "${g.pr} ${trg} fixed mode to ${mod}.",
            ifvarclass => canonify("${trg}_mode_repaired");

            "${g.pk} ${trg} correct mode ${mod}.",
            ifvarclass => canonify("${trg}_mode_kept");

            "${g.pf} ${trg} wrong mode ${mod}.",
            ifvarclass => canonify("${trg}_mode_failed");

            "${g.pr} ${trg} fixed owner and group to ${usr}:${grp}.",
            ifvarclass => canonify("${trg}_chown_repaired");

            "${g.pk} ${trg} correct owner and group ${usr}:${grp}.",
            ifvarclass => canonify("${trg}_chown_kept");

            "${g.pf} ${trg} wrong owner or group ${usr}:${grp}.",
            ifvarclass => canonify("${trg}_chown_failed");

Which works out to log entries prefixed with OK, WARNING or ALARM.

Sincerely,
--
Neil Watson
416-673-3465

This electronic communication and any attachments may contain confidential and 
proprietary 
information of DigitalGlobe, Inc. If you are not the intended recipient, or an 
agent or employee 
responsible for delivering this communication to the intended recipient, or if 
you have received 
this communication in error, please do not print, copy, retransmit, disseminate 
or 
otherwise use the information. Please indicate to the sender that you have 
received this 
communication in error, and delete the copy you received. DigitalGlobe reserves 
the 
right to monitor any electronic communication sent or received by its 
employees, agents 
or representatives.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to