Hello,
I’ve added a host using the Icinga2Agent powershell module.
The host is added, and the host is seen as up.
The Host Template for the agent includes a service check - disk-windows
However, it’s stuck in a Pending state, and the Last check/Next check/Check source are blank.
Screenshot of blank checks: https://i.imgur.com/8FtfcmU.png
Screenshot of host template that is setup for self service: https://i.imgur.com/jF7HLTU.png
Icinga 2 version: 2.11.2-1
Director version 1.7.2
This is the Service object:
Object Properties
__name "host_name.example.com!disk windows"
acknowledgement 0
acknowledgement_expiry 0
action_url ""
active true
check_attempt 1
check_command disk-windows
check_interval 300
check_period "Always"
check_timeout null
command_endpoint "host_name.example.com"
display_name "disk windows"
downtime_depth 0
enable_active_checks true
enable_event_handler true
enable_flapping false
enable_notifications true
enable_passive_checks true
enable_perfdata true
event_command ""
flapping false
flapping_current 0
flapping_last_change 0
flapping_threshold 0
flapping_threshold_high 30
flapping_threshold_low 25
force_next_check false
force_next_notification false
groups
ha_mode 0
handled false
host_name "host_name.example.com"
icon_image ""
icon_image_alt ""
last_check -1
last_hard_state 3
last_hard_state_change 1575989641.874846
last_reachable true
last_state 3
last_state_change 1575989641.874846
last_state_critical 0
last_state_ok 0
last_state_type 0
last_state_unknown 0
last_state_unreachable 0
last_state_warning 0
max_check_attempts 3
name "disk windows"
next_check 1575994615.461033
notes ""
notes_url ""
original_attributes null
package "director"
paused false
previous_state_change 1575989641.874846
problem true
retry_interval 60
severity 24
state 3
state_type 0
type "Service"
vars null
version 0
volatile false
zone "master"
What I also tried is uninstalling the Agent from the remote host, removing the ProgramData\Icinga2 directory, and deleting the Host from Director.
Then I ran the PS module on the remote host to check it via the Director API:
Icinga2AgentModule `
-DirectorUrl 'https://mastericinga.example.com/icingaweb2/director/' `
-DirectorAuthToken '43d6ae3b9b48ff233c11769d911f50eec33e9333' `
-CAServer 'mastericinga.example.com' `
-IgnoreSSLErrors `
-ParentEndpoints 'monitor-master' `
-RunInstaller
Which produces this output:
Notice: Started script run...
Notice: Connected successfully to Icinga Director Self-Service API over API token.
Notice: Setting internal Agent Name to "host_name.example.com.com"
Notice: Trying to fetch Host IP-Address for hostname: host_name.example.com.com
Notice: Setting IP 10.36.25.232 as primary IP for this host for all requests. Access it with &ipaddress& for all JSON requests.
Notice: Transforming Agent Name to host_name.example.com.com
Notice: Using Icinga version "", setting certificate directory to "C:\ProgramData\icinga2\etc\icinga2\pki"
Warning: Icinga 2 Agent does not seem to be installed on the system
Notice: Downloading Icinga 2 Agent Binary from "https://packages.icinga.com/windows/Icinga2-v2.11.2-x86_64.msi"
Warning: Icinga 2 Agent Installer verification disabled.
Notice: Installing Icinga 2 Agent
Notice: Icinga 2 Agent installed.
Notice: Using Icinga version "2.11.2", setting certificate directory to "C:\ProgramData\icinga2\var\lib\icinga2\certs"
Notice: Found Icinga 2 Agent version 2.11.2 installed at "C:\Program Files\ICINGA2\"
Notice: Removing downloaded Icinga 2 Agent installer
Notice: Creating host "host_name.example.com.com" over API token inside Icinga Director.
Notice: Writing host API-Key "d7a78c4e8b3950cd6509955167908e232981fd8c" to "C:\ProgramData\icinga2\etc\icinga2\icingadirector.token"
Notice: Successfully fetched configuration for this host over Self-Service API.
Notice: Fetched ticket "ed8957635758810debf26d33603cf2c2636b1ce3" from Icinga Director
Notice: Generating Host certificates required by Icinga 2
Notice: information/base: Writing private key to 'C:\ProgramData\icinga2\var\lib\icinga2\certs\host_name.example.com.com.key'.
information/base: Writing X509 certificate to 'C:\ProgramData\icinga2\var\lib\icinga2\certs\host_name.example.com.com.crt'.
Notice: Storing Icinga 2 certificates
Notice: information/cli: Retrieving X.509 certificate for 'mastericinga.example.com:5665'.
Subject: CN = mastericinga.example.com
Issuer: CN = Icinga CA
Valid From: Dec 9 15:36:33 2019 GMT
Valid Until: Dec 5 15:36:33 2034 GMT
Fingerprint: 95 FD EA 82 A4 CF A1 E8 C5 58 33 EB 2C CC 0D 14 D8 AD 67 B0
***
*** You have to ensure that this certificate actually matches the parent
*** instance's certificate in order to avoid man-in-the-middle attacks.
***
information/pki: Writing certificate to file 'C:\ProgramData\icinga2\var\lib\icinga2\certs\trusted-master.crt'.
Notice: Certificate fingerprint: "95FDEA82A4CFA1E8C55833EB2CCC0D14D8AD67B0"
Warning: CA fingerprint validation disabled
Notice: Requesting Icinga 2 certificates
Notice: information/cli: Writing CA certificate to file 'C:\ProgramData\icinga2\var\lib\icinga2\certs\ca.crt'.
information/cli: Writing signed certificate to file 'C:\ProgramData\icinga2\var\lib\icinga2\certs\host_name.example.com.crt'.
Notice: Icinga 2 configuration backup successfull
Notice: Writing icinga2.conf to "C:\ProgramData\icinga2\etc\icinga2\"
Notice: Icinga 2 configuration check successfull.
Notice: Trying to disable debug log for Icinga 2...
Notice: Icinga 2 debug log is not enabled or configuration not found
Notice: Trying to enable logging for Icinga 2...
Notice: Icinga 2 logging is already enabled or configuration not found
Notice: Trying to install Icinga 2 Agent Firewall Rule for port 5665
Notice: Icinga 2 Agent Firewall Rule already installed. Trying to remove it to add it again...
Notice: Icinga 2 Agent Firewall Rule has been removed. Re-Adding now...
Notice: Icinga 2 Agent Firewall Rule successfully installed for port 5665
Notice: NSClient++ will not be installed on the system.
Notice: Restarting service icinga2
Notice: Icinga 2 Agent successfully restarted.
The remote host log has this in the icinga2 agent log (C:\ProgramData\icinga2\var\log\icinga2\icinga2.log):
[2019-12-10 14:30:11 -0500] information/FileLogger: 'main-log' started.
[2019-12-10 14:30:11 -0500] information/NotificationComponent: 'notification' started.
[2019-12-10 14:30:11 -0500] information/CheckerComponent: 'checker' started.
[2019-12-10 14:30:11 -0500] information/ConfigItem: Activated all objects.
[2019-12-10 14:30:17 -0500] information/FileLogger: 'main-log' started.
[2019-12-10 14:30:17 -0500] information/ApiListener: 'api' started.
[2019-12-10 14:30:17 -0500] information/ApiListener: Started new listener on '[::]:5665'
[2019-12-10 14:30:17 -0500] information/ConfigItem: Activated all objects.
[2019-12-10 14:30:27 -0500] information/WorkQueue: #4 (ApiListener, RelayQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min);
[2019-12-10 14:30:27 -0500] information/WorkQueue: #5 (ApiListener, SyncQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min);
[2019-12-10 14:35:17 -0500] information/ConfigObject: Dumping program state to file 'C:\ProgramData\icinga2\var\lib\icinga2/icinga2.state'
[2019-12-10 14:35:27 -0500] information/WorkQueue: #4 (ApiListener, RelayQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min);
[2019-12-10 14:35:27 -0500] information/WorkQueue: #5 (ApiListener, SyncQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min);
[2019-12-10 14:35:35 -0500] information/ApiListener: New client connection for identity 'mastericinga.example.com' from [::ffff:172.18.22.25]:43614 (no Endpoint object found for identity)
[2019-12-10 14:35:48 -0500] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2019-12-10 14:36:08 -0500] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2019-12-10 14:37:08 -0500] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2019-12-10 14:37:38 -0500] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);