Skip to content

Write Influx

AzureDevOps edited this page Sep 25, 2026 · 1 revision

Write-Influx

SYNOPSIS

Writes data to Influx via the REST API.

SYNTAX

Measure_v1 (Default)

Write-Influx -Measure <String> [-Tags <Hashtable>] -Metrics <Hashtable> [-TimeStamp <DateTime>]
 [-Server <String>] [-Bulk] [-BulkSize <Int32>] [-ExcludeEmptyMetric] -Database <String>
 [-Credential <PSCredential>] [-TrustServerCertificate] [-SingleLineMetrics]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

MetricObject_v2

Write-Influx -InputObject <PSObject[]> [-Server <String>] [-Bulk] [-BulkSize <Int32>] [-ExcludeEmptyMetric]
 -Organisation <String> -Bucket <String> -Token <String> [-TrustServerCertificate] [-SingleLineMetrics]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

MetricObject_v1

Write-Influx -InputObject <PSObject[]> [-Server <String>] [-Bulk] [-BulkSize <Int32>] [-ExcludeEmptyMetric]
 -Database <String> [-Credential <PSCredential>] [-TrustServerCertificate] [-SingleLineMetrics]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

Measure_v2

Write-Influx -Measure <String> [-Tags <Hashtable>] -Metrics <Hashtable> [-TimeStamp <DateTime>]
 [-Server <String>] [-Bulk] [-BulkSize <Int32>] [-ExcludeEmptyMetric] -Organisation <String> -Bucket <String>
 -Token <String> [-TrustServerCertificate] [-SingleLineMetrics] [-ProgressAction <ActionPreference>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

Use to send data in to an Influx database by providing a hashtable of tags and values.

EXAMPLES

EXAMPLE 1

Write-Influx -Measure WebServer -Tags @{Server='Host01'} -Metrics @{CPU=100; Memory=50} -Database Web -Server http://myinflux.local:8086

Description

This command will submit the provided tag and metric data for a measure called 'WebServer' to a database called 'Web' via the API endpoint 'http://myinflux.local:8086'

PARAMETERS

-InputObject

A metric object (generated by one of the Get-*Metric cmdlets from this module) which can be provided as pipeline input.

Type: PSObject[]
Parameter Sets: MetricObject_v2, MetricObject_v1
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Measure

The name of the measure to be updated or created.

Type: String
Parameter Sets: Measure_v1, Measure_v2
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Tags

A hashtable of tag names and values.

Type: Hashtable
Parameter Sets: Measure_v1, Measure_v2
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Metrics

A hashtable of metric names and values.

Type: Hashtable
Parameter Sets: Measure_v1, Measure_v2
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TimeStamp

Specify the exact date and time for the measure data point. If not specified the current date and time is used.

Type: DateTime
Parameter Sets: Measure_v1, Measure_v2
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Server

The URL and port for the Influx REST API. Default: 'http://localhost:8086'

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Http://localhost:8086
Accept pipeline input: False
Accept wildcard characters: False

-Bulk

Switch: Use to have all metrics transmitted via a single connection to Influx.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-BulkSize

The number of metrics to include when using the -Bulk switch before a write occurs. Default: 5000.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 5000
Accept pipeline input: False
Accept wildcard characters: False

-ExcludeEmptyMetric

Switch: Use to exclude null or empty metric values from being sent. Useful where a metric is initially created as an integer but then an empty or null instance of that metric would attempt to be sent as an empty string, resulting in a datatype conflict.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Database

The name of the Influx database to write to. (This is an InfluxDB v1.x Parameter)

Type: String
Parameter Sets: Measure_v1, MetricObject_v1
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Credential

A PSCredential object with the username and password to use if the Influx server has authentication enabled. (This is an InfluxDB v1.x Parameter)

Type: PSCredential
Parameter Sets: Measure_v1, MetricObject_v1
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Organisation

The name of the Influx organisation. (This is an InfluxDB v2.x Parameter)

Type: String
Parameter Sets: MetricObject_v2, Measure_v2
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Bucket

The name of the Influx bucket/database to write to. (This is an InfluxDB v2.x Parameter)

Type: String
Parameter Sets: MetricObject_v2, Measure_v2
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Token

The token to authenticate with InfluxDB. (This is an InfluxDB v2.x Parameter)

Type: String
Parameter Sets: MetricObject_v2, Measure_v2
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TrustServerCertificate

Switch: Skips Server SSL certificate validation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-SingleLineMetrics

Switch: Sends all measured values for every Metric object or Measure passed within the single Influx Line Protocol line.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{Fill ProgressAction Description}}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

NOTES

RELATED LINKS

Clone this wiki locally