UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

225 lines (224 loc) 8.78 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Sets the global notification policy for Grafana. * * !> This resource manages the entire notification policy tree and overwrites its policies. However, it does not overwrite internal policies created when alert rules directly set a contact point for notifications. * * * Official documentation * * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/alerting_provisioning/#notification-policies) * * This resource requires Grafana 9.1.0 or later. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const aContactPoint = new grafana.alerting.ContactPoint("a_contact_point", { * name: "A Contact Point", * emails: [{ * addresses: [ * "one@company.org", * "two@company.org", * ], * message: "{{ len .Alerts.Firing }} firing.", * }], * }); * const aMuteTiming = new grafana.alerting.MuteTiming("a_mute_timing", { * name: "Some Mute Timing", * intervals: [{ * weekdays: ["monday"], * }], * }); * const myNotificationPolicy = new grafana.alerting.NotificationPolicy("my_notification_policy", { * groupBies: ["..."], * contactPoint: aContactPoint.name, * groupWait: "45s", * groupInterval: "6m", * repeatInterval: "3h", * policies: [ * { * matchers: [ * { * label: "mylabel", * match: "=", * value: "myvalue", * }, * { * label: "alertname", * match: "=", * value: "CPU Usage", * }, * { * label: "Name", * match: "=~", * value: "host.*|host-b.*", * }, * ], * contactPoint: aContactPoint.name, * "continue": true, * muteTimings: [aMuteTiming.name], * groupWait: "45s", * groupInterval: "6m", * repeatInterval: "3h", * policies: [{ * matchers: [{ * label: "sublabel", * match: "=", * value: "subvalue", * }], * contactPoint: aContactPoint.name, * groupBies: ["..."], * }], * }, * { * matchers: [{ * label: "anotherlabel", * match: "=~", * value: "another value.*", * }], * contactPoint: aContactPoint.name, * groupBies: ["..."], * }, * ], * }); * ``` * * ## Import * * ```sh * $ pulumi import grafana:index/notificationPolicy:NotificationPolicy name "{{ anyString }}" * ``` * * ```sh * $ pulumi import grafana:index/notificationPolicy:NotificationPolicy name "{{ orgID }}:{{ anyString }}" * ``` * * @deprecated grafana.index/notificationpolicy.NotificationPolicy has been deprecated in favor of grafana.alerting/notificationpolicy.NotificationPolicy */ export declare class NotificationPolicy extends pulumi.CustomResource { /** * Get an existing NotificationPolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NotificationPolicyState, opts?: pulumi.CustomResourceOptions): NotificationPolicy; /** * Returns true if the given object is an instance of NotificationPolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is NotificationPolicy; /** * The default contact point to route all unmatched notifications to. */ readonly contactPoint: pulumi.Output<string>; readonly disableProvenance: pulumi.Output<boolean | undefined>; /** * A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. */ readonly groupBies: pulumi.Output<string[]>; /** * Minimum time interval between two notifications for the same group. Default is 5 minutes. */ readonly groupInterval: pulumi.Output<string | undefined>; /** * Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds. */ readonly groupWait: pulumi.Output<string | undefined>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ readonly orgId: pulumi.Output<string | undefined>; /** * Routing rules for specific label sets. */ readonly policies: pulumi.Output<outputs.NotificationPolicyPolicy[] | undefined>; /** * Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours. */ readonly repeatInterval: pulumi.Output<string | undefined>; /** * Create a NotificationPolicy resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ /** @deprecated grafana.index/notificationpolicy.NotificationPolicy has been deprecated in favor of grafana.alerting/notificationpolicy.NotificationPolicy */ constructor(name: string, args: NotificationPolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering NotificationPolicy resources. */ export interface NotificationPolicyState { /** * The default contact point to route all unmatched notifications to. */ contactPoint?: pulumi.Input<string>; disableProvenance?: pulumi.Input<boolean>; /** * A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. */ groupBies?: pulumi.Input<pulumi.Input<string>[]>; /** * Minimum time interval between two notifications for the same group. Default is 5 minutes. */ groupInterval?: pulumi.Input<string>; /** * Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds. */ groupWait?: pulumi.Input<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: pulumi.Input<string>; /** * Routing rules for specific label sets. */ policies?: pulumi.Input<pulumi.Input<inputs.NotificationPolicyPolicy>[]>; /** * Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours. */ repeatInterval?: pulumi.Input<string>; } /** * The set of arguments for constructing a NotificationPolicy resource. */ export interface NotificationPolicyArgs { /** * The default contact point to route all unmatched notifications to. */ contactPoint: pulumi.Input<string>; disableProvenance?: pulumi.Input<boolean>; /** * A list of alert labels to group alerts into notifications by. Use the special label `...` to group alerts by all labels, effectively disabling grouping. */ groupBies: pulumi.Input<pulumi.Input<string>[]>; /** * Minimum time interval between two notifications for the same group. Default is 5 minutes. */ groupInterval?: pulumi.Input<string>; /** * Time to wait to buffer alerts of the same group before sending a notification. Default is 30 seconds. */ groupWait?: pulumi.Input<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: pulumi.Input<string>; /** * Routing rules for specific label sets. */ policies?: pulumi.Input<pulumi.Input<inputs.NotificationPolicyPolicy>[]>; /** * Minimum time interval for re-sending a notification if an alert is still firing. Default is 4 hours. */ repeatInterval?: pulumi.Input<string>; }