Skip to content

Ping Plugin - FreeBSD - Host is not appended in combination with the arguments option #5437

@h2odriving

Description

@h2odriving

Relevant telegraf.conf:

[[inputs.ping]]
   urls = ["9.9.9.9", "8.8.8.8"] # required
   arguments = ["-c", "1", "-n", "-W", "20"]

System info:

  • FreeBSD 12.0-RELEASE-p2 FreeBSD 12.0-RELEASE-p2 GENERIC amd64
  • Telegraf 1.9.0

Steps to reproduce:

In the 1.9.0 version of Telegraf was a bug with the ping plugin in Freebsd (#5112) and I can not upgrade at the moment. So I tried to use the arguments option, since this should ignore all default values. It ignores all default values but also ignore the URL list. The Hosts from the URLs options is not past to the ping command as you can see below.

  • create config file with configuration from above
  • check telegraf:
    telegraf --test --config telegraf.conf --input-filter ping
  • check how the ping command look like:
    ps a |grep "/sbin/ping"

Expected behavior:

$telegraf --test --config /usr/local/etc/telegraf.conf --input-filter ping
2019-02-14T22:38:57Z I! Starting Telegraf 1.9.0
> ping,host=hostname,url=9.9.9.9 average_response_ms=12.199,maximum_response_ms=12.199,minimum_response_ms=12.199,packets_received=1i,packets_transmitted=1i,percent_packet_loss=0,result_code=0i,standard_deviation_ms=0 1550183938000000000
> ping,host=hostname,url=8.8.8.8 average_response_ms=12.199,maximum_response_ms=12.199,minimum_response_ms=12.199,packets_received=1i,packets_transmitted=1i,percent_packet_loss=0,result_code=0i,standard_deviation_ms=0 1550183938000000000
$ps a |grep "/sbin/ping"
 5507  1  R+  0:00.00 /sbin/ping -c 1 -n -W 20 9.9.9.9
10147  1  R+  0:00.00 /sbin/ping -c 1 -n -W 20 8.8.8.8

Actual behavior:

$telegraf --test --config /usr/local/etc/telegraf.conf --input-filter ping
2019-02-14T23:13:40Z I! Starting Telegraf 1.9.0
2019-02-14T23:13:40Z E! [inputs.ping]: Error in plugin: host 8.8.8.8: usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]
            [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]
            [-P policy] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]
            [-W waittime] [-z tos] host
       ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
            [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
            [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
            [-z tos] mcast-group, exit status 64
> ping,host=hostname,url=8.8.8.8 result_code=2i 1550186021000000000
2019-02-14T23:13:40Z E! [inputs.ping]: Error in plugin: host 9.9.9.9: usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]
            [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]
            [-P policy] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]
            [-W waittime] [-z tos] host
       ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
            [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
            [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
            [-z tos] mcast-group, exit status 64
> ping,host=hostname,url=9.9.9.9 result_code=2i 1550186021000000000
$ps aux |grep "/sbin/ping"
20404  1  R+  0:00.00 /sbin/ping -c 1 -n -W 20
27081  1  R+  0:00.00 /sbin/ping -c 1 -n -W 20

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions