Page 1 of 1
Log or database entry for host changing host group?
Posted: Fri Sep 16, 2016 12:18 pm
by peter.zanetti
We frequently have hosts that change host groups to receive different types of monitoring, is there anywhere we can see when a host was moved from one host group to another?
Re: Log or database entry for host changing host group?
Posted: Fri Sep 16, 2016 12:40 pm
by mcapra
If I remove the host "alice" from the hostgroup "mediocre-servers" and add it to the hostgroup "cool-servers", the following entry is added to
nagiosxi.xi_auditlog.message:
So not exactly as specific as you would like.
You could probably do this on a cron job by querying the
nagiosql.tbl_host table and storing the entries
id,
host_name, and
hostgroups fields and using them as a reference for the next time the cron job gets run. Some pseudocode:
Code: Select all
$old = previous query result;
$current = SELECT id, host_name, hostgroups FROM nagiosql.tbl_host;
if(!($old.hostgroups == $current.hostgroups)) {
//changes were made, figure them out and report to a file
}