foreman : Find host by report
I have a little technical question about foreman. I have an issue in some hosts managed by foreman. Several of them have a package called "nagios-nrpe-server" which is badly installed. So after each puppet_interval, puppet try to install it again and again creating this notice in the foreman report :
notice /Stage[main]/Nrpe::Install/Package[nagios-nrpe-server]/ensure ensure changed 'held' to 'present'
The problem is that as a result, the node stay in configuration "active" instead of "no change".
I have created a script which can iterate a manual installation of the package "nagios-nrpe-server" on all servers on which the package is badly installed, but I need to find first which of them have the package badly installed.
I am thinking a way of filtering all the hosts in foreman which have the message : "notice /Stage[main]/Nrpe::Install/Package[nagios-nrpe-server]/ensure ensure changed 'held' to 'present'" in their last report.
The foreman manuel say that :
In search queries, white spaces are used as a delimiter. Here are some examples of the way a query will be interpreted: description ~ "created successfully": list all notifications that contain “created successfully” description ~ created successfully: list all notifications that contain “created” and at least one of its text fields contains “successfully” description !~ created successfully: list all notifications that doesn’t contain “created” and at least one of its text fields contains “successfully”
I tested on the foreman web interface but it didn't work... Have you got an idea of how I could filter the hosts by their last report notice message using the web interface or an API ?