2016-04-13 16:10:08 +02:00
|
|
|
<a id="Working-with-agents"></a>Working with Agents and Config Zones
|
|
|
|
====================================================================
|
2016-04-12 09:33:17 +02:00
|
|
|
|
|
|
|
Working with Icinga 2 Agents can be quite tricky, as each Agent needs
|
2016-07-21 17:43:57 +02:00
|
|
|
its own Endpoint and Zone definition, correct parent, peering host and
|
2016-04-12 09:33:17 +02:00
|
|
|
log settings. There may always be reasons for a completely custom-made
|
2016-10-20 02:49:09 +02:00
|
|
|
configuration. However, I'd strongly suggest to give the Director-assisted
|
|
|
|
variant at least a try first. It might save you a lot of headaches.
|
2016-04-12 09:33:17 +02:00
|
|
|
|
2016-04-17 18:20:20 +02:00
|
|
|
|
2016-04-12 09:33:17 +02:00
|
|
|
Preparation
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Agent settings are not available for modification directly on a host
|
|
|
|
object. This requires you to create an "Icinga Agent" template. You
|
2016-10-20 02:49:09 +02:00
|
|
|
could name it exactly like that; it's important to use meaningful names
|
2016-04-12 09:33:17 +02:00
|
|
|
for your templates.
|
|
|
|
|
2016-04-17 18:20:20 +02:00
|
|
|

|
|
|
|
|
2016-10-20 02:49:09 +02:00
|
|
|
As long as you're not using Satellite nodes, a single Agent zone is all
|
|
|
|
you need. Otherwise, you should create one Agent template per satellite
|
|
|
|
zone. If you want to move an Agent to a specific zone, just assign it
|
2016-04-12 09:33:17 +02:00
|
|
|
the correct template and you're all done.
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2016-04-17 18:20:20 +02:00
|
|
|
Well, create a host, choose an Agent template, that's it:
|
|
|
|
|
|
|
|

|
|
|
|
|
2016-10-20 02:49:09 +02:00
|
|
|
Once you import the "Icinga Agent" template, you'll see a new "Agent" tab.
|
2016-04-12 09:33:17 +02:00
|
|
|
It tries to assist you with the initial Agent setup by showing a sample
|
2016-04-17 18:20:20 +02:00
|
|
|
config:
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
The preview shows that the Icinga Director would deploy multiple objects
|
|
|
|
for your newly created host:
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
Create Agent-based services
|
|
|
|
---------------------------
|
|
|
|
|
2016-10-20 02:49:09 +02:00
|
|
|
Similar game for services that should run on your Agents. First, create a
|
|
|
|
template with a meaningful name. Then, define that Services inheriting from
|
2016-04-17 18:20:20 +02:00
|
|
|
this template should run on your Agents.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
Please do not set a cluster zone, as this would rarely be necessary.
|
|
|
|
Agent-based services will always be deployed to their Agent's zone by
|
|
|
|
default. All you need to do now for services that should be executed
|
2016-10-20 02:49:09 +02:00
|
|
|
on your Agents is importing that template:
|
2016-04-17 18:20:20 +02:00
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
Config preview shows that everything works as expected:
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
It's perfectly valid to assign services to host templates. Look how the
|
|
|
|
generated config differs now:
|
|
|
|
|
|
|
|

|
|
|
|
|
2016-10-20 02:49:09 +02:00
|
|
|
While services added to a host template are implicitly rendered as
|
2016-04-17 18:20:20 +02:00
|
|
|
assign rules, you could of course also use your `Agent-based service`
|
|
|
|
template in custom apply rules:
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|