Skip to content
Snippets Groups Projects
Commit cd66e203 authored by Thibault Cohen's avatar Thibault Cohen Committed by Cameron Sparr
Browse files

Improve procstat

closes #799
parent 240f9947
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- [#788](https://github.com/influxdata/telegraf/pull/788): -input-list and -output-list command-line options. Thanks @ebookbug! - [#788](https://github.com/influxdata/telegraf/pull/788): -input-list and -output-list command-line options. Thanks @ebookbug!
- [#778](https://github.com/influxdata/telegraf/pull/778): Adding a TCP input listener. - [#778](https://github.com/influxdata/telegraf/pull/778): Adding a TCP input listener.
- [#797](https://github.com/influxdata/telegraf/issues/797): Provide option for persistent MQTT consumer client sessions. - [#797](https://github.com/influxdata/telegraf/issues/797): Provide option for persistent MQTT consumer client sessions.
- [#799](https://github.com/influxdata/telegraf/pull/799): Add number of threads for procstat input plugin. Thanks @titilambert!
### Bugfixes ### Bugfixes
- [#748](https://github.com/influxdata/telegraf/issues/748): Fix sensor plugin split on ":" - [#748](https://github.com/influxdata/telegraf/issues/748): Fix sensor plugin split on ":"
......
...@@ -35,6 +35,10 @@ The above configuration would result in output like: ...@@ -35,6 +35,10 @@ The above configuration would result in output like:
# Measurements # Measurements
Note: prefix can be set by the user, per process. Note: prefix can be set by the user, per process.
Threads related measurement names:
- procstat_[prefix_]num_threads value=5
File descriptor related measurement names: File descriptor related measurement names:
- procstat_[prefix_]num_fds value=4 - procstat_[prefix_]num_fds value=4
......
...@@ -52,6 +52,7 @@ func NewSpecProcessor( ...@@ -52,6 +52,7 @@ func NewSpecProcessor(
} }
func (p *SpecProcessor) pushMetrics() { func (p *SpecProcessor) pushMetrics() {
p.pushNThreadsStats()
p.pushFDStats() p.pushFDStats()
p.pushCtxStats() p.pushCtxStats()
p.pushIOStats() p.pushIOStats()
...@@ -60,6 +61,15 @@ func (p *SpecProcessor) pushMetrics() { ...@@ -60,6 +61,15 @@ func (p *SpecProcessor) pushMetrics() {
p.flush() p.flush()
} }
func (p *SpecProcessor) pushNThreadsStats() error {
numThreads, err := p.proc.NumThreads()
if err != nil {
return fmt.Errorf("NumThreads error: %s\n", err)
}
p.add("num_threads", numThreads)
return nil
}
func (p *SpecProcessor) pushFDStats() error { func (p *SpecProcessor) pushFDStats() error {
fds, err := p.proc.NumFDs() fds, err := p.proc.NumFDs()
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment