0

I have icinga v2.11.3-1 installed on 4 servers, one as master and the rest are agent nodes and they are some-what properly configured because they are visible in icingaweb2 under hosts.

what I want to do is to be able to run a check command on a remote agent.

lets say I want to monitor disks on a server called my-server.

so in the master node I added the following configuration:

first defined the host and zone:

object Host "my-server" {
  import "generic-host"
        address = "my-server-host"
        vars.os = "Linux"
  vars.disks["disk /mnt/data"] = {
    disk_partitions =  "/mnt/data"
  }
  vars.agent_endpoint = name

}

object Endpoint "my-server" {
 host = "my-server"
}

object Zone "my-server" {
 endpoints = ["my-server"]
parent = "master"
}

notice that I added vars.agent_endpoint.

that applied the following on disk service:

apply Service "disk" {
  check_command = "disk"

  // Check is executed on the remote command endpoint
  command_endpoint = host.vars.agent_endpoint
  zone = host.vars.agent_endpoint
  assign where host.vars.agent_endpoint
}

and this is the the definition that checks for host.vars.disks that was already presented in the services.conf configuration file:

apply Service for (disk => config in host.vars.disks) {
  import "generic-service" 
  check_command = "disk"
  vars += config
}

yet it still checks for available space in the parent node and shows that result.

I probably missed something in the configuration and I don't know what

any ideas regarding this issue would be greatly appreciated.

thanks!

0

so.. I couldn't find a way to resolve it manually.. but I found something even better! I usually prefer configuring things manually but I found a plugin for icingaweb2 called director that made all the configuration for everything much much easier.

so the project is at https://github.com/Icinga/icingaweb2-module-director

so I removed icinga2 configuration and packages from all of my server and started clean, just installed icinga2 on all servers, ran icinga2 node wizard on all of them and configure icingaweb2 on the master node. here I still didn't see any of my servers because there wasn't any endpoints attached to them.

then I installed director, logged in to the director web interface, configured a host template with check command hostalive and Icinaga2 Agent, Establish connection and Accepts config set to yes.

then I created the hosts using this template.

then I created a service template for each monitoring item that I want to test and set `Run on agent to 'yes'.

then I created a service from that template service and attached it to the host template that I created so each service will be monitored on all of my agent based servers.

then I deployed the configuration and voila! works perfectly. detected the hosts, and executes the services monitoring tasks on those servers.

I was really impressed by this project, it was very easy to understand and to configure whatever I want.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.