Ok, I found part of the problem. I went to the database and had to note that my
custom variable host_type (or type) cannot be found in the
icinga_customvariables or icinga_customvariablesstatus table. Also only one of
my hosts has a “os” variable assigned while all have it in their definition.
Only the “sla” variable has been properly assigned to all hosts.
All switches had a custom template “generic-switch”, in this temjplat eI did
set vars.type = “switch”. As this did not work I added vars.host_type to the
hosts as well leaving the vars.type in the template. Now after my findings in
the database I have remove the vars.type from the tamplate and then the os and
host_type appeared in the database for the switches.
The weird thing is that the sla variable defined in the host definition was
already in the database, the other 2 variables “os” & “host_type” defined along
with it (one before, one after) where missing. Also I have other nodes which
use the unmodified generic-host and had the same issue with missing variables.
These nodes also had th evars.type custom variable set, but in the host
definition not the template. I modified the type into host_type and all
variables appeared in the database.
I have created a new host group with a new template for NAS devices and here
the host_type is set in the template with success.
So I guess that vars.type has some special internal meaning ?
------------------------------------------------------------------------------------------
Ø Uhm, might it be because you mix up the vars?
Ø
Oops, you are right of course, but that is not the problem, unfortunately.
First I used the vars.type variable. As this did not work I modified it to
“host_type” just in case “type” would be reserved for some special purpose. I
did not find anything in the docs that would suggest this could be the case,
but one never knows J. Unfortunately when copying the file contents to the mail
it was not yet modified in the groups.conf file.
The current settings are:
object HostGroup "network-switches" {
display_name = "Network Switches"
assign where host.vars.host_type == "switch"
}
object Host "switch22" {
import "generic-switch"
address = "10.1.0.22"
vars.os = "Netgear"
vars.sla = "24x7"
vars.host_type = "switch"
}
From: icinga-users [mailto:[email protected]] On Behalf Of
Rune 'TheFlyingcorpse' Darrud
Sent: Monday, August 04, 2014 8:16 PM
To: Icinga User's Corner
Subject: Re: [icinga-users] Hosts are not moved into new groups via assign
where clause in icinga 2
Uhm, might it be because you mix up the vars?
object HostGroup "network-switches" {
....
assign where host.vars.type == "switch"
}
Is not the same as
.....
object Host "switch22" {
vars.host_type = "switch"
}
I'd expect that statement to be host.vars.host_type in object HostGroup.
How does that work for you?
On 4 August 2014 20:10, Gaston Gloesener <[email protected]> wrote:
I am currently trying some alternatives for network monitoring and now am with
a brand new installation of icinga 2.0.1 and icinga-web 1.11.1.
I have tried to create new hostgroups by editing groups.conf and adding like:
object HostGroup "network-switches" {
display_name = "Network Switches"
assign where host.vars.type == "switch"
}
Then the file defining the actual switch:
object Host "switch22" {
import "generic-switch"
address = "10.1.0.22"
vars.os = "Netgear"
vars.sla = "24x7"
vars.host_type = "switch"
}
The hosts appear in icinga-web, but not the host groups. Previously I have
added linux servers which did correctly group in the predefined linux-servers
group .
Icinga2 --validate, validates the configuration, and I have tried to send
SIGHUP as well as restarting icinga2.
The validation message confirms that all 4 groups have been read:
[2014-08-04 20:04:08 +0200] information/ConfigItem: Checked 4 HostGroup(s).
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users