UNPKG

@pulumi/sumologic

Version:

A Pulumi package for creating and managing sumologic cloud resources.

592 lines (591 loc) 25.6 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Provides a [Sumologic Dashboard (New)][1]. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as sumologic from "@pulumi/sumologic"; * * const personalFolder = sumologic.getPersonalFolder({}); * const api_dashboard = new sumologic.Dashboard("api-dashboard", { * title: "Api Health Dashboard", * description: "Demo dashboard description", * folderId: personalFolder.then(personalFolder => personalFolder.id), * refreshInterval: 120, * theme: "Dark", * timeRange: { * beginBoundedTimeRange: { * from: { * literalTimeRange: { * rangeName: "today", * }, * }, * }, * }, * topologyLabelMap: { * datas: [ * { * label: "cluster", * values: ["api-prod"], * }, * { * label: "namespace", * values: ["default"], * }, * ], * }, * domain: "app", * panels: [ * { * textPanel: { * key: "text-panel-01", * title: "Api Health", * visualSettings: JSON.stringify({ * text: { * verticalAlignment: "top", * horizontalAlignment: "left", * fontSize: 12, * }, * }), * keepVisualSettingsConsistentWithParent: true, * text: `## Api Health Monitoring * * Use this dashboard to monitor API service health. It contains following panels: * * 1. API errors: Errors in last 12 hours * 3. API 5xx: Count of 5xx response * 3. CPU utilization: CPU utilization in last 60 mins * `, * }, * }, * { * sumoSearchPanel: { * key: "search-panel-01", * title: "Api Errors by Host", * description: "Errors in api service since last 12 hours", * visualSettings: JSON.stringify({ * general: { * mode: "timeSeries", * type: "area", * displayType: "stacked", * markerSize: 5, * lineDashType: "solid", * markerType: "square", * lineThickness: 1, * }, * title: { * fontSize: 14, * }, * legend: { * enabled: true, * verticalAlign: "bottom", * fontSize: 12, * maxHeight: 50, * showAsTable: false, * wrap: true, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [{ * queryString: "_sourceCategory=api error | timeslice 1h | count by _timeslice, _sourceHost | transpose row _timeslice column _sourceHost", * queryType: "Logs", * queryKey: "A", * }], * timeRange: { * beginBoundedTimeRange: { * from: { * relativeTimeRange: { * relativeTime: "-12h", * }, * }, * }, * }, * }, * }, * { * sumoSearchPanel: { * key: "metrics-panel-01", * title: "Api 5xx Response Count", * description: "Count of 5xx response from api service", * visualSettings: JSON.stringify({ * general: { * mode: "distribution", * type: "pie", * displayType: "default", * fillOpacity: 1, * startAngle: 270, * innerRadius: "40%", * maxNumOfSlices: 10, * aggregationType: "sum", * }, * title: { * fontSize: 14, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [{ * queryString: "_sourceCategory=api metric=Api-5xx", * queryType: "Metrics", * queryKey: "A", * metricsQueryMode: "Advanced", * }], * timeRange: { * beginBoundedTimeRange: { * from: { * literalTimeRange: { * rangeName: "today", * }, * }, * }, * }, * }, * }, * { * sumoSearchPanel: { * key: "metrics-panel-02", * title: "CPU Utilization", * description: "CPU utilization in api service", * visualSettings: JSON.stringify({ * general: { * mode: "timeSeries", * type: "line", * displayType: "smooth", * markerSize: 5, * lineDashType: "dashDot", * markerType: "none", * lineThickness: 1, * }, * title: { * fontSize: 14, * }, * }), * keepVisualSettingsConsistentWithParent: true, * queries: [ * { * queryString: "metric=Proc_CPU nite-api-1", * queryType: "Metrics", * queryKey: "A", * metricsQueryMode: "Basic", * metricsQueryData: { * metric: "Proc_CPU", * filters: [{ * key: "_sourcehost", * negation: false, * value: "nite-api-1", * }], * aggregationType: "None", * }, * }, * { * queryString: "metric=Proc_CPU nite-api-2", * queryType: "Metrics", * queryKey: "B", * metricsQueryMode: "Basic", * metricsQueryData: { * metric: "Proc_CPU", * filters: [{ * key: "_sourcehost", * negation: false, * value: "nite-api-2", * }], * aggregationType: "None", * }, * }, * ], * timeRange: { * beginBoundedTimeRange: { * from: { * relativeTimeRange: { * relativeTime: "-1h", * }, * }, * }, * }, * }, * }, * ], * layout: { * grid: { * layoutStructures: [ * { * key: "text-panel-01", * structure: "{\"height\":5,\"width\":24,\"x\":0,\"y\":0}", * }, * { * key: "search-panel-01", * structure: "{\"height\":10,\"width\":12,\"x\":0,\"y\":5}", * }, * { * key: "metrics-panel-01", * structure: "{\"height\":10,\"width\":12,\"x\":12,\"y\":5}", * }, * { * key: "metrics-panel-02", * structure: "{\"height\":10,\"width\":24,\"x\":0,\"y\":25}", * }, * ], * }, * }, * variables: [{ * name: "_sourceHost", * displayName: "Source Host", * defaultValue: "nite-api-1", * sourceDefinition: { * csvVariableSourceDefinition: { * values: "nite-api-1,nite-api-2", * }, * }, * allowMultiSelect: true, * includeAllOption: true, * hideFromUi: false, * }], * }); * ``` * * ## Attributes reference * * In addition to all arguments above, the following attributes are exported: * * - `id` - The ID of the dashboard. * * ### Schema for `topologyLabelMap` * - `data` - (Block List, Required) A list of blocks containing label and it's values. * - - `label` - (Required) The name of the topology label. * - - `values` - (Required) The values for the topology label. * * ### Schema for `timeRange` * - `completeLiteralTimeRange` - (Block List, Max: 1, Optional) Literal time range. See * completeLiteralTimeRange schema for details. * - `beginBoundedTimeRange` - (Block List, Max: 1, Optional) Bounded time range. See * beginBoundedTimeRange schema schema for details. * schema for details. * * ### Schema for `completeLiteralTimeRange` * - `rangeName` - (Required) Name of complete literal time range. One of `today`, `yesterday`, `previousWeek`, `previousMonth`. * * ### Schema for `beginBoundedTimeRange` * - `from` - (Block List, Max: 1, Required) Start boundary of bounded time range. See * timeRangeBoundary schema for details. * - `to` - (Block List, Max: 1, Optional) End boundary of bounded time range. See * timeRangeBoundary schema for details. * * ### Schema for `timeRangeBoundary` * - `epochTimeRange` - (Block List, Optional) Time since the epoch. * - `epochMillis` - (Required) Time as a number of milliseconds since the epoch. * * - `iso8601TimeRange` - (Block List, Optional) Time in ISO 8601 format. * - `iso8601Time` - (Required) Time as a string in ISO 8601 format. * * - `relativeTimeRange` - (Block List, Optional) Time in relative format. * - `relativeTime` - (Required) Relative time as a string consists of following elements: * 1. `-` (optional): minus sign indicates time in the past, * 2. `<number>`: number of time units, * 3. `<time_unit>`: time unit; possible values are: `w` (week), `d` (day), `h` (hour), `m` (minute), `s` (second). * * Multiple pairs of `<number><time_unit>` may be provided, and they may be in any order. For example, * `-2w5d3h` points to the moment in time 2 weeks, 5 days and 3 hours ago. * * - `literalTimeRange` - (Block List, Optional) Time in literal format. * - `rangeName` - (Required) One of `now`, `second`, `minute`, `hour`, `day`, `today`, `week`, `month`, `year`. * * ### Schema for `panel` * - `textPanel` - (Block List, Max: 1, Optional) A text panel. See textPanel schema for details. * - `sumoSearchPanel` - (Block List, Max: 1, Optional) A search panel. See sumoSearchPanel schema * for details. * * ### Schema for `textPanel` * - `key` - (Required) Key for the panel. Used to create searches for the queries in the panel and configure the layout * of the panel in the dashboard. * - `title` - (Optional) Title of the panel. * - `visualSettings` - (Optional) Visual settings of the panel. * - `keepVisualSettingsConsistentWithParent` - (Optional) Keeps the visual settings, like series colors, consistent * with the settings of the parent panel. * - `text` - (Required) Text to display in the panel. * * ### Schema for `sumoSearchPanel` * - `key` - (Required) Key for the panel. Used to create searches for the queries in the panel and configure the layout * of the panel in the dashboard. * - `title` - (Optional) Title of the panel. * - `visualSettings` - (Optional) Visual settings of the panel. * - `keepVisualSettingsConsistentWithParent` - (Optional) Keeps the visual settings, like series colors, consistent * with the settings of the parent panel. * - `query` - (Block List, Required) A list of queries for the panel. Can be log or metric query. See * query schema for details. * - `description` - (Optional) Description of the panel. * - `timeRange` - (Block List, Max: 1, Optional) Time range of the panel. See timeRange schema * for details. * - `linkedDashboard` - (Block List, Optional) A list of linked dashboards. See * linkedDashboard schema for details. * * ### Schema for `query` * - `queryString` - (Required) The metrics or logs query. * - `queryType` - (Required) The type of the query. One of `Metrics` or `Logs`. * - `queryKey` - (Required) The key for metric or log query. Used as an identifier for queries. * - `metricQueryMode` - (Optional) _Should only be specified for metric query_. The mode of the metric query. * One of `Basic` or `Advanced`. * - `metricQueryData` - (Optional) _Should only be specified for metric query_. Data format for the metric query. See * metricQueryData schema for details. * - `parseMode` - (Optional) This field only applies for queryType of `Logs` but other query types may be supported in the future. * Define the parsing mode to scan the JSON format log messages. Possible values are: * 1. `Auto` * 2. `Manual` * In AutoParse mode, the system automatically figures out fields to parse based on the search query. * While in the Manual mode, no fields are parsed out automatically. * For more information see [Dynamic Parsing](https://help.sumologic.com/?cid=0011). * - `timeSource` - This field only applies for queryType of `Logs` but other query types may be supported in the future. * Define the time source of this query. Possible values are `Message`, and `Receipt`. * `Message` will use the timeStamp on the message, `Receipt` will use the timestamp it was received by Sumo. * - `transient` - (Optional) This field only applies for queryType of `Metrics` but other query types may be supported in the future. Determines if the row should be returned in the response. Can be used in conjunction with a join, if only the result of the join is needed, and not the intermediate rows. Setting `transient` to `true` wherever the intermediate results aren't required speeds up the computation and reduces the amount of data transferred over the network. * - `outputCardinalityLimit` - (Optional) This field only applies for queryType of `Metrics` but other query types may be supported in the future. Specifies the output cardinality limitations for the query, which is the maximum number of timeseries returned in the result. * * ### Schema for `metricQueryData` * - `metric` - (Required) The metric of the query. * - `aggregationType` - (Optional) The type of aggregation. One of `Count`, `Minimum`, `Maximum`, `Sum`, `Average`, `None`. * - `groupBy` - The field to group the results by. * - `filter` - (Block List, Required) A list of filters for the metrics query. * - `key` - (Required) The key of the metrics filter. * - `value` - (Required) The value of the metrics filter. * - `negation` - (Optional) Whether or not the metrics filter is negated. * - `operator` - (Block List, Optional) A list of operator data for the metrics query. * * ### Schema for `operator` * - `operatorName` - (Required) The name of the metrics operator. * - `parameter` - (Block List, Required) A list of operator parameters for the operator data. * - `key` - (Required) The key of the operator parameter. * - `value` - (Required) The value of the operator parameter. * * ### Schema for `linkedDashboard` * - `id` - (Required) Identifier of the linked dashboard. * - `relativePath` - (Optional) Relative path of the linked dashboard to the dashboard of the linking panel. * - `includeTimeRange` - (Optional) Include time range from the current dashboard to the linked dashboard. _Defaults to true_. * - `includeVariables` - (Optional) Include variables from the current dashboard to the linked dashboard. _Defaults to true_. * * ### Schema for `layout` * - `grid` - (Block List, Max: 1, Optional) Panel layout for the dashboard. * * ### Schema for `grid` * - `layoutStructure` - (Block List, Required) Layout structure for the panels in the dashboard. * - `key` - (Required) The identifier of the panel that this structure applies to. It's same as `panel.key`. * - `structure` - (Required) The structure of the panel. * * ### Schema for `variable` * - `name` - (Required) Name of the variable. The variable name is case-insensitive. * - `displayName` - (Optional) Display name of the variable shown in the UI. If this field is empty, the name field will be used. * - `defaultValue` - (Optional) Default value of the variable. * - `sourceDefinition` - (Required) Source definition for variable values. See * sourceDefinition schema for details. * - `allowMultiSelect` - (Optional) Allow multiple selections in the values dropdown. * - `includeAllOption` - (Optional) Include an "All" option at the top of the variable's values dropdown. _Defaults to true._ * - `hideFromUi` - (Optional) Hide the variable in the dashboard UI. * * ### Schema for `sourceDefinition` * - `logQueryVariableSourceDefinition` - (Optional) Variable values from a log query. * - `query` - (Required) A log query. * - `field` - (Required) A field in log query to populate the variable values * - `metadataVariableSourceDefinition` - (Optional) Variable values from a metric query. * - `filter` - (Required) Filter to search the catalog. * - `key` - (Required) Return the values for this given key. * - `csvVariableSourceDefinition` - (Optional) Variable values in csv format. * - `values` - (Required) A comma separated values for the variable. * * ## Import * * Dashboard can be imported using the dashboard id, e.g.: * * hcl * * ```sh * $ pulumi import sumologic:index/dashboard:Dashboard example-dashboard q0IKwAK5t2qRI4sgiANwnS87k5S4twN2sCpTuZFSsz6ZmbENPsG7PnpqZygc * ``` * * [1]: https://help.sumologic.com/Visualizations-and-Alerts/Dashboard_(New) */ export declare class Dashboard extends pulumi.CustomResource { /** * Get an existing Dashboard 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?: DashboardState, opts?: pulumi.CustomResourceOptions): Dashboard; /** * Returns true if the given object is an instance of Dashboard. 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 Dashboard; readonly coloringRules: pulumi.Output<outputs.DashboardColoringRule[] | undefined>; /** * Description of the dashboard. */ readonly description: pulumi.Output<string | undefined>; /** * Domain of the dashboard. If set denotes that the dashboard concerns a given domain. */ readonly domain: pulumi.Output<string | undefined>; /** * The identifier of the folder to save the dashboard in. By default it is saved in your * personal folder. */ readonly folderId: pulumi.Output<string | undefined>; /** * Layout of the dashboard. See layout schema for details. */ readonly layout: pulumi.Output<outputs.DashboardLayout | undefined>; /** * A list of panels in the dashboard. See panel schema for details. */ readonly panels: pulumi.Output<outputs.DashboardPanel[] | undefined>; /** * Interval of time (in seconds) to automatically refresh the dashboard. Valid values are 120,300,900,1800,3600,7200,86400. */ readonly refreshInterval: pulumi.Output<number | undefined>; /** * Theme of the dashboard. */ readonly theme: pulumi.Output<string | undefined>; /** * Time range of the dashboard. See time range schema * for details. */ readonly timeRange: pulumi.Output<outputs.DashboardTimeRange>; /** * Title of the dashboard. */ readonly title: pulumi.Output<string>; /** * Topology labels for the dashboard. See * topology label map schema * for details. */ readonly topologyLabelMap: pulumi.Output<outputs.DashboardTopologyLabelMap | undefined>; /** * A list of variables for the dashboard. See variable schema * for details. */ readonly variables: pulumi.Output<outputs.DashboardVariable[] | undefined>; /** * Create a Dashboard 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: DashboardArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Dashboard resources. */ export interface DashboardState { coloringRules?: pulumi.Input<pulumi.Input<inputs.DashboardColoringRule>[]>; /** * Description of the dashboard. */ description?: pulumi.Input<string>; /** * Domain of the dashboard. If set denotes that the dashboard concerns a given domain. */ domain?: pulumi.Input<string>; /** * The identifier of the folder to save the dashboard in. By default it is saved in your * personal folder. */ folderId?: pulumi.Input<string>; /** * Layout of the dashboard. See layout schema for details. */ layout?: pulumi.Input<inputs.DashboardLayout>; /** * A list of panels in the dashboard. See panel schema for details. */ panels?: pulumi.Input<pulumi.Input<inputs.DashboardPanel>[]>; /** * Interval of time (in seconds) to automatically refresh the dashboard. Valid values are 120,300,900,1800,3600,7200,86400. */ refreshInterval?: pulumi.Input<number>; /** * Theme of the dashboard. */ theme?: pulumi.Input<string>; /** * Time range of the dashboard. See time range schema * for details. */ timeRange?: pulumi.Input<inputs.DashboardTimeRange>; /** * Title of the dashboard. */ title?: pulumi.Input<string>; /** * Topology labels for the dashboard. See * topology label map schema * for details. */ topologyLabelMap?: pulumi.Input<inputs.DashboardTopologyLabelMap>; /** * A list of variables for the dashboard. See variable schema * for details. */ variables?: pulumi.Input<pulumi.Input<inputs.DashboardVariable>[]>; } /** * The set of arguments for constructing a Dashboard resource. */ export interface DashboardArgs { coloringRules?: pulumi.Input<pulumi.Input<inputs.DashboardColoringRule>[]>; /** * Description of the dashboard. */ description?: pulumi.Input<string>; /** * Domain of the dashboard. If set denotes that the dashboard concerns a given domain. */ domain?: pulumi.Input<string>; /** * The identifier of the folder to save the dashboard in. By default it is saved in your * personal folder. */ folderId?: pulumi.Input<string>; /** * Layout of the dashboard. See layout schema for details. */ layout?: pulumi.Input<inputs.DashboardLayout>; /** * A list of panels in the dashboard. See panel schema for details. */ panels?: pulumi.Input<pulumi.Input<inputs.DashboardPanel>[]>; /** * Interval of time (in seconds) to automatically refresh the dashboard. Valid values are 120,300,900,1800,3600,7200,86400. */ refreshInterval?: pulumi.Input<number>; /** * Theme of the dashboard. */ theme?: pulumi.Input<string>; /** * Time range of the dashboard. See time range schema * for details. */ timeRange: pulumi.Input<inputs.DashboardTimeRange>; /** * Title of the dashboard. */ title: pulumi.Input<string>; /** * Topology labels for the dashboard. See * topology label map schema * for details. */ topologyLabelMap?: pulumi.Input<inputs.DashboardTopologyLabelMap>; /** * A list of variables for the dashboard. See variable schema * for details. */ variables?: pulumi.Input<pulumi.Input<inputs.DashboardVariable>[]>; }