Linuxfabrik / monitoring-plugins

220+ check plugins for Icinga and other Nagios-compatible monitoring applications. Each plugin is a standalone command line tool (written in Python) that provides a specific type of check.
https://linuxfabrik.ch
The Unlicense
220 stars 51 forks source link

ping: timeout error #657

Closed gamebird92 closed 1 year ago

gamebird92 commented 1 year ago

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

Bug description

Hey everyone, I installed your awesome plugins for use in my icinga. I did import the templates into director and deploying my first host with one of your "tpl-host-generic" templates and leaving all data fields to template values.

Strangely ping is runnning into an error: when running ./ping '--count' '5' '--hostname' '192.168.73.249' '--intervall' '0.2' '--timeout' '5' it's telling me ping: invalid argument: '5.0'

Running `./ping '--count' '5' '--hostname' '192.168.73.249' '--intervall' '0.2' '--timeout' works.

Steps to reproduce - Plugin call

./ping '--count' '5' '--hostname' '192.168.73.249' '--intervall' '0.2' '--timeout' '5'

Steps to reproduce - Data

ping: invalid argument: '5.0'

Environment

Linux monitoring 5.15.0-67-generic

Plugin Version

ping v2022021501 by Linuxfabrik GmbH, Zurich /Switzerland

Python version

python 3.10.6

List of Python modules

No response

Additional Information

No response

markuslf commented 1 year ago

Maybe ./ping points to another ping command, not the one from our monitoring plugins. In any case, the --interval parameter is misspelled. What happens if you try /usr/lib64/nagios/plugins/ping --count 5 --hostname 192.168.73.249 --interval 0.2 --timeout 5 directly on the command line?

gamebird92 commented 1 year ago

When running /usr/lib64/nagios/plugins/ping --count 5 --hostname 192.168.73.249 --interval 0.2 --timeout 5 it's telling me:

root@monitoring:/lib64/nagios/plugins# ping --count 5 --hostname 192.168.73.249 --interval 0.2 --timeout 5
ping: invalid option -- '-'

So the "standard ping" is not pointing to your monitoring plugins I guess...

Running root@monitoring:/lib64/nagios/plugins# ./ping --count 5 --hostname 192.168.73.249 --interval 0.2 --timeout 5 gives me the ping: invalid argument: '5.0' - the same error message I reveice from icinga...

Sorry for the misspelled "intervall" - that was my mistake. Should have copied the text instead of typing it.

I tried the following:

root@monitoring:/lib64/nagios/plugins# ./ping --help
usage: ping [-h] [-V] [--always-ok] [--count COUNT] [-H HOSTNAME] [--interval INTERVAL] [-t DEADLINE]

Sends ICMP ECHO_REQUEST to network hosts using the built-in `ping` command.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  --count COUNT         Stop after sending count ECHO_REQUEST packets. Default: 5
  -H HOSTNAME, --hostname HOSTNAME
                        The ping destination. Default: 127.0.0.1
  --interval INTERVAL   Wait interval seconds between sending each packet. Default: 0.2
  -t DEADLINE, --timeout DEADLINE
                        Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received.
                        Default: 5
root@monitoring:/lib64/nagios/plugins# ./ping -H 192.168.73.249 --interval 5 -t 2
ping: invalid argument: '2.0'
root@monitoring:/lib64/nagios/plugins#

So I gues there is some issue with interpreting the value of timeout...

markuslf commented 1 year ago

Didn't get it in the first run, but you are using an outdated version. The error was fixed in https://github.com/Linuxfabrik/monitoring-plugins/issues/628. Please upgrade the checks to the latest release, including the libs.

gamebird92 commented 1 year ago

@markuslf oh i see the https://repo.linuxfabrik.ch/monitoring-plugins/ are not up to date. Thanks for your help!!!