On 14-01-11 23:32, Jesse Becker wrote:
> On Fri, Jan 14, 2011 at 04:40:47PM -0500, no-re...@cfengine.com wrote:
>> Forum: Cfengine Help
>> Subject: Re: Lastseen in body agent control per documentation isn't valid
>> Author: msvob...@linkedin.com
>> Link to topic: https://cfengine.com/forum/read.php?3,20111,20112#msg-20112
>>
>> Nobody has lastseen working in 3.1.1?
>
> At least in 3.0.5p1 (I'm in the process of upgrading, but I'm not doing
> that on a Friday...), it looks like the same behavior.  However,
> cfengine is tracking some lastseen information already.  Take a look in
> /var/cfengine/reports/lastseen-<hostname>*.
>
> Of course, this could also be a side effect of running cf-report
> periodically as well; I'm not sure.
>
> I can confirm that the example in the documentation "works," but I don't
> understand exactly what it does.  I don't see how this snippet directly
> relates to when a host was last active:
>
>       reports:
>         "Comment"
>               lastseen =>  "10";
>
>
> However, I can confirm that this snippet does work as expected, so maybe
> that's of some help:
>
> bundle agent lastseen {
> vars:
>     cfengine_3::
>       'deadtime' int =>  '1';
>       'allhosts_name'  slist =>  { hostsseen("inf","lastseen","name") }, 
> policy =>  'free';
>       'deadhosts_name' slist =>  { hostsseen("${deadtime}","notseen","name") 
> }, policy =>  'free';
>
> reports:
>     cfengine_3::
>       "I know about host [${allhosts_name}].";
>       "I have not seen [${deadhosts_name}] in ${deadtime} hours.";
> }
>
>
>
Maybe it is useful for someone else. I have written an bundle that reports 
back if a client did not see the policy server for an hour. That is the 
smallest value that can be set.  I realy wanted to use 0.15 (each quarter 
of a hour)

## Report if we lost contact with our policy server for an hour
#
bundle agent cfengine3_check_server_connectivity
{
vars:
  "myhosts" slist => { hostsseen("1","notseen","address") };

classes:
  "cfengine_no_connectivity"   expression => reglist("@(myhosts)", 
escape("$(g.policyserver)"));

reports:
  cfengine_no_connectivity::
   "Not seen cfengine3 policy server: $(g.policyserver) for at least a
hour";
}


-- 
********************************************************************
*  Bas van der Vlies                    e-mail: b...@sara.nl       *
*  SARA - Academic Computing Services   Amsterdam, The Netherlands *
********************************************************************
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to