# google-cloud


02/26/2024, 8:48 AM
Another notification related question: I'm trying to set-up an uptime check. Tried to follow but that one seems very much incomplete and outdated. So, after experimenting a little bit I ended up with:
Copy code
const uptimeCheckConfigId = `my_uptime_check_config`;
    const uptimeCheckConfig = new gcp.monitoring.UptimeCheckConfig(
            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(
            notificationChannels: ...myChannelIds...,
            combiner: 'OR',

            conditions: [
                    displayName: `Uptime check FAILED`,
                    conditionThreshold: {
                        aggregations: [
                                alignmentPeriod: '420s',
                                crossSeriesReducer: 'REDUCE_COUNT_FALSE',
                                groupByFields: [
                                perSeriesAligner: 'ALIGN_NEXT_OLDER',
                        comparison: 'COMPARISON_GT',
                        duration: '60s',
                        filter: `resource.type = "uptime_url" AND metric.type = "<|>" 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
there instead of
. 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?