Multiple Icinga agent instances on one host

Hello,

Is it possible to run multiple Icinga client instances on the same host?
I can see that this is supported in theory: Distributed Monitoring - Icinga 2

I have an environment where monitored hosts are sitting in their own isolated networks. These networks also contain hosts that only allow SNMP requests from the local network (and can’t run any other software). At the same time, I don’t want to have every isolated network host showing up as one host in Icinga.

So my solution would be to use multiple Icinga instances so that I can get the hosts to show up as individual hosts rather than one host with many unrelated services.

If the multiple instance Icinga feature is still under development, is there any way to separate out services being checked on one host into many hosts? I’d like to retain the ability to centrally modify the configuration via Director which rules NRPE, NSCA, NRDP, NSCP, NCPA out.

I can see similar questions asked in these threads, but there isn’t a clear way to implement this:

1 Like

sounds like a really bad idea to run multiple agents on one host.

if you use the icinga director you can try the master branch and activate the endpoint feature.
than you can create multiple hosts which access one agent.

or you wait till it gets released.

best regards Nicolas

Here’s an approach which worked for me, @davekempe and others at sol1 in similar environments to what you’ve described.

I’d like to retain the ability to centrally modify the configuration via Director

If I remember correctly this approach should work fine with Director. But instead of writing text files you’re clicking around in the GUI to set variables etc.

Briefly

We would run an Icinga2 agent on a host in each network. On each Service, we set command_endpoint the name of the agent.

Detailed

Here’s an example setup.

Our 2 networks are in Sydney and Rotterdam. In each network, an Icinga2 agent is running on a host. That agent can connect to each device via SNMP.

Define the endpoints in each network:

object Endpoint "icinga.sydney.example.com" { ... }
object Endpoint "icinga.rotterdam.example.com" { ... }

A Service which checks something over SNMP:

apply Service "snmp_example" {
	check_command = "snmp"
	vars.snmp_oid = "1.2.3.4.5.6.7.8.9"
	command_endpoint = host.vars.agent_endpoint
}

Setting command_endpoint means that the agent executes the SNMP command rather than the master Icinga server.

Finally, define the hosts from each network, setting the agent_endpoint variable to the agent that is available in the particular network.

object Host "device1" {
	address = "192.0.2.1"
	vars.agent_endpoint = "icinga.sydney.example.com"
}
object Host "device2" {
	address = "192.0.2.2"
	vars.agent_endpoint = "icinga.sydney.example.com"
}
object Host "device3" {
	address = "198.51.100.1"
	vars.agent_endpoint = "icinga.rotterdam.example.com"
}
object Host "device4" {
	address = "198.51.100.2"
	vars.agent_endpoint = "icinga.rotterdam.example.com"
}
...

In this example, devices 1 and 2 are in the Sydney network. Devices 3 and 4 are in Rotterdam.

For another explanation of this approach, see the Icinga blog post on command endpoints.

Hope that helps :slight_smile:

2 Likes

Thank you so much @otl , that worked! It doesn’t seem to be possible to change command_endpoint in Director, but your solution works very well.