@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
146 lines • 5.68 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationAlertsConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages Knowledge Graph Alert Configurations through Grafana API.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* // Basic alert configuration with silencing
* const prometheusRemoteStorageFailures = new grafana.assert.NotificationAlertsConfig("prometheus_remote_storage_failures", {
* name: "PrometheusRemoteStorageFailures",
* matchLabels: {
* alertname: "PrometheusRemoteStorageFailures",
* alertgroup: "prometheus.alerts",
* asserts_env: "prod",
* },
* silenced: true,
* });
* // High severity alert with specific job and context matching
* const errorBuildupNotify = new grafana.assert.NotificationAlertsConfig("error_buildup_notify", {
* name: "ErrorBuildupNotify",
* matchLabels: {
* alertname: "ErrorBuildup",
* job: "acai",
* asserts_request_type: "inbound",
* asserts_request_context: "/auth",
* },
* silenced: false,
* });
* // Alert with additional labels and custom duration
* const paymentTestAlert = new grafana.assert.NotificationAlertsConfig("payment_test_alert", {
* name: "PaymentTestAlert",
* matchLabels: {
* alertname: "PaymentTestAlert",
* additional_labels: "asserts_severity=~\"critical\"",
* alertgroup: "alex-k8s-integration-test.alerts",
* },
* alertLabels: {
* testing: "onetwothree",
* },
* duration: "5m",
* silenced: false,
* });
* // Latency alert for shipping service
* const highShippingLatency = new grafana.assert.NotificationAlertsConfig("high_shipping_latency", {
* name: "high shipping latency",
* matchLabels: {
* alertname: "LatencyP99ErrorBuildup",
* job: "shipping",
* asserts_request_type: "inbound",
* },
* silenced: false,
* });
* // CPU throttling alert with warning severity
* const cpuThrottlingSustained = new grafana.assert.NotificationAlertsConfig("cpu_throttling_sustained", {
* name: "CPUThrottlingSustained",
* matchLabels: {
* alertname: "CPUThrottlingSustained",
* additional_labels: "asserts_severity=~\"warning\"",
* },
* silenced: true,
* });
* // Ingress error rate alert
* const ingressError = new grafana.assert.NotificationAlertsConfig("ingress_error", {
* name: "ingress error",
* matchLabels: {
* alertname: "ErrorRatioBreach",
* job: "ingress-nginx-controller-metrics",
* asserts_request_type: "inbound",
* },
* silenced: false,
* });
* // MySQL Galera cluster alert
* const mysqlGaleraNotReady = new grafana.assert.NotificationAlertsConfig("mysql_galera_not_ready", {
* name: "MySQLGaleraNotReady",
* matchLabels: {
* alertname: "MySQLGaleraNotReady",
* },
* silenced: false,
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_asserts_notification_alerts_config.name "{{ name }}"
* ```
*/
class NotificationAlertsConfig extends pulumi.CustomResource {
/**
* Get an existing NotificationAlertsConfig 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, id, state, opts) {
return new NotificationAlertsConfig(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NotificationAlertsConfig. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === NotificationAlertsConfig.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["alertLabels"] = state?.alertLabels;
resourceInputs["duration"] = state?.duration;
resourceInputs["matchLabels"] = state?.matchLabels;
resourceInputs["name"] = state?.name;
resourceInputs["silenced"] = state?.silenced;
}
else {
const args = argsOrState;
resourceInputs["alertLabels"] = args?.alertLabels;
resourceInputs["duration"] = args?.duration;
resourceInputs["matchLabels"] = args?.matchLabels;
resourceInputs["name"] = args?.name;
resourceInputs["silenced"] = args?.silenced;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationAlertsConfig.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationAlertsConfig = NotificationAlertsConfig;
/** @internal */
NotificationAlertsConfig.__pulumiType = 'grafana:assert/notificationAlertsConfig:NotificationAlertsConfig';
//# sourceMappingURL=notificationAlertsConfig.js.map