Telegraf: Input Plugins

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

exec

timeout = "1m"
data_format = "influx"
PowerShell Parameter = -NoProfile


PowerShell Module "PSInfluxLineConverter"

PowerShell module to convert PowerShell outputs for Telegraf agent to the InfluxLine-Protocol. The Telegraf agents reads the converted outputs and send this to an InfluxDB.
More informations on my Github Project-Page.


Example: PowerShell-Skript that gets informations about the VHD (and converted with the PowerShell Module "PSInfluxLineConverter")

Telegraf Configuration

 [[inputs.exec]]
 commands = ['powershell -NoProfile -File "C:\Program Files\Telegraf\scripts\input.vhd.ps1"']
 data_format = "influx"
 timeout = "1m" 

PowerShell-Skript "input.vhd.ps1"

  • Install the PowerShell-Module "PSInfluxLineConverter" first, or copy the module to a destination (in this example: "C:\Program Files\Telegraf\scripts\psmodules\PSInfluxLineConverter")
Import-Module 'C:\Program Files\Telegraf\scripts\psmodules\PSInfluxLineConverter' -Force

$VHDs = (Get-VM).Id | ForEach {Get-VHD -Id $_} | select Path, DiskIdentifier, VhdFormat, VhdType, Size, MinimumSize, FileSize, LogicalSectorSize, PhysicalSectorSize, BlockSize, FragmentationPercentage
$VHDs | ConvertTo-Metric -Measure hyperv_vhd -MetricProperty Size, MinimumSize, FileSize, LogicalSectorSize, PhysicalSectorSize, BlockSize, FragmentationPercentage -TagProperty Path, DiskIdentifier, VhdFormat, VhdType | ConvertTo-InfluxLineString