Skip to content

Write StatsD

AzureDevOps edited this page Sep 25, 2026 · 1 revision

Write-StatsD

SYNOPSIS

Send metrics to a statsd server via UDP for writing to Influx.

SYNTAX

MetricObject

Write-StatsD [-InputObject] <PSObject[]> [-IP <IPAddress>] [-Port <Int32>] [-ProgressAction <ActionPreference>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

StatsDString

Write-StatsD [-Data] <String[]> [-IP <IPAddress>] [-Port <Int32>] [-ProgressAction <ActionPreference>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

PowerShell cmdlet to send metric data to a statsd server. Unless server or port is passed, uses the default 127.0.0.1 and port of 8125.

EXAMPLES

EXAMPLE 1

Write-StatsD 'my_metric:123|g'

This will write a value to a gauge metric named my_metric.

EXAMPLE 2

Write-StatsD 'my_metric:321|g' -ip 10.0.0.10 -port 8180

This will write a value to a gauge metric named my_metric via the specified IP and port.

EXAMPLE 3

'my_metric:1|c' | Write-StatsD

This will write a value to a counter metric, using the piepline as input for the cmdlet.

PARAMETERS

-InputObject

A metric object (generated by one of the Get-*Metric cmdlets from this module) which can be provided as pipeline input and will be automatically converted to StatsD strings.

Type: PSObject[]
Parameter Sets: MetricObject
Aliases:

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

-Data

Metric data to send to statsd. If string is not enclosed in quotes (single or double), the pipe character needs to be escaped.

Type: String[]
Parameter Sets: StatsDString
Aliases:

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

-IP

IP address for statsd server

Type: IPAddress
Parameter Sets: (All)
Aliases:

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

-Port

Port that statsd server is listening to

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 8125
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