Viewing docs for New Relic v4.20.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Viewing docs for New Relic v4.20.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Use this data source to get information about a specific synthetics monitor in New Relic that already exists. This can be used to set up a Synthetics alert condition.
Example Usage
using System.Collections.Generic;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var bar = NewRelic.Synthetics.GetMonitor.Invoke(new()
{
Name = "bar",
});
var baz = new NewRelic.Synthetics.AlertCondition("baz", new()
{
PolicyId = newrelic_alert_policy.Foo.Id,
MonitorId = bar.Apply(getMonitorResult => getMonitorResult.Id),
RunbookUrl = "https://www.example.com",
});
});
package main
import (
"github.com/pulumi/pulumi-newrelic/sdk/v4/go/newrelic/synthetics"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bar, err := synthetics.LookupMonitor(ctx, &synthetics.LookupMonitorArgs{
Name: "bar",
}, nil)
if err != nil {
return err
}
_, err = synthetics.NewAlertCondition(ctx, "baz", &synthetics.AlertConditionArgs{
PolicyId: pulumi.Any(newrelic_alert_policy.Foo.Id),
MonitorId: pulumi.String(bar.Id),
RunbookUrl: pulumi.String("https://www.example.com"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.synthetics.SyntheticsFunctions;
import com.pulumi.newrelic.synthetics.inputs.GetMonitorArgs;
import com.pulumi.newrelic.synthetics.AlertCondition;
import com.pulumi.newrelic.synthetics.AlertConditionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var bar = SyntheticsFunctions.getMonitor(GetMonitorArgs.builder()
.name("bar")
.build());
var baz = new AlertCondition("baz", AlertConditionArgs.builder()
.policyId(newrelic_alert_policy.foo().id())
.monitorId(bar.applyValue(getMonitorResult -> getMonitorResult.id()))
.runbookUrl("https://www.example.com")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const bar = newrelic.synthetics.getMonitor({
name: "bar",
});
const baz = new newrelic.synthetics.AlertCondition("baz", {
policyId: newrelic_alert_policy.foo.id,
monitorId: bar.then(bar => bar.id),
runbookUrl: "https://www.example.com",
});
import pulumi
import pulumi_newrelic as newrelic
bar = newrelic.synthetics.get_monitor(name="bar")
baz = newrelic.synthetics.AlertCondition("baz",
policy_id=newrelic_alert_policy["foo"]["id"],
monitor_id=bar.id,
runbook_url="https://www.example.com")
resources:
baz:
type: newrelic:synthetics:AlertCondition
properties:
policyId: ${newrelic_alert_policy.foo.id}
monitorId: ${bar.id}
runbookUrl: https://www.example.com
variables:
bar:
Fn::Invoke:
Function: newrelic:synthetics:getMonitor
Arguments:
name: bar
Using getMonitor
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getMonitor(args: GetMonitorArgs, opts?: InvokeOptions): Promise<GetMonitorResult>
function getMonitorOutput(args: GetMonitorOutputArgs, opts?: InvokeOptions): Output<GetMonitorResult>def get_monitor(name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetMonitorResult
def get_monitor_output(name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetMonitorResult]func LookupMonitor(ctx *Context, args *LookupMonitorArgs, opts ...InvokeOption) (*LookupMonitorResult, error)
func LookupMonitorOutput(ctx *Context, args *LookupMonitorOutputArgs, opts ...InvokeOption) LookupMonitorResultOutput> Note: This function is named LookupMonitor in the Go SDK.
public static class GetMonitor
{
public static Task<GetMonitorResult> InvokeAsync(GetMonitorArgs args, InvokeOptions? opts = null)
public static Output<GetMonitorResult> Invoke(GetMonitorInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetMonitorResult> getMonitor(GetMonitorArgs args, InvokeOptions options)
public static Output<GetMonitorResult> getMonitor(GetMonitorArgs args, InvokeOptions options)
fn::invoke:
function: newrelic:synthetics/getMonitor:getMonitor
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- The name of the synthetics monitor in New Relic.
- Name string
- The name of the synthetics monitor in New Relic.
- name String
- The name of the synthetics monitor in New Relic.
- name string
- The name of the synthetics monitor in New Relic.
- name str
- The name of the synthetics monitor in New Relic.
- name String
- The name of the synthetics monitor in New Relic.
getMonitor Result
The following output properties are available:
- id str
- The provider-assigned unique ID for this managed resource.
- monitor_
id str - The ID of the synthetics monitor.
- name str
Package Details
- Repository
- New Relic pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.
Viewing docs for New Relic v4.20.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
