Check more than one proc

Hi all,
I am a Newbie abbout Icinga2, but know previius Version. :slight_smile:
I try to check serveral processes with the “check_command = procs”
I create a file named service_default.conf with automaticly checks the procs on all hosts.
But when I have a look at the GUI I saw the Icinga checks only one procs but the Name of the Checks are OK. So for example:
There is a Check of nxlog but icinga said: Porcess OK: one process with command 'supervisor
Any idea how I can check serveral different procs?
Here is my conf file:

#apply Service "procs-nxlog" {
apply Service "nxlog" {
  import "generic-service"

  check_command = "procs"
  host.vars.procs_command = "nxlog"

  assign where host.address
}

#apply Service "procs-supervisor" {
apply Service "supervisor" {
  import "generic-service"

  check_command = "procs"
  host.vars.procs_command = "supervisor"

  assign where host.address
}

Hi,

your service apply rules are overriding the host.vars context. This only works one time, and the last apply rule executed sets the value, leading to wrong results.

The instead wanted behavior is to just assign these custom attributes directly to the service. Use this syntax to specify them for the service being created:

  vars.procs_command = "supervisor"

… without the host. prefix.

Cheers,
Michael

Cool works fine now :+1:
Thx a lot :grinning:

Hi Michael,
now I have a additional pb.
I would like to monitor to differnt java procs.
One is running under user “A” the user is running under user “B”.
My conf file looks like these:

apply Service “FrontApp” {
import “generic-service”

check_command = “procs”
vars.procs_user = “testuser1”
vars.procs_command = “java”
vars.procs_argument = “some args 1”

assign where (host.vars.host_group == “java” )
}

apply Service “Tomcat” {
import “generic-service”

check_command = “procs”
vars.procs_user = “testuser2”
vars.procs_command = “java”
vars.procs_argument = “some args 2”

assign where (host.vars.host_group == “java”)
}

But icinga get an that the user name are not found :frowning:
error: check_procs: User name was not found - testuser1

If I remove vars.procs_user icinga found no process.

Any idea?

Extract the executed command line and figure it out manually (check the troubleshooting docs for instructions). Deeper usage of check_procs is beyond my knowledge, maybe others see it immediately.

Cheers,
Michael