Hello.
I have issue when running telegraf a s a service. I test the config before I run telegraf with:
.\telegraf --config-directory “C:\Progra~1\telegraf” --test
It prints out metrics from all inputs. Then I execute the telegraf.exe with double-click and all metrics are stored in Influxdb.
However, when I start telegraf as a service, it sends all metrics except from the exec plugin. I am trying to troubleshoot it for much time, any ideas on what’s the issue here?
The inputs part of my conf file is the following:
[[inputs.exec]]
commands = ['powershell -Command "C:\Temp\csvfs.ps1"']
timeout = "9s"
data_format = "influx"
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Instances = ["*"]
Counters = [
"% Idle Time",
"% Interrupt Time",
"% Privileged Time",
"% User Time",
"% Processor Time"
]
Measurement = "win_cpu"
IncludeTotal=true
[[inputs.win_perf_counters.object]]
# Disk times and queues
ObjectName = "LogicalDisk"
Instances = ["*"]
Counters = [
"% Idle Time",
"% Disk Time",
"% Disk Read Time",
"% Disk Write Time",
"% User Time",
"% Free Space",
"Current Disk Queue Length",
"Free Megabytes",
"Disk Read Bytes/sec",
"Disk Write Bytes/sec"
]
Measurement = "win_disk"
IncludeTotal=true
[[inputs.win_perf_counters.object]]
ObjectName = "System"
Counters = [
"Context Switches/sec",
"System Calls/sec",
"Processor Queue Length",
"Threads",
"System Up Time",
"Processes"
]
Instances = ["------"]
Measurement = "win_system"
IncludeTotal=true
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back,
# such as from the Memory 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"
]
# Use 6 x - to remove the Instance bit from the query.
Instances = ["------"]
Measurement = "win_mem"
IncludeTotal=true
[[inputs.win_perf_counters.object]]
# more counters for the Network Interface Object can be found at
# https://msdn.microsoft.com/en-us/library/ms803962.aspx
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=true
[[inputs.win_perf_counters.object]]
# Process metrics
ObjectName = "Process"
Counters = [
"% Processor Time",
"Handle Count",
"Private Bytes",
"Thread Count",
"Virtual Bytes",
"Working Set"
]
Instances = ["*"]
Measurement = "win_proc"
IncludeTotal=true