< Back

ConvertTo-PromExposition

Sun Jan 19, 2020 5:35 pm

NAME ConvertTo-PromExposition



SYNOPSIS

A function to generate data that can be post to Prometheus PushGateway.





SYNTAX

ConvertTo-PromExposition [-Sample] <PerformanceCounterSample> [<CommonParameters>]





DESCRIPTION

A function to generate data that can be post to Prometheus PushGateway.





PARAMETERS

-Sample <PerformanceCounterSample>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSample





OUTPUTS

System.String





NOTES





None



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$metric = Get-Counter | Select-Object -ExpandProperty 'CounterSamples' | ?{$PSItem.InstanceName -match

'[a-zA-Z_:][a-zA-Z0-9_:]*'}



$metric = $metric | ConvertTo-PromExposition

$response = Invoke-WebRequest -Uri "http://localhost:9091/metrics/job/pushgateway/" -Method Post -Body $metric











RELATED LINKS

https://prometheus.io/docs/instrumentin ... n_formats/