Check_by_ssh : check_mem.pl give master memory result

Hi
I use check_by_ssh to monitoring my remote agent hosts. when I try to read my remote agent hosts memory using check_mem.pl it returning value of my local master host memory.

this is my command object for check memory

object CheckCommand "memory" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_mem.pl" ]

    arguments = {
		"-w" = {
			value = "$mem_warning$" 
		}
		"-c" = {
			value ="$mem_critical$"
		}
		"-u" = {
			set_if = "$mem_used$"
		}
		"-C" = {
			set_if = "$mem_cache$"
		}  
   }
}

and this my service object

apply Service "memory_check" {
    import "generic-service"
    display_name = "Memory Checks"
    check_command = "memory"

    vars.mem_used = true
    vars.mem_cache = true
    vars.mem_warning = 85
    vars.mem_critical = 95

    assign where host.vars.memory_status == true
}

this is the result on icingaweb

master system info
OS : ubuntu server 12.04

remote agent info
OS : centOS 7

is there something that i miss?

  • a valid endpoint for the host you want to run the memory check from
  • a command_endpoint in the service

ignore that, I overread the check_by_ssh thing, sorry

  1. Please show us how you are telling this service check to use check_by_ssh:
    that is not shown in the detail you provided so far.

  2. What is the difference between this check (which returns results from the
    master) and another check (you say you are using check_by_ssh for other things
    as well) which returns results from the remote machine.

Antony.

this is my remotehost memory status check with command free

this is my master memory status

this is template of my ssh-agent

template Host "ssh-agent" {
  import "generic-host"

  check_command = "hostalive"

  vars.agent_type = "ssh"
  vars.os_type = "linux"

  vars.ssh_user = "icinga"
  vars.ssh_key = "/home/user/.ssh/id_rsa"

  vars.http_status = true
  vars.mysql_status = true

  vars.notification["telegram"] = {
    users = [ "telebot" ]
  }

}
object Host "qzz001" {
  import "ssh-agent"

  address = "***.***.***.***"
  vars.os = "Linux"

  vars.ssh_address = "***.***.***.***"
  vars.ssh_port = "******"

  vars.memory_status = true

}

I don’t really know how to give you info about I use check_by_ssh, sorry

Hey!

You didn’t post the templates you’re using for these objects (‘generic-service’ & ‘generic-host’), but assuming they’re nothing special and probably close to the defaults, you’re not telling ICINGA anywhere to use check_by_ssh.

The configuration you posted suggests, that you’re just telling the satellite (or master), to which the host ‘qzz001’ is bound to, to run the check_command ‘memory’, which is just check_mem.pl in the end.

Instead you have to tell the satellite (or master) to run check_by_ssh with the target machine being the host ‘qzz001’ (or any other host you want to run the check against).

Hopefully this documentation example on check_by_ssh will show you how to do it.

You’ll see, that the check_command used in that example is different from yours.

Also, consider just using ICINGA agent on the target node, if it’s possible. Check_by_ssh is only meant to be used, if installing/running ICINGA agent is not possible.