Send Graphite metrics to an HTTP endpoint.
Send-GraphiteMetric [-URI <Uri>] [-Metrics <String>] [-AccessToken <String>] [-OutputToConsole] [-PassThru]
[<CommonParameters>]
Calling this function will return data returned from the request.
$response = Send-GraphiteMetric -Metrics @"
[
{
"name": "test.series.1",
"value": 3.14159,
"interval": 10,
"time": 1662562317
},
{
"name": "test.series.2",
"value": 3.14159,
"interval": 10,
"time": 1662562317
}
]
"@
Write-Host "Metrics sent to Graphite [$($response.StatusCode) $($response.StatusDescription)]: $($response.Content | ConvertFrom-Json | Select-Object Invalid, Published)"
Specifies the URI for the request. Override default using the GRAPHITE_ENDPOINT or GRAPHITE_HOST environment variables.
Type: Uri
Parameter Sets: (All)
Aliases: URL
Required: False
Position: Named
Default value: $(
if ($env:GRAPHITE_ENDPOINT) {
$env:GRAPHITE_ENDPOINT
} elseif ($env:GRAPHITE_HOST) {
"https://$env:GRAPHITE_HOST/graphite/metrics" -replace '^https:\/\/http', 'http'
} else {
'https://graphite-blocks-prod-us-central1.grafana.net/graphite/metrics'
}
)
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the metrics to send.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the access token to use for the communication. Override default using the GRAPHITE_ACCESS_TOKEN environment variable.
Type: String
Parameter Sets: (All)
Aliases: Token
Required: False
Position: Named
Default value: $(
if ($script:GraphiteAccessTokenCache) {
$script:GraphiteAccessTokenCache
} elseif ($env:GRAPHITE_ACCESS_TOKEN) {
$env:GRAPHITE_ACCESS_TOKEN
}
)
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSwitch to output result to the console.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSwitch to still return the reponse even when the '-OutputToConsole' parameter is provided.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.