Check_ping and integer argument

Hi everyone!

I’m trying to make this check_ping service work. I’ve put the exact same thing as the example in the doc and it’s still giving me an error.

The error is : (3000.0,80%) must be an integer percentage

I used this example : https://icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#runtime-macros

object CheckCommand “check-alive” {
command = [PluginDir + “/check_ping”]
arguments = {
“-H” = “$HOSTNAME$”
“-w” = “$ping_wrta$,$ping_wpl$%”
“-c” = “$ping_crta$,$ping_cpl$%”
“-p” = “5”
}
vars.ping_cpl = 100
vars.ping_crta = 5000
vars.ping_wpl = 80
vars.ping_wrta = 3000

}

Confused…

Hi Gen,

Is there a reason you’re not using the stock template that already exists? there’s “hostalive” command for host objects and “ping4”, “ping6” for service objects. They take similar variables:

https://icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#ping4

/usr/share/icinga2/include is typically where these command objects reside and give a lot of insight on how to write command objects for custom checks that do not ship with the standard monitoring plugins set.

@blakehartshorn

sorry maybe this is dumb but it’s what I’m using?
https://www.monitoring-plugins.org/doc/man/check_ping.html

Right, that’s the man page for the actual binary, but the link I provided has the CheckCommand object already defined for it. The templates library is great; all the stock plugins are documented for applying to services.

@blakehartshorn

So what you are saying is that I should omit this portion?

arguments = {
“-H” = “$HOSTNAME$”
“-w” = “$ping_wrta$,$ping_wpl$%”
“-c” = “$ping_crta$,$ping_cpl$%”
“-p” = “5”
}

You don’t have to define that command object at all. You can use the existing ping4 or hostalive command objects that already exist in your service.

1 Like

@blakehartshorn

But what about the warning and critical arguments?

Those are defined on the service or host object and the check command in /usr/share includes defaults. The variables are explained in the template doc.

1 Like