Check_uptime satellite/agent

Hi,

Trying to use the check_uptime on a remote agent… using:

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

check_command = “uptime”
command_endpoint = host.name

assign where host.vars.os == “Linux” && host.vars.agent == true && host.zone == “rPIpoller.pointpubmedia.com
}

The same “check_command” works properly on the master itself but on satellite, that are having agent that will match this I got

Attribute ‘check_command’: Object ‘uptime’ of type ‘CheckCommand’ does not exist.

If this is the shipped checkcommand from the ITL, make sure the ITL is imported by the client, the setting is in icinga2.conf
If it is a custom defined checkcommand, it must be defined in a global zone (e.g. global-templates) and your satellite and the agent needs to know about the global zone to import it. (entries in zones.conf)

Sometimes, when a new checkcommand is defined and used by a service in the same deployment, it happens, that the agent doesn’t know the checkcommand. In this case, an agent restart or a redeployment usually helps.

yeah… ITL is included in all icinga2.conf, master, satellite, agent…

thats… interesting.
what does icinga2 object list --type checkcommand --name uptime say about it?

Nothing on the satellite :wink:

ok, then I am out of ideas for the moment, as I don’t have an existing master-satellite setup here right now.
Did you check the file /usr/share/icinga2/include/command-plugins.conf ? The command is usually defined there.
In icinga2.conf, this file must be imported with include <plugins>

strange thing…
on the master, default file /usr/share/icinga2/include/command-plugins.conf it’s defined there…
on the satellite, using raspberry “version” in the default file /usr/share/icinga2/include/command-plugins.conf there’s no uptime defined…

Well, there’s the error.
Maybe that’s a mistake in the packaging, didn’t use icinga2 on a rasPi since the debmon project died. Maybe there is no checkplugin for the command, so it is omitted in the plugins.conf.

but the command itself exist on the rPI :wink:

Anyway, for the moment I create a custom command!

1 Like

if the checkplugin works as expected, that’s probably the best idea.

1 Like

The uptime command was added to the ITL with 2.11, so if your satellite runs an older release, it won’t know about this.

1 Like

Hello Michale Friedrich, I just found this topic and was wondering if this check can be used on every host object? because i am trying to check the uptime on different host objects but all of them showing the uptime of my icinga2 host? I hope someone can help me I am a little bit confused. I try to check the uptime of all my Host I am monitoring

kidn regards
Pia

Sounds like you have not set “command_endpoint” to the name of the machine you
want the check to run on.

This is not specific to the uptime check, but applies to any service check.

Antony.

do i have to set command_endpoint to the my Hosts? Because all other checks work. I it specific for the uptime check?

it is not an icinga machine. I want to check for example a vm for openshift. I mean I cant install the plugin on every maschine I’m monitoring that never have been necessary so far. Do i get something wrong right now?

You say “that has never been necessary so far”, so please explain how you have
set things up previously.

Antony.

Please show us an example of another check definition which works without
command_endpoint being set.

Antony.

ok for example here is a check for a network
Service:

apply Service "vsa_network" {
  import "generic-service"
  check_command = "check_vsa_network"
  max_check_attempts= "2"
  check_interval = 7m
  retry_interval = 7m
  assign where host.vars.os == "VSA"
}

and the command is here:

object CheckCommand "check_vsa_network" {
        import "plugin-check-command"
  command = [
    PluginDir + "/snmp_test_icinga.py",
    "$address$"
  ]
}

So, that check is being done via SNMP. That’s why the Icinga server is able
to get a check result without the check command running on the machine being
checked.

Antony.

okay i understand, but i dont understand how to put the command_endpoint

could you help me for example this is my host object:

object Host "opsh-master" {
  import "generic-host"
  address = "xx.xxx.xxx.xxx"
  vars.os = "openshift"
  vars.check = "opsh"
  vars.type = "master"
} 

and this is the service:

apply Service "uptime" {
  import "generic-service"

  check_command = "uptime_custom"
  vars.uptime_unit = "days"
  assign where host.vars.type == "master"
}

and this is the command

object CheckCommand "uptime_custom" {
    import "uptime"
        arguments += {
        "-u" = "$uptime_unit$"
        "-w" = "3600",
        "-c" = "300"
        }
}

i tried to add the command_endpoint but it just shows errors so i dont really understand adding this line could you give me an example?