Prototype: hostsseen(horizon, seen, field)

Return type: slist

Description: Returns a list with the information field of hosts that were seen or not seen within the last horizon hours up to lastseenexpireafter.

Finds a list of hosts seen by a CFEngine remote connection on the current host within the number of hours specified in horizon. The argument seen may be lastseen or notseen, the latter selecting all hosts not observed to have connected within the specified time.

Arguments:

  • horizon: int - Horizon since last seen in hours - in the range: 0,99999999999
  • seen: - Complements for selection policy - one of
    • lastseen
    • notseen
  • field: - Type of return value desired - one of
    • name
    • address
    • hostkey

Example:

code
bundle agent test
{
vars:

  "myhosts" slist => { hostsseen("inf","lastseen","address") };

reports:
  "Found client/peer: $(myhosts)";
}

See also: lastseenexpireafter in body common control