01 - InfluxDB: First Steps and Guide-Lines

Aus Wiki-WebPerfect
Version vom 22. April 2020, 07:58 Uhr von Admin (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

InfluxLine Protocol

InfluxDB line protocol is a text based format for writing points to InfluxDB.

Syntax

<measurement>,<tag_key>=<tag_value>,<tag_key>=<tag_value> <field_key>=<field_value>,<field_key>=<field_value> <timestamp>

Example:

win_process_usage,ProcessName,ID Handles,PagedmemorySize,CPU

Measurement = win_process_usace
Tags = ProcessName, ID
Fields = Handles, PagedmemorySize, CPU


PowerShell-Example to write this with the Telegraf Agent to an InfluxDB

Telegraf configuration name "inputs.exec.process.conf"

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


PowerShell-Skript named "input.process.ps1"

$Processes = Get-Process -Name *vmm* | Select-Object ProcessName, Id, Handles, PagedmemorySize, CPU
 
ForEach ($Process in $Processes) {
    Write-Output "win_process_usage,ProcessName=$($Process.ProcessName) ID=$($Process.Id),Handles=$($Process.Handles),PagedmemorySize=$($Process.PagedmemorySize),CPU=$($Process.CPU)"
}




More informations: https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/