-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add protocol stats to the network plugin #382
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package system | |
import ( | ||
"fmt" | ||
"net" | ||
"strings" | ||
|
||
"github.com/influxdb/telegraf/plugins" | ||
) | ||
|
@@ -79,6 +80,15 @@ func (s *NetIOStats) Gather(acc plugins.Accumulator) error { | |
acc.Add("drop_out", io.Dropout, tags) | ||
} | ||
|
||
// Get system wide stats for different network protocols | ||
netprotos, err := s.ps.NetProto() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're ignoring the error just set the var name to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch surprised it even compiled.... |
||
for _, proto := range netprotos { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will just do nothing on unsupported systems, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct |
||
for stat, value := range proto.Stats { | ||
name := fmt.Sprintf("%s_%s", proto.Protocol, strings.ToLower(stat)) | ||
acc.Add(name, value, nil) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go higher up, under 0.2.3