Makes a lot of sense, however it still tries to go to 127.0.0.1 and port 22. How i do the manual check the alert is fixed for a couple of minutes and then comes back.
In theory this should be enough:
apply Service "ssh" {
import "generic-service"
check_command = "ssh"
assign where host.address
}
And in a host definition:
object Endpoint "host.foo.bar" {
host = "10.10.10.xx"
}
object Host "host.foo.bar" {
import "generic-host"
address = "10.10.10.xx"
vars.os = "FreeBSD"
vars.ssh_port = 4545
}
object Zone "host.foo.bar" {
endpoints = [ "host.foo.bar", ]
parent = "master"
}

You can check the executed command by using
inspect
in icingaweb.
I don’t find the inspect
option under the service details. I go to problems → service problems. Click on ssh problem on a host and then I have the details. There is where it supposes to be? I thought it should be under Problem handling. Is this the place? Do I have a miss-configuration?

BTW: Every zone and endpoint object needs to be defined since V2.11 in zones.conf only.
I suffer that several months ago. However, I did find something that might be an issue. Not sure with this issue, but might be a general problem. I share here just in case.
The file host.conf is under zones.d, and it seems not to be process. I copy it to conf.d, as I see in the documentation that it should be there. However it breaks things, this is the content of the file, which I believe is the standard configuration. This is the hosts.conf file:
/*
* Host definitions with object attributes
* used for apply rules for Service, Notification,
* Dependency and ScheduledDowntime objects.
*
* Tip: Use `icinga2 object list --type Host` to
* list all host objects after running
* configuration validation (`icinga2 daemon -C`).
*/
/*
* This is an example host based on your
* local host's FQDN. Specify the NodeName
* constant in `constants.conf` or use your
* own description, e.g. "db-host-1".
*/
object Host NodeName {
/* Import the default host template defined in `templates.conf`. */
import "generic-host"
/* Specify the address attributes for checks e.g. `ssh` or `http`. */
address = "127.0.0.1"
address6 = "::1"
/* Set custom variable `os` for hostgroup assignment in `groups.conf`. */
vars.os = "FreeBSD"
/* Define http vhost attributes for service apply rules in `services.conf`. */
vars.http_vhosts["http"] = {
http_uri = "/"
}
/* Uncomment if you've sucessfully installed Icinga Web 2. */
//vars.http_vhosts["Icinga Web 2"] = {
// http_uri = "/icingaweb2"
//}
/* Define disks and attributes for service apply rules in `services.conf`. */
vars.disks["disk"] = {
/* No parameters. */
}
vars.disks["disk /"] = {
disk_partitions = "/"
}
/* Define notification mail attributes for notification apply rules in `notifications.conf`. */
vars.notification["mail"] = {
/* The UserGroup `icingaadmins` is defined in `users.conf`. */
groups = [ "icingaadmins" ]
}
}
I get configuration errors related to the master server:
[2020-08-21 16:10:58 +0000] critical/config: Error: Validation failed for object 'master.foo.bar!ssh' of type 'Service'; Attribute 'command_endpoint': Checkable with command endpoint requires a zone. Please check the troubleshooting documentation.
Location: in /usr/local/etc/icinga2/conf.d/services/ssh.conf: 1:0-1:18
/usr/local/etc/icinga2/conf.d/services/ssh.conf(1): apply Service "ssh" {
^^^^^^^^^^^^^^^^^^^
/usr/local/etc/icinga2/conf.d/services/ssh.conf(2): import "generic-service"
/usr/local/etc/icinga2/conf.d/services/ssh.conf(3):
Thanks a lot.