With “exec” method everything is working fine. When I changed method to “native” I’m getting percent_packet_loss=100 for every url entry.
telegraf.conf:
[agent]
interval = “10s”
debug = true
quiet = false
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “10s”
flush_jitter = “0s”
omit_hostname = false
[[inputs.internal]]
collect_memstats = true
tagexclude = [“version”,“go_version”]
[[inputs.ping]]
urls = [
“google.com”,
“192.168.0.2”
]
ping_interval = 10.0
method = “native”
count = 5
timeout = 3.0
telegraf.service config:
[Unit]
After=network.target
[Service]
CapabilityBoundingSet=CAP_NET_RAW
AmbientCapabilities=CAP_NET_RAW
EnvironmentFile=-/etc/default/telegraf
User=telegraf
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartForceExitStatus=SIGPIPE
KillMode=control-group
[Install]
WantedBy=multi-user.target
I’ve tried adding net.ipv4.ping_group_range;
[root@localhost ~]# sysctl net.ipv4.ping_group_range
net.ipv4.ping_group_range = 0 10000
adding SUID to /usr/bin/ping binary;
[root@localhost ~]# find / -perm -4000 -exec ls -ldb {} ; 2>/dev/null
-rwsr-sr-x. 1 root root 77216 Nov 8 2019 /usr/bin/ping
and running service as a root instead of telegraf user but nothing seems to work, I’m keep getting:
ping,host=192.168.0.2,telegraf-receiver=localhost.localdomain packets_received=0i,packets_transmitted=1i,percent_packet_loss=100,result_code=1i 1610375051000000000
ping,host=google.com,telegraf-receiver=localhost.localdomain packets_received=0i,packets_transmitted=1i,percent_packet_loss=100,result_code=1i 1610375051000000000
Tried with telegraf version 1.17, 1.15.2 and 1.16 with the same result.
Linux centos7 4.18.0-240.1.1.el8_3.x86_64 #1 SMP Thu Nov 19 17:20:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux