Is there a Plugin in Telegraf to monitor Number of Hops. like traceroute output

Hello All,
Is there a plugin I can use to monitor number of Hops. Like the Tracerout Output.
I know ping plugin collects average response time but I am interested in collecting number of Hops from My machine to lets say ex:

Thanks in Advance.

You could try this traceroute script for use with the exec plugin.

Thank you @daniel
I have tried implementing this. I got the following traceroute output when I restart telegraf.
I am trying to implement to count the number of hops taken from my machine to
But I am not able to query the max number of hops i.e the total number of hops in InfluxDB.
I am using the following query
SELECT max(“hop_num”) FROM “traceroute” WHERE (“host” = ‘ip-xx.xx.xx.xx’) AND $timeFilter GROUP BY time($__interval) fill(null)
I also used last filter and replaced with max

  • Plugin: inputs.exec, Collection 1

traceroute,hop_num=6,host=xx.xx.xx.xx,project=infrastructure,os=linux,customer=mmltest,target_loc=gdns,,hop_host=,factory=project,platform=aws resp_time=0.443 1524596067000000000
traceroute,hop_num=7,project=infrastructure,os=linux,customer=mmltest,platform=aws,host=xx.xx.xx.xx,target_loc=gdns,,hop_host=,factory=project resp_time=38.745 1524596067000000000
traceroute,target_loc=gdns,hop_host=,platform=aws,host=xx.xx.xx.xx,project=infrastructure,,hop_num=8,customer=mmltest,factory=project,os=linux resp_time=0.972 1524596067000000000
traceroute,target_loc=gdns,os=linux,customer=mmltest,factory=project,platform=aws,host=xx.xx.xx.xx,,hop_num=9,hop_host=,project=infrastructure resp_time=38.744 1524596067000000000
traceroute,os=linux,customer=mmltest,hop_host=,project=infrastructure,hop_num=10,factory=project,platform=aws,host=xx.xx.xx.xx,target_loc=gdns, resp_time=38.722 1524596067000000000
traceroute,platform=aws,hop_num=11,hop_host=,project=infrastructure,os=linux,customer=mmltest,factory=project,host=xx.xx.xx.xx,target_loc=gdns, resp_time=0.839 1524596067000000000
traceroute,hop_num=12,hop_host=,factory=project,host=xx.xx.xx.xx,project=infrastructure,,os=linux,customer=mmltest,platform=aws,target_loc=gdns resp_time=0.836 1524596067000000000
traceroute,customer=mmltest,target_loc=gdns,hop_host=,project=infrastructure,os=linux,factory=project,,hop_num=13,platform=aws,host=xx.xx.xx.xx resp_time=0.839 1524596067000000000
traceroute,os=linux,platform=aws,hop_host=,customer=mmltest,factory=project,host=xx.xx.xx.xx,project=infrastructure,target_loc=gdns,,hop_num=14 resp_time=0.829 1524596067000000000

This is because hop_num is a tag, if you make it a field you will able to use it with max.

Hello @daniel thanks for the reply, Love Influx Community always there to help me out.
I followed the Influx Line protocol and implemented so now hop_num is a field tag now.

But I dont see any data related to hops in influxDB.
I dont see any errors in the telegraf.log file either as the inputs.exec is loaded to influxDB.

And when I see in the database there is a series of below data, Its weird that I have this data but not real time data.

show series from “traceroute”


I am not sure if this has something to do .
I see series of error messages in telegraf.log file

2018-04-25T15:35:17Z D! Attempting connection to output: influxdb
2018-04-25T15:35:18Z D! Successfully connected to output: influxdb
2018-04-25T15:35:18Z I! Starting Telegraf v1.4.5
2018-04-25T15:35:18Z I! Loaded outputs: influxdb
2018-04-25T15:35:18Z I! Loaded inputs: inputs.disk inputs.kernel inputs.mem inputs.processes inputs.swap inputs.http_response inputs.cpu inputs.diskio inputs.system inputs.exec
2018-04-25T15:35:18Z I! Tags enabled: customer=mmltest factory=project host=ip-10-134-14-30 os=linux platform=aws project=infrastructure
2018-04-25T15:35:18Z I! Agent Config: Interval:10s, Quiet:false, Hostname:“ip-10-134-14-30”, Flush Interval:10s
2018-04-25T15:35:30Z D! Output [influxdb] buffer fullness: 26 / 10000 metrics.
2018-04-25T15:35:30Z D! Output [influxdb] wrote batch of 26 metrics in 77.853702ms
2018-04-25T15:35:40Z D! Output [influxdb] buffer fullness: 13 / 10000 metrics.
2018-04-25T15:35:40Z D! Output [influxdb] wrote batch of 13 metrics in 83.158821ms
2018-04-25T15:35:50Z D! Output [influxdb] buffer fullness: 19 / 10000 metrics.
2018-04-25T15:35:50Z D! Output [influxdb] wrote batch of 19 metrics in 82.01519ms
2018-04-25T15:36:00Z D! Output [influxdb] buffer fullness: 13 / 10000 metrics.
2018-04-25T15:36:00Z D! Output [influxdb] wrote batch of 13 metrics in 80.20092ms
2018-04-25T15:36:10Z D! Output [influxdb] buffer fullness: 11 / 10000 metrics.
2018-04-25T15:36:10Z D! Output [influxdb] wrote batch of 11 metrics in 248.693411ms
2018-04-25T15:36:20Z D! Output [influxdb] buffer fullness: 21 / 10000 metrics.
2018-04-25T15:36:20Z D! Output [influxdb] wrote batch of 21 metrics in 165.966934ms

It looks like it is working, all batches are written each interval. Try to work your way backwards: use the influx shell to check for data select * from procstat order by time desc limit 1;, if that doesn’t help enable a file output with namepass = "traceroute". Depending on what you see you can can add debugging code to the exec script, just have it write to a file: echo foo >> /tmp/telegraf.exec.