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

Telegraf win_perf_counters not sending input counters with % #1430

Closed
ghost opened this issue Jun 30, 2016 · 1 comment · Fixed by #1523
Closed

Telegraf win_perf_counters not sending input counters with % #1430

ghost opened this issue Jun 30, 2016 · 1 comment · Fixed by #1523
Labels
bug unexpected problem or unintended behavior

Comments

@ghost
Copy link

ghost commented Jun 30, 2016

It appears that Telegraf is not allowing metrics with % to send over to a listening Prometheus server. Any metric without a % works without issue.

telegraf.conf:

##############################################################################
#                                  OUTPUTS                                    #
###############################################################################

# Configuration for prometheus server
[[outputs.prometheus_client]]

  # Address to listen on
    listen = ":9126"

###############################################################################
#                                  INPUTS                                     #
###############################################################################

  [[inputs.win_perf_counters]]
    PrintValid = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "Processor"
    Instances = ["*"]
    Counters = ["% C1 time", "% C2 time", "% C3 time", "% DPC time", "% Idle Time", "% Interrupt Time", "% Privileged Time", "% User Time", "% Processor Time"]
    Measurement = "win_cpu"
    #IncludeTotal=false
    #WarnOnMissing = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "LogicalDisk"
    Instances = ["*"]
    Counters = ["% Idle Time", "% Disk Time","% Disk Read Time", "% Disk Write Time", "Current Disk Queue Length"]
    Measurement = "win_disk"
    #IncludeTotal=false
    #WarnOnMissing = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "PhysicalDisk"
    Instances = ["*"]
    Counters = ["Disk Read Bytes/sec", "Disk Write Bytes/sec"]
    Measurement = "win_disk"
    #IncludeTotal=false
    #WarnOnMissing = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "System"
    Counters = ["Context Switches/sec","System Calls/sec"]
    Instances = ["------"]
    Measurement = "win_system"
    #IncludeTotal=false
    #WarnOnMissing = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "Memory"
    Counters = ["Available Bytes","Cache Faults/sec","Demand Zero Faults/sec","Page    Faults/sec","Pages/sec","Transition Faults/sec","Pool Nonpaged Bytes","Pool Paged Bytes"]
    Instances = ["------"] # Use 6 x - to remove the Instance bit from the query.
    Measurement = "win_mem"
    #IncludeTotal=false
    #WarnOnMissing = true

  [[inputs.win_perf_counters.object]]
    ObjectName = "Network Interface"
    Counters = ["Bytes Received/sec","Bytes Sent/sec","Packets Received/sec","Packets Sent/sec"]
    Instances = ["*"] # Use 6 x - to remove the Instance bit from the query.
    Measurement = "win_net"
    #IncludeTotal=false
    #WarnOnMissing = true

Log Info

PS C:\Windows\system32> c:\telegraf\telegraf.exe -config c:\telegraf\telegraf.conf
c:\telegraf\telegraf.exe : 2016/06/30 11:18:13 Attempting connection to output: prometheus_client
At line:1 char:1
+ c:\telegraf\telegraf.exe -config c:\telegraf\telegraf.conf
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (2016/06/30 11:1...ometheus_client:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

2016/06/30 11:18:13 Successfully connected to output: prometheus_client
2016/06/30 11:18:13 Starting Telegraf (version 1.0.0-beta2)
2016/06/30 11:18:13 Loaded outputs: prometheus_client
2016/06/30 11:18:13 Loaded inputs: win_perf_counters
2016/06/30 11:18:13 Tags enabled: host=NMX-WIN7-Test
2016/06/30 11:18:13 Agent Config: Interval:10s, Debug:true, Quiet:false, Hostname:"NMX-WIN7-Test", Flush 
Interval:10s 
Valid: \Processor(*)\% C1 time
Valid: \Processor(*)\% C2 time
Valid: \Processor(*)\% C3 time
Valid: \Processor(*)\% DPC time
Valid: \Processor(*)\% Idle Time
Valid: \Processor(*)\% Interrupt Time
Valid: \Processor(*)\% Privileged Time
Valid: \Processor(*)\% User Time
Valid: \Processor(*)\% Processor Time
Valid: \LogicalDisk(*)\% Idle Time
Valid: \LogicalDisk(*)\% Disk Time
Valid: \LogicalDisk(*)\% Disk Read Time
Valid: \LogicalDisk(*)\% Disk Write Time
Valid: \LogicalDisk(*)\Current Disk Queue Length
Valid: \PhysicalDisk(*)\Disk Read Bytes/sec
Valid: \PhysicalDisk(*)\Disk Write Bytes/sec
Valid: \System\Context Switches/sec
Valid: \System\System Calls/sec
Valid: \Memory\Available Bytes
Valid: \Memory\Cache Faults/sec
Valid: \Memory\Demand Zero Faults/sec
Valid: \Memory\Page Faults/sec
Valid: \Memory\Pages/sec
Valid: \Memory\Transition Faults/sec
Valid: \Memory\Pool Nonpaged Bytes
Valid: \Memory\Pool Paged Bytes
2016/06/30 11:18:21 Input [win_perf_counters] gathered metrics, (10s interval) in 1.5288027s
Valid: \Network Interface(*)\Bytes Received/sec
Valid: \Network Interface(*)\Bytes Sent/sec
Valid: \Network Interface(*)\Packets Received/sec
Valid: \Network Interface(*)\Packets Sent/sec
2016/06/30 11:18:30 Input [win_perf_counters] gathered metrics, (10s interval) in 0
2016/06/30 11:18:30 Output [prometheus_client] buffer fullness: 53 / 1000 metrics. Total gathered metrics: 
53. Total dropped metrics: 0.
2016/06/30 11:18:30 Output [prometheus_client] wrote batch of 53 metrics in 0
2016/06/30 11:18:40 Input [win_perf_counters] gathered metrics, (10s interval) in 15.6ms
2016/06/30 11:18:40 Output [prometheus_client] buffer fullness: 48 / 1000 metrics. Total gathered metrics: 
101. Total dropped metrics: 0.
2016/06/30 11:18:40 Output [prometheus_client] wrote batch of 48 metrics in 0
2016/06/30 11:18:50 Input [win_perf_counters] gathered metrics, (10s interval) in 0
2016/06/30 11:18:50 Output [prometheus_client] buffer fullness: 48 / 1000 metrics. Total gathered metrics: 
149. Total dropped metrics: 0.
2016/06/30 11:18:50 Output [prometheus_client] wrote batch of 48 metrics in 0

PS C:\Windows\system32>

System info:

Telegraf (version 1.0.0-beta2)
Windows 7 Professional Virtual Machine

Steps to reproduce:

  1. Execute Telegraf
  2. Wait for metrics to send

Expected behavior:

Metrics with % should be showing up in Prometheus server

Actual behavior:

Metrics with % do not show up in Prometheus server

@sparrc sparrc added the bug unexpected problem or unintended behavior label Jul 10, 2016
sparrc added a commit that referenced this issue Jul 20, 2016
1. in prometheus client, do not check for invalid characters anymore,
because we are already replacing all invalid characters with regex
anyways.
2. in win_perf_counters, sanitize field name _and_ measurement name.
Also add '%' to the list of sanitized characters, because this character
is invalid for most output plugins, and can also easily cause string
formatting issues throughout the stack.
3. All '%' will now be translated to 'Percent'

closes #1430
@sparrc
Copy link
Contributor

sparrc commented Jul 20, 2016

thanks for the report, PR is up for fix: #1523

sparrc added a commit that referenced this issue Jul 20, 2016
1. in prometheus client, do not check for invalid characters anymore,
because we are already replacing all invalid characters with regex
anyways.
2. in win_perf_counters, sanitize field name _and_ measurement name.
Also add '%' to the list of sanitized characters, because this character
is invalid for most output plugins, and can also easily cause string
formatting issues throughout the stack.
3. All '%' will now be translated to 'Percent'

closes #1430
sparrc added a commit that referenced this issue Jul 20, 2016
1. in prometheus client, do not check for invalid characters anymore,
because we are already replacing all invalid characters with regex
anyways.
2. in win_perf_counters, sanitize field name _and_ measurement name.
Also add '%' to the list of sanitized characters, because this character
is invalid for most output plugins, and can also easily cause string
formatting issues throughout the stack.
3. All '%' will now be translated to 'Percent'

closes #1430
sparrc added a commit that referenced this issue Jul 21, 2016
1. in prometheus client, do not check for invalid characters anymore,
because we are already replacing all invalid characters with regex
anyways.
2. in win_perf_counters, sanitize field name _and_ measurement name.
Also add '%' to the list of sanitized characters, because this character
is invalid for most output plugins, and can also easily cause string
formatting issues throughout the stack.
3. All '%' will now be translated to 'Percent'

closes #1430
bitmori pushed a commit to bitmori/telegraf that referenced this issue Jul 23, 2016
1. in prometheus client, do not check for invalid characters anymore,
because we are already replacing all invalid characters with regex
anyways.
2. in win_perf_counters, sanitize field name _and_ measurement name.
Also add '%' to the list of sanitized characters, because this character
is invalid for most output plugins, and can also easily cause string
formatting issues throughout the stack.
3. All '%' will now be translated to 'Percent'

closes influxdata#1430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant