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

Windows: multiple config files not working properly #1137

Closed
GuillaumeLohez opened this issue May 2, 2016 · 14 comments · Fixed by #1822 or #2800
Closed

Windows: multiple config files not working properly #1137

GuillaumeLohez opened this issue May 2, 2016 · 14 comments · Fixed by #1822 or #2800
Labels
area/windows Related to windows plugins (win_eventlog, win_perf_counters, win_services) bug unexpected problem or unintended behavior help wanted Request for community participation, code, contribution platform/windows

Comments

@GuillaumeLohez
Copy link

GuillaumeLohez commented May 2, 2016

Hi,

I've stared using "win_perf_counters" on Windows servers.
I have a little issue: I can not have multiple [[inputs.win_perf_counters]] in multiple files to arrange configs. For example, one for CPU, one for memory, etc...
It seems, only the first [[inputs.win_perf_counters]] found in my telegraf.d directory is used.

WIth snmp input, I can have multiple [[inputs.snmp]], one per file per switch.

Is it an expected behavior ?

I need a such feature for managing config with Puppet.

@sparrc
Copy link
Contributor

sparrc commented May 2, 2016

that's not expected.....can you post the config files that you're using? Both the main and any you have in directories.

@sparrc sparrc added the bug unexpected problem or unintended behavior label May 2, 2016
@GuillaumeLohez
Copy link
Author

Here is the "main" config file:

[global_tags]
    os = "windows"

[agent]
    interval = "30s"
    collection_jitter = "5s"
    flush_interval = "30s"
    metric_buffer_limit = 5000
    round_interval = false
    flush_jitter = "10s"
    flush_buffer_when_full = true
    debug = false
    quiet = false

[[outputs.influxdb]]
    urls = ["http://influxdbdev1.odiso.net:8086"]
    database = "telegraf"
    precision = "s"

All files in telegraf.d, one input per file.

win_perf_counters_logicaldisk.conf

[[inputs.win_perf_counters]]

    [[inputs.win_perf_counters.object]]
        ObjectName = "LogicalDisk"
        Instances = ["*"]
        Counters = ["% Disk Read Time", "% Disk Time", "% Disk Write Time", "% Free Space", "% Idle Time", "Disk Reads/sec", "Disk Writes/sec", "Free Megabytes"]
        Measurement = "win_logicaldisk"
        IncludeTotal=false

win_perf_counters_memory.conf

[[inputs.win_perf_counters]]

    [[inputs.win_perf_counters.object]]
        ObjectName = "Memory"
        Counters = ["Available Bytes", "Cache Bytes"]
        Instances = ["------"]
        Measurement = "win_memory"
        IncludeTotal=false

win_perf_counters_network_interface.conf

[[inputs.win_perf_counters]]

    [[inputs.win_perf_counters.object]]
        ObjectName = "Network Interface"
        Instances = ["*"]
        Counters = ["Bytes Received/sec", "Bytes Sent/sec", "Packets Received/sec", "Packets Sent/sec"]
        Measurement = "win_network_interface"
        IncludeTotal=false

win_perf_counters_processor.conf

[[inputs.win_perf_counters]]

    [[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_processor"
        IncludeTotal=true

win_perf_counters_system.conf

[[inputs.win_perf_counters]]

    [[inputs.win_perf_counters.object]]
        ObjectName = "System"
        Counters = ["Context Switches/sec", "System Calls/sec", "Threads", "Processes", "System Up Time"]
        Instances = ["------"]
        Measurement = "win_system"
        IncludeTotal=false

Only "processor" is working at the moment.

If I copy/paste everything in one file with only one line:

[[inputs.win_perf_counters]]

And then all block starting with:

    [[inputs.win_perf_counters.object]]

Everything is working.

@sparrc sparrc changed the title multiple [[inputs.win_perf_counters]] ? Windows: multiple config files not working properly May 11, 2016
@AliGouta
Copy link

Any update regarding this issue?

@sparrc
Copy link
Contributor

sparrc commented May 19, 2016

nope, you will need to use one file for now.

@elvarb
Copy link

elvarb commented Aug 8, 2016

Would love to get this feature. For configuration management for large environments then you could have one base telegraf config that all machines get and then one extra file per role, for SQL servers, for IIS servers and so on.

@ricou84
Copy link

ricou84 commented Aug 31, 2016

Hello. Any chance to have news about this issues

@sparrc
Copy link
Contributor

sparrc commented Aug 31, 2016

This is a low priority for me at the moment, there is an easy workaround and I don't have a way to easily reproduce as I don't have a windows dev environment. If someone can submit a PR it would be greatly appreciated.

@sparrc
Copy link
Contributor

sparrc commented Sep 28, 2016

I've identified the problem here while investigating another issue, we should use filepath.Walk in the config.LoadDirectory function instead of constructing the full path ourselves.

sparrc added a commit that referenced this issue Sep 28, 2016
sparrc added a commit that referenced this issue Sep 28, 2016
sparrc added a commit that referenced this issue Sep 28, 2016
jackzampolin pushed a commit that referenced this issue Oct 7, 2016
@cdhunt
Copy link

cdhunt commented Jan 31, 2017

I am still seeing the behavior originally described in 1.2.0. @glz-io, is it working as expected for you?

@GuillaumeLohez
Copy link
Author

My windows servers are not on the latest version at the moment. I'll try to work on this by the end of the week.

@cdhunt
Copy link

cdhunt commented Jan 31, 2017

When I attempt to load multiple files with [[inputs.win_perf_counters]] I see it listed multiple times in the telegraf.log.

Example: With [[inputs.win_perf_counters]] defined in three files I see.
I! Loaded inputs: inputs.win_perf_counters inputs.win_perf_counters inputs.win_perf_counters

@skburgart
Copy link
Contributor

@sparrc I believe this issue was prematurely closed - the problem still exists as of the latest nightly. Like @cdhunt mentioned, the log lists multiple inputs being loaded but only one actually collects.

@danielnelson danielnelson reopened this May 11, 2017
@danielnelson danielnelson removed this from the 1.1.0 milestone May 11, 2017
@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
@danielnelson
Copy link
Contributor

If anyone wants to take a stab at this it is probably related to these package level variables: https://github.com/influxdata/telegraf/blob/master/plugins/inputs/win_perf_counters/win_perf_counters.go#L69

@skburgart
Copy link
Contributor

Thanks for the guidance @danielnelson, I'll take a shot at this.

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) bug unexpected problem or unintended behavior help wanted Request for community participation, code, contribution platform/windows
Projects
None yet
8 participants