@pulumi/sumologic
Version:
A Pulumi package for creating and managing sumologic cloud resources.
638 lines (637 loc) • 25.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Provides the ability to create, read, delete, and update [Monitors](https://help.sumologic.com/?cid=10020).
* If Fine Grain Permission (FGP) feature is enabled with Monitors Content at one's Sumo Logic account, one can also set those permission details under this monitor resource. For further details about FGP, please see this [Monitor Permission document](https://help.sumologic.com/Visualizations-and-Alerts/Alerts/Monitors#configure-permissions-for-a-monitor).
*
* ## Example SLO Monitors
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const tfSloMonitor1 = new sumologic.Monitor("tf_slo_monitor_1", {
* name: "SLO SLI monitor",
* type: "MonitorsLibraryMonitor",
* isDisabled: false,
* contentType: "Monitor",
* monitorType: "Slo",
* sloId: "0000000000000009",
* evaluationDelay: "5m",
* tags: {
* team: "monitoring",
* application: "sumologic",
* },
* triggerConditions: {
* sloSliCondition: {
* critical: {
* sliThreshold: 99.5,
* },
* warning: {
* sliThreshold: 99.9,
* },
* },
* },
* notifications: [{
* notification: {
* connectionType: "Email",
* recipients: ["abc@example.com"],
* subject: "Monitor Alert: {{TriggerType}} on {{Name}}",
* timeZone: "PST",
* messageBody: "Triggered {{TriggerType}} Alert on {{Name}}: {{QueryURL}}",
* },
* runForTriggerTypes: [
* "Critical",
* "ResolvedCritical",
* ],
* }],
* playbook: "test playbook",
* });
* const tfSloMonitor2 = new sumologic.Monitor("tf_slo_monitor_2", {
* name: "SLO Burn rate monitor",
* type: "MonitorsLibraryMonitor",
* isDisabled: false,
* contentType: "Monitor",
* monitorType: "Slo",
* sloId: "0000000000000009",
* evaluationDelay: "5m",
* tags: {
* team: "monitoring",
* application: "sumologic",
* },
* triggerConditions: {
* sloBurnRateCondition: {
* critical: {
* burnRates: [{
* burnRateThreshold: 50,
* timeRange: "1d",
* }],
* },
* warning: {
* burnRates: [
* {
* burnRateThreshold: 30,
* timeRange: "3d",
* },
* {
* burnRateThreshold: 20,
* timeRange: "4d",
* },
* ],
* },
* },
* },
* });
* ```
*
* ## Example Logs Anomaly Monitor
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const tfExampleAnomalyMonitor = new sumologic.Monitor("tf_example_anomaly_monitor", {
* name: "Example Anomaly Monitor",
* description: "example anomaly monitor",
* type: "MonitorsLibraryMonitor",
* monitorType: "Logs",
* isDisabled: false,
* queries: [{
* rowId: "A",
* query: "_sourceCategory=api error | timeslice 5m | count by _sourceHost",
* }],
* triggerConditions: {
* logsAnomalyCondition: {
* field: "_count",
* anomalyDetectorType: "Cluster",
* critical: {
* sensitivity: 0.4,
* minAnomalyCount: 9,
* timeRange: "-3h",
* },
* },
* },
* notifications: [{
* notification: {
* connectionType: "Email",
* recipients: ["anomaly@example.com"],
* subject: "Monitor Alert: {{TriggerType}} on {{Name}}",
* timeZone: "PST",
* messageBody: "Triggered {{TriggerType}} Alert on {{Name}}: {{QueryURL}}",
* },
* runForTriggerTypes: [
* "Critical",
* "ResolvedCritical",
* ],
* }],
* });
* ```
*
* ## Example Metrics Anomaly Monitor
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const tfExampleMetricsAnomalyMonitor = new sumologic.Monitor("tf_example_metrics_anomaly_monitor", {
* name: "Example Metrics Anomaly Monitor",
* description: "example metrics anomaly monitor",
* type: "MonitorsLibraryMonitor",
* monitorType: "Metrics",
* isDisabled: false,
* queries: [{
* rowId: "A",
* query: "service=auth api=login metric=HTTP_5XX_Count | avg",
* }],
* triggerConditions: {
* metricsAnomalyCondition: {
* anomalyDetectorType: "Cluster",
* critical: {
* sensitivity: 0.4,
* minAnomalyCount: 9,
* timeRange: "-3h",
* },
* },
* },
* notifications: [{
* notification: {
* connectionType: "Email",
* recipients: ["anomaly@example.com"],
* subject: "Monitor Alert: {{TriggerType}} on {{Name}}",
* timeZone: "PST",
* messageBody: "Triggered {{TriggerType}} Alert on {{Name}}: {{QueryURL}}",
* },
* runForTriggerTypes: [
* "Critical",
* "ResolvedCritical",
* ],
* }],
* });
* ```
*
* ## Monitor Folders
*
* <<<<<<< HEAD
* NOTE: Monitor folders are considered a different resource from Library content folders.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const tfMonitorFolder1 = new sumologic.MonitorFolder("tf_monitor_folder_1", {
* name: "test folder",
* description: "a folder for monitors",
* });
* ```
* =======
* NOTE: Monitor folders are considered a different resource from Library content folders. See [sumologic.MonitorFolder][2] for more details.
* > > > > > > > v2.11.0
*
* ## The `triggerConditions` block
*
* A `triggerConditions` block configures conditions for sending notifications.
* ## The `triggers` block
*
* The `triggers` block is deprecated. Please use `triggerConditions` to specify notification conditions.
*
* Here's an example logs monitor that uses `triggers` to specify trigger conditions:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as sumologic from "@pulumi/sumologic";
*
* const tfLogsMonitor1 = new sumologic.Monitor("tf_logs_monitor_1", {
* name: "Terraform Logs Monitor",
* description: "tf logs monitor",
* type: "MonitorsLibraryMonitor",
* isDisabled: false,
* contentType: "Monitor",
* monitorType: "Logs",
* queries: [{
* rowId: "A",
* query: "_sourceCategory=event-action info",
* }],
* triggers: [
* {
* thresholdType: "GreaterThan",
* threshold: 40,
* timeRange: "15m",
* occurrenceType: "ResultCount",
* triggerSource: "AllResults",
* triggerType: "Critical",
* detectionMethod: "StaticCondition",
* },
* {
* thresholdType: "LessThanOrEqual",
* threshold: 40,
* timeRange: "15m",
* occurrenceType: "ResultCount",
* triggerSource: "AllResults",
* triggerType: "ResolvedCritical",
* detectionMethod: "StaticCondition",
* resolutionWindow: "5m",
* },
* ],
* notifications: [
* {
* notification: {
* connectionType: "Email",
* recipients: ["abc@example.com"],
* subject: "Monitor Alert: {{TriggerType}} on {{Name}}",
* timeZone: "PST",
* messageBody: "Triggered {{TriggerType}} Alert on {{Name}}: {{QueryURL}}",
* },
* runForTriggerTypes: [
* "Critical",
* "ResolvedCritical",
* ],
* },
* {
* notification: {
* connectionType: "Webhook",
* connectionId: "0000000000ABC123",
* },
* runForTriggerTypes: [
* "Critical",
* "ResolvedCritical",
* ],
* },
* ],
* });
* ```
*
* ## Import
*
* Monitors can be imported using the monitor ID, such as:
*
* hcl
*
* ```sh
* $ pulumi import sumologic:index/monitor:Monitor test 1234567890
* ```
*
* [1]: https://help.sumologic.com/?cid=10020
*
* [2]: monitor_folder.html.markdown
*
* [3]: https://help.sumologic.com/Visualizations-and-Alerts/Alerts/Monitors#configure-permissions-for-a-monitor
*/
export declare class Monitor extends pulumi.CustomResource {
/**
* Get an existing Monitor 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?: MonitorState, opts?: pulumi.CustomResourceOptions): Monitor;
/**
* Returns true if the given object is an instance of Monitor. 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 Monitor;
/**
* The display name when creating alerts. Monitor name will be used if `alertName` is not provided. All template variables can be used in `alertName` except `{{AlertName}}`, `{{AlertResponseURL}}`, `{{ResultsJson}}`, and `{{Playbook}}`.
*/
readonly alertName: pulumi.Output<string | undefined>;
/**
* The type of the content object. Valid value:
* - `Monitor`
*/
readonly contentType: pulumi.Output<string | undefined>;
readonly createdAt: pulumi.Output<string>;
readonly createdBy: pulumi.Output<string>;
/**
* The description of the monitor.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Evaluation delay as a string consists of the following elements:
* 1. `<number>`: number of time units,
* 2. `<time_unit>`: time unit; possible values are: `h` (hour), `m` (minute), `s` (second).
*
* Multiple pairs of `<number><time_unit>` may be provided. For example,
* `2m50s` means 2 minutes and 50 seconds.
*/
readonly evaluationDelay: pulumi.Output<string>;
/**
* Whether or not to group notifications for individual items that meet the trigger condition. Defaults to true.
*/
readonly groupNotifications: pulumi.Output<boolean | undefined>;
/**
* Whether or not the monitor is disabled. Disabled monitors will not run and will not generate or send notifications.
*/
readonly isDisabled: pulumi.Output<boolean | undefined>;
readonly isLocked: pulumi.Output<boolean>;
readonly isMutable: pulumi.Output<boolean>;
readonly isSystem: pulumi.Output<boolean>;
readonly modifiedAt: pulumi.Output<string>;
readonly modifiedBy: pulumi.Output<string>;
/**
* The type of monitor. Valid values:
* - `Logs`: A logs query monitor.
* - `Metrics`: A metrics query monitor.
* - `Slo`: A SLO based monitor.
*/
readonly monitorType: pulumi.Output<string>;
/**
* The name of the monitor. The name must be alphanumeric.
*/
readonly name: pulumi.Output<string>;
/**
* The set of fields to be used to group alerts and notifications for a monitor. The value of this field will be considered only when 'groupNotifications' is true. The fields with very high cardinality such as `_blockid`, `_raw`, `_messagetime`, `_receipttime`, and `_messageid` are not allowed for Alert Grouping.
*/
readonly notificationGroupFields: pulumi.Output<string[] | undefined>;
/**
* The notifications the monitor will send when the respective trigger condition is met.
*/
readonly notifications: pulumi.Output<outputs.MonitorNotification[] | undefined>;
/**
* `objPermission` construct represents a Permission Statement associated with this Monitor. A set of `objPermission` constructs can be specified under a Monitor. An `objPermission` construct can be used to control permissions Explicitly associated with a Monitor. But, it cannot be used to control permissions Inherited from a Parent / Ancestor. Default FGP would be still set to the Monitor upon creation (e.g. the creating user would have full permission), even if no `objPermission` construct is specified at a Monitor and the FGP feature is enabled at the account.
*/
readonly objPermissions: pulumi.Output<outputs.MonitorObjPermission[] | undefined>;
/**
* The ID of the Monitor Folder that contains this monitor. Defaults to the root folder.
*/
readonly parentId: pulumi.Output<string>;
/**
* Notes such as links and instruction to help you resolve alerts triggered by this monitor. {{Markdown}} supported. It will be enabled only if available for your organization. Please contact your Sumo Logic account team to learn more.
*/
readonly playbook: pulumi.Output<string | undefined>;
readonly postRequestMap: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* All queries from the monitor.
*/
readonly queries: pulumi.Output<outputs.MonitorQuery[] | undefined>;
/**
* Identifier of the SLO definition for the monitor. This is only applicable & required for Slo `monitorType`.
*/
readonly sloId: pulumi.Output<string | undefined>;
/**
* The current status for this monitor. Values are:
* - `Critical`
* - `Warning`
* - `MissingData`
* - `Normal`
* - `Disabled`
*/
readonly statuses: pulumi.Output<string[]>;
/**
* A map defining tag keys and tag values for the Monitor.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
readonly timeZone: pulumi.Output<string | undefined>;
/**
* Defines the conditions of when to send notifications. NOTE: `triggerConditions` supplants the `triggers` argument.
*/
readonly triggerConditions: pulumi.Output<outputs.MonitorTriggerConditions | undefined>;
/**
* Defines the conditions of when to send notifications.
*
* @deprecated The field `triggers` is deprecated and will be removed in a future release of the provider -- please use `triggerConditions` instead.
*/
readonly triggers: pulumi.Output<outputs.MonitorTrigger[] | undefined>;
/**
* The type of object model. Valid value:
* - `MonitorsLibraryMonitor`
*/
readonly type: pulumi.Output<string | undefined>;
readonly version: pulumi.Output<number>;
/**
* Create a Monitor 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.
*/
constructor(name: string, args: MonitorArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Monitor resources.
*/
export interface MonitorState {
/**
* The display name when creating alerts. Monitor name will be used if `alertName` is not provided. All template variables can be used in `alertName` except `{{AlertName}}`, `{{AlertResponseURL}}`, `{{ResultsJson}}`, and `{{Playbook}}`.
*/
alertName?: pulumi.Input<string>;
/**
* The type of the content object. Valid value:
* - `Monitor`
*/
contentType?: pulumi.Input<string>;
createdAt?: pulumi.Input<string>;
createdBy?: pulumi.Input<string>;
/**
* The description of the monitor.
*/
description?: pulumi.Input<string>;
/**
* Evaluation delay as a string consists of the following elements:
* 1. `<number>`: number of time units,
* 2. `<time_unit>`: time unit; possible values are: `h` (hour), `m` (minute), `s` (second).
*
* Multiple pairs of `<number><time_unit>` may be provided. For example,
* `2m50s` means 2 minutes and 50 seconds.
*/
evaluationDelay?: pulumi.Input<string>;
/**
* Whether or not to group notifications for individual items that meet the trigger condition. Defaults to true.
*/
groupNotifications?: pulumi.Input<boolean>;
/**
* Whether or not the monitor is disabled. Disabled monitors will not run and will not generate or send notifications.
*/
isDisabled?: pulumi.Input<boolean>;
isLocked?: pulumi.Input<boolean>;
isMutable?: pulumi.Input<boolean>;
isSystem?: pulumi.Input<boolean>;
modifiedAt?: pulumi.Input<string>;
modifiedBy?: pulumi.Input<string>;
/**
* The type of monitor. Valid values:
* - `Logs`: A logs query monitor.
* - `Metrics`: A metrics query monitor.
* - `Slo`: A SLO based monitor.
*/
monitorType?: pulumi.Input<string>;
/**
* The name of the monitor. The name must be alphanumeric.
*/
name?: pulumi.Input<string>;
/**
* The set of fields to be used to group alerts and notifications for a monitor. The value of this field will be considered only when 'groupNotifications' is true. The fields with very high cardinality such as `_blockid`, `_raw`, `_messagetime`, `_receipttime`, and `_messageid` are not allowed for Alert Grouping.
*/
notificationGroupFields?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The notifications the monitor will send when the respective trigger condition is met.
*/
notifications?: pulumi.Input<pulumi.Input<inputs.MonitorNotification>[]>;
/**
* `objPermission` construct represents a Permission Statement associated with this Monitor. A set of `objPermission` constructs can be specified under a Monitor. An `objPermission` construct can be used to control permissions Explicitly associated with a Monitor. But, it cannot be used to control permissions Inherited from a Parent / Ancestor. Default FGP would be still set to the Monitor upon creation (e.g. the creating user would have full permission), even if no `objPermission` construct is specified at a Monitor and the FGP feature is enabled at the account.
*/
objPermissions?: pulumi.Input<pulumi.Input<inputs.MonitorObjPermission>[]>;
/**
* The ID of the Monitor Folder that contains this monitor. Defaults to the root folder.
*/
parentId?: pulumi.Input<string>;
/**
* Notes such as links and instruction to help you resolve alerts triggered by this monitor. {{Markdown}} supported. It will be enabled only if available for your organization. Please contact your Sumo Logic account team to learn more.
*/
playbook?: pulumi.Input<string>;
postRequestMap?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* All queries from the monitor.
*/
queries?: pulumi.Input<pulumi.Input<inputs.MonitorQuery>[]>;
/**
* Identifier of the SLO definition for the monitor. This is only applicable & required for Slo `monitorType`.
*/
sloId?: pulumi.Input<string>;
/**
* The current status for this monitor. Values are:
* - `Critical`
* - `Warning`
* - `MissingData`
* - `Normal`
* - `Disabled`
*/
statuses?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A map defining tag keys and tag values for the Monitor.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
timeZone?: pulumi.Input<string>;
/**
* Defines the conditions of when to send notifications. NOTE: `triggerConditions` supplants the `triggers` argument.
*/
triggerConditions?: pulumi.Input<inputs.MonitorTriggerConditions>;
/**
* Defines the conditions of when to send notifications.
*
* @deprecated The field `triggers` is deprecated and will be removed in a future release of the provider -- please use `triggerConditions` instead.
*/
triggers?: pulumi.Input<pulumi.Input<inputs.MonitorTrigger>[]>;
/**
* The type of object model. Valid value:
* - `MonitorsLibraryMonitor`
*/
type?: pulumi.Input<string>;
version?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a Monitor resource.
*/
export interface MonitorArgs {
/**
* The display name when creating alerts. Monitor name will be used if `alertName` is not provided. All template variables can be used in `alertName` except `{{AlertName}}`, `{{AlertResponseURL}}`, `{{ResultsJson}}`, and `{{Playbook}}`.
*/
alertName?: pulumi.Input<string>;
/**
* The type of the content object. Valid value:
* - `Monitor`
*/
contentType?: pulumi.Input<string>;
createdAt?: pulumi.Input<string>;
createdBy?: pulumi.Input<string>;
/**
* The description of the monitor.
*/
description?: pulumi.Input<string>;
/**
* Evaluation delay as a string consists of the following elements:
* 1. `<number>`: number of time units,
* 2. `<time_unit>`: time unit; possible values are: `h` (hour), `m` (minute), `s` (second).
*
* Multiple pairs of `<number><time_unit>` may be provided. For example,
* `2m50s` means 2 minutes and 50 seconds.
*/
evaluationDelay?: pulumi.Input<string>;
/**
* Whether or not to group notifications for individual items that meet the trigger condition. Defaults to true.
*/
groupNotifications?: pulumi.Input<boolean>;
/**
* Whether or not the monitor is disabled. Disabled monitors will not run and will not generate or send notifications.
*/
isDisabled?: pulumi.Input<boolean>;
isLocked?: pulumi.Input<boolean>;
isMutable?: pulumi.Input<boolean>;
isSystem?: pulumi.Input<boolean>;
modifiedAt?: pulumi.Input<string>;
modifiedBy?: pulumi.Input<string>;
/**
* The type of monitor. Valid values:
* - `Logs`: A logs query monitor.
* - `Metrics`: A metrics query monitor.
* - `Slo`: A SLO based monitor.
*/
monitorType: pulumi.Input<string>;
/**
* The name of the monitor. The name must be alphanumeric.
*/
name?: pulumi.Input<string>;
/**
* The set of fields to be used to group alerts and notifications for a monitor. The value of this field will be considered only when 'groupNotifications' is true. The fields with very high cardinality such as `_blockid`, `_raw`, `_messagetime`, `_receipttime`, and `_messageid` are not allowed for Alert Grouping.
*/
notificationGroupFields?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The notifications the monitor will send when the respective trigger condition is met.
*/
notifications?: pulumi.Input<pulumi.Input<inputs.MonitorNotification>[]>;
/**
* `objPermission` construct represents a Permission Statement associated with this Monitor. A set of `objPermission` constructs can be specified under a Monitor. An `objPermission` construct can be used to control permissions Explicitly associated with a Monitor. But, it cannot be used to control permissions Inherited from a Parent / Ancestor. Default FGP would be still set to the Monitor upon creation (e.g. the creating user would have full permission), even if no `objPermission` construct is specified at a Monitor and the FGP feature is enabled at the account.
*/
objPermissions?: pulumi.Input<pulumi.Input<inputs.MonitorObjPermission>[]>;
/**
* The ID of the Monitor Folder that contains this monitor. Defaults to the root folder.
*/
parentId?: pulumi.Input<string>;
/**
* Notes such as links and instruction to help you resolve alerts triggered by this monitor. {{Markdown}} supported. It will be enabled only if available for your organization. Please contact your Sumo Logic account team to learn more.
*/
playbook?: pulumi.Input<string>;
postRequestMap?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* All queries from the monitor.
*/
queries?: pulumi.Input<pulumi.Input<inputs.MonitorQuery>[]>;
/**
* Identifier of the SLO definition for the monitor. This is only applicable & required for Slo `monitorType`.
*/
sloId?: pulumi.Input<string>;
/**
* A map defining tag keys and tag values for the Monitor.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
timeZone?: pulumi.Input<string>;
/**
* Defines the conditions of when to send notifications. NOTE: `triggerConditions` supplants the `triggers` argument.
*/
triggerConditions?: pulumi.Input<inputs.MonitorTriggerConditions>;
/**
* Defines the conditions of when to send notifications.
*
* @deprecated The field `triggers` is deprecated and will be removed in a future release of the provider -- please use `triggerConditions` instead.
*/
triggers?: pulumi.Input<pulumi.Input<inputs.MonitorTrigger>[]>;
/**
* The type of object model. Valid value:
* - `MonitorsLibraryMonitor`
*/
type?: pulumi.Input<string>;
version?: pulumi.Input<number>;
}