Hi, I am pretty new to Telegraf/InfluxDB/Grafana and I am getting into it using my own PC, so I am pretty new to this. I gather some information and report it into Influx to build a dashboard.
Telegraf is running as a service and reporting some data including a [[input.exec]] plugin with a ps1 script.
.\telegraf.exe --service install --config ‘C:\Program Files\InfluxData\telegraf\telegraf-1.23.4\telegraf.conf’
The script contains WMI data and is reporting some of the data but not all. I can see the script is executed by telegraf and running once a second.
The strange thing is that telegraf is sending all data from the script if running manually:
.\telegraf.exe --config ‘C:\Program Files\InfluxData\telegraf\telegraf-1.23.4\telegraf.conf’
is is not when running as a service. There is only a single ps1 script that is used so I assume it is not a permission challenge.
How can I best debug this behavior ?
Script part that only works manually:
## Custom stuff here
$ohmf = 'c:\Program Files\InfluxData\telegraf\telegraf-1.23.4\exe\ohm.txt'
$ohm = Get-CimInstance -ClassName Sensor -Namespace 'root\OpenHardwareMonitor' > $ohmf
# CPU temp package: /amdcpu/0/temperature/0
$cputemp=Select-String $ohmf -Pattern "/amdcpu/0/temperature/0" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$cputempvalue=$cputemp.split(":",5)[-1] -replace '\s','' -replace ',','.'
# CPU temp CCD: /amdcpu/0/temperature/4
$cpuccd=Select-String $ohmf -Pattern "/amdcpu/0/temperature/4" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$cpuccdvalue=$cpuccd.split(":",5)[-1] -replace '\s','' -replace ',','.'
# CPU power: /amdcpu/0/power/0
$cpupower=Select-String $ohmf -Pattern "/amdcpu/0/power/0" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$cpupowervalue=$cpupower.split(":",5)[-1] -replace '\s','' -replace ',','.'
# CPU power cores: /amdcpu/0/power/1
$cpupc=Select-String $ohmf -Pattern "/amdcpu/0/power/1" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$cpupcvalue=$cpupc.split(":",5)[-1] -replace '\s','' -replace ',','.'
# GPU Core temp: /atigpu/0/temperature/0
$gputemp=Select-String $ohmf -Pattern "/atigpu/0/temperature/0" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$gputempvalue=$gputemp.split(":",5)[-1] -replace '\s','' -replace ',','.'
# GPU HotSPot: /atigpu/0/temperature/9
$gpuhotspot=Select-String $ohmf -Pattern "/atigpu/0/temperature/9" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$gpuhotspotvalue=$gpuhotspot.split(":",5)[-1] -replace '\s','' -replace ',','.'
# GPU power: /atigpu/0/power/0
$gpupower=Select-String $ohmf -Pattern "/atigpu/0/power/0" -Context 0,10 | out-string -stream | select -first 1 -skip 10
$gpupowervalue=$gpupower.split(":",5)[-1] -replace '\s','' -replace ',','.'
echo "$($metric),host=$($si.Name),metric=cputemp value=$($cputempvalue)"
echo "$($metric),host=$($si.Name),metric=cpucd value=$($cpuccdvalue)"
echo "$($metric),host=$($si.Name),metric=cpupower value=$($cpupowervalue)"
echo "$($metric),host=$($si.Name),metric=cpupc value=$($cpupcvalue)"
echo "$($metric),host=$($si.Name),metric=gputemp value=$($gputempvalue)"
echo "$($metric),host=$($si.Name),metric=gpuhotspot value=$($gpuhotspotvalue)"
echo "$($metric),host=$($si.Name),metric=gpupower value=$($gpupowervalue)"