Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abhishek jha/traceroute input plugin #16585

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/inputs/all/traceroute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build !custom || inputs || inputs.activemq

package all

import _ "github.com/influxdata/telegraf/plugins/inputs/traceroute" // register plugin
Empty file.
14 changes: 14 additions & 0 deletions plugins/inputs/traceroute/sample.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Gather metrics from traceroute to URLs.
[[inputs.traceroute]]
urls = ["example.org"]

## Use only IPv6 addresses when resolving a hostname.
# ipv6 = false

## number of queries to send per hop

## time to wait for a response

## the hop limit and port to use

## traceroute -w 3 -q 1 -m 16 google.com
44 changes: 44 additions & 0 deletions plugins/inputs/traceroute/traceroute.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//go:generate ../../../tools/readme_config_includer/generator
package traceroute

import (
_ "embed"
"fmt"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
"sync"
)

//go:embed sample.conf
var sampleConfig string

type Traceroute struct {
wg sync.WaitGroup

Log telegraf.Logger `toml:"-"`

// URLs to traceroute
Urls []string
}

func (*Traceroute) SampleConfig() string {
return sampleConfig
}

func (t *Traceroute) Init() error {
for index, element := range t.Urls {
fmt.Println("At index", index, "value is", element)
}
return nil
}

func (t *Traceroute) Gather(acc telegraf.Accumulator) error {
println("Hola!")
return nil
}

func init() {
inputs.Add("traceroute", func() telegraf.Input {
return &Traceroute{}
})
}
1 change: 1 addition & 0 deletions plugins/inputs/traceroute/traceroute_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package traceroute
Loading