# Check\_ping and integer argument

**URL:** <https://community.icinga.com/t/check-ping-and-integer-argument/3705>\
**Category:** Icinga 2\
**Created:** [March 5, 2020, 7:04pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705 "2020-03-05T19:04:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![GenBuri](https://community.icinga.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GenBuri](https://community.icinga.com/u/GenBuri)\
**Post date:** [March 5, 2020, 7:04pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/1 "2020-03-05T19:04:39Z")

</div>

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](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…

---

<div class="post-metadata">

**Author:** ![blakehartshorn](https://community.icinga.com/user_avatar/community.icinga.com/blakehartshorn/32/599_2.png) [@blakehartshorn](https://community.icinga.com/u/blakehartshorn)\
**Post date:** [March 5, 2020, 8:07pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/2 "2020-03-05T20:07:53Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![GenBuri](https://community.icinga.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GenBuri](https://community.icinga.com/u/GenBuri)\
**Post date:** [March 5, 2020, 8:26pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/3 "2020-03-05T20:26:15Z")

</div>

@blakehartshorn

sorry maybe this is dumb but it’s what I’m using?  
[https://www.monitoring-plugins.org/doc/man/check\_ping.html](https://www.monitoring-plugins.org/doc/man/check_ping.html)

---

<div class="post-metadata">

**Author:** ![blakehartshorn](https://community.icinga.com/user_avatar/community.icinga.com/blakehartshorn/32/599_2.png) [@blakehartshorn](https://community.icinga.com/u/blakehartshorn)\
**Post date:** [March 5, 2020, 8:56pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/4 "2020-03-05T20:56:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GenBuri](https://community.icinga.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GenBuri](https://community.icinga.com/u/GenBuri)\
**Post date:** [March 5, 2020, 9:12pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/5 "2020-03-05T21:12:20Z")

</div>

@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”  
> }

---

<div class="post-metadata">

**Author:** ![blakehartshorn](https://community.icinga.com/user_avatar/community.icinga.com/blakehartshorn/32/599_2.png) [@blakehartshorn](https://community.icinga.com/u/blakehartshorn)\
**Post date:** [March 5, 2020, 9:13pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/6 "2020-03-05T21:13:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GenBuri](https://community.icinga.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GenBuri](https://community.icinga.com/u/GenBuri)\
**Post date:** [March 5, 2020, 9:14pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/7 "2020-03-05T21:14:12Z")

</div>

@blakehartshorn

But what about the warning and critical arguments?

---

<div class="post-metadata">

**Author:** ![blakehartshorn](https://community.icinga.com/user_avatar/community.icinga.com/blakehartshorn/32/599_2.png) [@blakehartshorn](https://community.icinga.com/u/blakehartshorn)\
**Post date:** [March 5, 2020, 9:15pm UTC](https://community.icinga.com/t/check-ping-and-integer-argument/3705/8 "2020-03-05T21:15:58Z")

</div>

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.
