I'm trying to use the new relic pulumi provider an...
# general
d
I'm trying to use the new relic pulumi provider and trying to use
InfraAlertCondition
https://github.com/pulumi/pulumi-newrelic/blob/master/sdk/nodejs/infraAlertCondition.ts This is not working for me This link provides all the data available through NR: https://docs.newrelic.com/docs/integrations/kubernetes-integration/understand-use-data/understand-use-data
So my code snippet is here:
Copy code
const customControllerAlert = new newrelic.InfraAlertCondition("Custom controller alert", {
    name: "test",
    type: "infra_metric",
    policyId: alertChannels.mustangAlertPolicy.id.apply(id => parseInt(id)),
    select: "isReady",
    event: "K8sPodSample",
    integrationProvider: "K8sPodSample",
    comparison: "below",
    where: "(clusterName='online-sandbox-nshah' AND namespace='podscaling-controller-system'",
    critical: {
        duration: 20,
        timeFunction: "all",
        value: 1
    },
    enabled: true
}, {dependsOn: [cluster], provider: newrelicProvider })
@broad-dog-22463 ^
g
When you say it's not working for you, what do you mean? Do you get an error? Does it crash?
Are there properties missing?
d
I have got a variety of error: 500, 400
g
Can you share the full output and error messages?
d
Copy code
newrelic:index:InfraAlertCondition (Custom controller alert):
    error: Plan apply failed: Unexpected status 500 returned from API
This is all I get
Nothing more
And
400
as well
The pulumi example is kind of wrong..
g
Can you re-run with
--debug
and see if you get a more detailed error message?
d
Nothing glaring..I can share on DM if you can find something
But I basically created an alert manually in New Relic and then tried to get it manually using the python rest API to make sure I was filling the right fields in pulumi:
Copy code
{'data': {'comparison': 'below',
          'created_at_epoch_millis': 1567110212508,
          'critical_threshold': {'duration_minutes': 10,
                                 'time_function': 'all',
                                 'value': 1},
          'enabled': True,
          'event_type': 'K8sPodSample',
          'filter': {'and': [{'is': {'clusterName': 'online-sandbox-nshah'}},
                             {'is': {'namespace': 'podscaling-controller-system'}}]},
          'id': 10905253,
          'name': 'Custom scaling controller is always up and ready',
          'policy_id': 510634,
          'select_value': 'isReady',
          'type': 'infra_metric',
          'updated_at_epoch_millis': 1567110212618,
          'violation_close_timer': 24}}
g
Yes, please share via DM. I will try to take a deeper look in a little bit.
In case others come across this thread in the future, this was a syntax error in the
where
clause for the
InfraAlertCondition
. More details are at https://github.com/pulumi/pulumi-newrelic/issues/22.