Icinga Host Agent doesn't work properly

Hello, I am desperate and need help. I am trying for 2 Days to add a Windows Agent to the Icinga2 Master but it doesn’t work as it should. I have started PowerShell Kickstart Script and I have installed the agent on the windows machine and that agent is showing up as a host in Director. I have deployed the Agent Host and after that, I got the message that the Host is down and that the ping is critical. But that is all because it is checking the master, not the Window agent. See the picture. The Check Source is my server where the master is not the Windows Agent. I have selected the option run on Agent in my Host template. All services I run on that Host are running on Agent (see the second picture). That means that the master is communicating with the agent but the host is always Down and I don’t know what to do next. I am searching the web for 2 days if anybody can help me explain what am I doing wrong I would be really thankful. Sorry if I make some mistakes English is not my native language.

Hi, welcome to the forum!

It is hard to tell what exactly your problem is on these pictures. Could you share some configuration of your setup? Perhaps some logging? It would help us help you :slight_smile:

Hello here is the icinga2 log from master:

[2020-11-17 12:43:39 +0200] information/IdoMysqlConnection: Pending queries: 11 (Input: 3/s; Output: 2/s)
[2020-11-17 12:45:30 +0200] information/ConfigObject: Dumping program state to file '/var/lib/icinga2/icinga2.state'
[2020-11-17 12:45:49 +0200] information/WorkQueue: #6 (ApiListener, RelayQueue) items: 0, rate: 0.833333/s (50/min 269/5min 312/15min);
[2020-11-17 12:45:49 +0200] information/WorkQueue: #7 (ApiListener, SyncQueue) items: 0, rate:  0/s (0/min 0/5min 0/15min);
[2020-11-17 12:45:49 +0200] information/IdoMysqlConnection: Pending queries: 0 (Input: 3/s; Output: 3/s)

I don’t have any error messages there.

Here is the log from agent:

[2020-11-17 11:45:33 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2020-11-17 11:45:43 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2020-11-17 11:45:53 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2020-11-17 11:48:38 +0100] information/ConfigObject: Dumping program state to file 'C:\ProgramData\icinga2\var\lib\icinga2/icinga2.state'
[2020-11-17 11:48:49 +0100] information/WorkQueue: #4 (ApiListener, RelayQueue) items: 0, rate:  0/s (0/min 0/5min 0/15min);
[2020-11-17 11:48:49 +0100] information/WorkQueue: #5 (ApiListener, SyncQueue) items: 0, rate:  0/s (0/min 0/5min 0/15min);

The problem I have is that agent is installed correctly (I hope so because service checks are working). But the host in Icinga is always DOWN. And that is because the Check Source is always the master server, not the Agent.

I have added in director config under /var/lib/icinga2/api/packages/director/a337d75f-6761-44a7-a31c-a729c2e2c6de/zones.d/master.server.com/host.conf to the agent hosts command_endpoint = host.name and after that my host I no longer DOWN and all is working as it supposed to do. But after I deploy any new change in director this command is overwritten and I need to go again in that conf file and add command_endpoint. This should be automatically in the host after I select in director Host template Icinga2 Agent = Yes but it doesn’t do that. I don’t know why is it like that.

I am running the Director from the master branch.

I hope you understand my problem now a little bit better and I hope you can help me. Ask me anything and I will do my best to respond appropriately.

Right,

it is a good practice to let the icinga server to monitor your host states up and down.
Your server by the pictures is doing the hostalive check. And offloads all the service checks to the host itself (is a process running, how is your disk etc.) This lightens the load on your server. so, so far so good !

in a typical setup you will see:

command_endpoint = host.vars.agent_endpoint
check_command = "hostalive"

where: host.vars.agent_endpoint is usually defined in the host config like this: vars.agent_endpoint = name

So to fix your setup you could have a look at some of the firewall settings for ICMP
you can find info about this default check here:

The hostalive command is one of several built-in check commands. It sends ICMP echo requests to the IP address specified in the address attribute to determine whether a host is online.

That should solve all your problems and keeps you in a more “default” / “standard” way of monitoring.

Hello, Thanks again for your reply. :slightly_smiling_face:

My Host Agent is a Windows PC that is located in an Intranet behind the public IP address and the Host Agent IP address is 192.168.10.121. So master is running the command hostalive on the Server and is trying to ping the local IP from the Agent and that is, of course, impossible because the master can not reach the local IP address so the command hostalive should be run on the agent so the agent can report later if he can ping itself.

I am running all configuration of hosts and services through the Director module. I am not configuring anything in conf files on the server. Even if I configure anything, as I did with adding manually command_endpoint to the host, it will be overwritten by the next deployment in director.

I believe this is a bug with the director because choosing the option Icinga2 Agent to Yes should fix my problem but it doesn’t do that. The command hostalive is still run on the server, not on the host agent machine.

But I have seen people deploying Windows Host Agents and it is deployed correctly I am doing the same thing and I got always this problem.

Ah yes, that will make it a bit more difficult to ping :slight_smile:

We do not use the director ourselves as we <3 automation.
Have you seen this post ?

At this point I am googling as much as you :wink:

1 Like