powerful-fish-66594
02/26/2024, 8:48 AMconst uptimeCheckConfigId = `my_uptime_check_config`;
const uptimeCheckConfig = new gcp.monitoring.UptimeCheckConfig(
uptimeCheckConfigId,
{
timeout: '20s',
period: '60s',
httpCheck: {
path: '/health/status',
port: 80,
},
monitoredResource: {
labels: {
host: ....myUrl,
},
type: 'uptime_url',
},
displayName: `Uptime check`,
},
{ provider },
);
const myAlertPolicy = new gcp.monitoring.AlertPolicy(
`my_uptime_alert_policy`,
{
notificationChannels: ...myChannelIds...,
combiner: 'OR',
conditions: [
{
displayName: `Uptime check FAILED`,
conditionThreshold: {
aggregations: [
{
alignmentPeriod: '420s',
crossSeriesReducer: 'REDUCE_COUNT_FALSE',
groupByFields: [
'resource.label.project_id',
'resource.label.host',
],
perSeriesAligner: 'ALIGN_NEXT_OLDER',
},
],
comparison: 'COMPARISON_GT',
duration: '60s',
filter: `resource.type = "uptime_url" AND metric.type = "<http://monitoring.googleapis.com/uptime_check/check_passed|monitoring.googleapis.com/uptime_check/check_passed>" AND resource.labels.check_id = "${uptimeCheckConfigId}"`,
thresholdValue: 1,
trigger: {
count: 1,
},
},
},
],
displayName: `Alert Policy check`,
},
{ provider },
);
However, I get
Error creating AlertPolicy: googleapi: Error 400: The supplied filter does not specify a valid combination of metric and monitored resource descriptors. The query will not return any time series.
I have a working example in a manually (= via GUI) created GCP project. I pretty much copied the alert policy from there. Only difference: It says *metric*.labels.check_id
there instead of *resource*.labels.check_id
. However, if I do the same in Pulumi, then the Uptime Check and the Alert Policy do not seem to be connected at all. It says "No policy connected". I'm pretty confused by this. Has anyone any clue?No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by