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

UTF16PtrToString invalid for multi-instance win_perf_counters #1703

Closed
recursiveDream opened this issue Sep 2, 2016 · 4 comments
Closed
Labels
area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) help wanted Request for community participation, code, contribution

Comments

@recursiveDream
Copy link

recursiveDream commented Sep 2, 2016

telegraf

OS: Windows 2008 R2
Ver: 1.0.0

Problem

Observe any windows performance counter with multiple instances and note the # suffix. None of these metrics are reported.

win_per_counters.go/Gather()
---------------------------------
Problem Code: var s string = win.UTF16PtrToString(c.SzName)
    * When processing a metric.instance with a suffix of  #, only the first two characters are returned from UTF16PtrToString

Hack Fix:
--->                    var multi_instance bool;

--->                    } else if strings.Contains(metric.instance, "#") {
--->                        add = true
--->                        multi_instance = true
--->                    }

--->                            if multi_instance {
--->                                tags["instance"] = metric.instance
--->                            } else {
--->                                tags["instance"] = s
--->                            }
@sparrc
Copy link
Contributor

sparrc commented Sep 2, 2016

I don't really understand what this "problem code" writeup is....can you submit a PR if you know how to fix it?

@recursiveDream
Copy link
Author

recursiveDream commented Sep 2, 2016

I refrained from a PR due to this being a temporary fix (to convey the issue) and not the proper code-fix. The problem code extends into golang/win and golang/syscall, and I haven't determined the root cause.

@danielnelson danielnelson added area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) help wanted Request for community participation, code, contribution and removed help wanted Request for community participation, code, contribution labels May 11, 2017
@bullshit
Copy link
Contributor

This isn't a issue of UTF16PtrToString. Please see #2352

@danielnelson
Copy link
Contributor

I'm going to close this issue since it is quite old and this plugin has had quite a few changes since it was reported. @recursiveDream Can you test with the latest Telegraf build and if you are having problems report a new issue or comment on #2879.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) help wanted Request for community participation, code, contribution
Projects
None yet
Development

No branches or pull requests

4 participants