Skip to content

A PowerShell module to convert PowerShell outputs to the InfluxLine-Protocol for Telegraf agent. (https://www.influxdata.com/)

License

Notifications You must be signed in to change notification settings

R-Studio/PSInfluxLineConvert

Repository files navigation

PowerShell to InfluxLine Converter

This is a lightweight PowerShell module to convert PowerShell outputs for Telegraf agent to the InfluxLine-Protocol. Then the Telegraf agents reads the converted outputs and send this to an InfluxDB.

Installation

Import the module by running:

Import-Module PSInfluxLineConverter -Scope CurrentUser

Usage

Example: Converts the output of "Get-Process" to the InfluxLine-Protocol

# Content of PowerShell script "input.process.ps1"
Import-Module PSInfluxLineConverter
Get-Process | ConvertTo-Metric -Measure win_process -MetricProperty CPU,PagedmemorySize,Handles -TagProperty Id,ProcessName | ConvertTo-InfluxLineString
# Content of Telegraf configuration "inputs.exec.process.conf"
[[inputs.exec]]
commands = ['powershell -NoProfile -File "C:\Program Files\Telegraf\scripts\input.process.ps1"']
data_format = "influx"
timeout = "1m"

Informations about the example

  • Measurement = win_process
  • Tags = Id, ProcessName
  • Metric/Fields = CPU, PagedmemorySize, Handles

Cmdlets

A full list of implemented cmdlets is provided below for your reference. Use Get-Help <cmdlet name> with these to learn more about their usage.

Cmdlet Description
ConvertTo-Metric Converts the specified properties of any object to a metric object, which can then be easily transmitted to Influx.
ConvertTo-InfluxLineString Convert metrics to the InfluxLine protocol format, output as strings.

License

PSInfluxLineConverter Copyright (C) 2020 Robin Hermann This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.

Repo-Info

This repository is originally from @markwragg (https://github.com/markwragg/PowerShell-Influx). -> Thanks for that!! First I forked the repo and made it more lightweight. (All unused code are removed to minimize the overhead and optimize the performance.) Later I noticed I will worked on the originally repo, so I migrate this repo to a new GitHub repository to take advantages of forking features.

About

A PowerShell module to convert PowerShell outputs to the InfluxLine-Protocol for Telegraf agent. (https://www.influxdata.com/)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages