grafana.assert.Thresholds
Manages Knowledge Graph Thresholds configuration (request, resource, health) via bulk endpoints.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";
const basic = new grafana.assert.Thresholds("basic", {
requestThresholds: [{
entityName: "payment-service",
assertionName: "ErrorRatioBreach",
requestType: "inbound",
requestContext: "/charge",
value: 0.01,
}],
resourceThresholds: [{
assertionName: "Saturation",
resourceType: "container",
containerName: "worker",
source: "metrics",
severity: "warning",
value: 75,
}],
healthThresholds: [{
assertionName: "ServiceDown",
expression: "up < 1",
entityType: "Service",
}],
});
import pulumi
import pulumiverse_grafana as grafana
basic = grafana.assert_.Thresholds("basic",
request_thresholds=[{
"entity_name": "payment-service",
"assertion_name": "ErrorRatioBreach",
"request_type": "inbound",
"request_context": "/charge",
"value": 0.01,
}],
resource_thresholds=[{
"assertion_name": "Saturation",
"resource_type": "container",
"container_name": "worker",
"source": "metrics",
"severity": "warning",
"value": 75,
}],
health_thresholds=[{
"assertion_name": "ServiceDown",
"expression": "up < 1",
"entity_type": "Service",
}])
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/v2/go/grafana/assert"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := assert.NewThresholds(ctx, "basic", &assert.ThresholdsArgs{
RequestThresholds: assert.ThresholdsRequestThresholdArray{
&assert.ThresholdsRequestThresholdArgs{
EntityName: pulumi.String("payment-service"),
AssertionName: pulumi.String("ErrorRatioBreach"),
RequestType: pulumi.String("inbound"),
RequestContext: pulumi.String("/charge"),
Value: pulumi.Float64(0.01),
},
},
ResourceThresholds: assert.ThresholdsResourceThresholdArray{
&assert.ThresholdsResourceThresholdArgs{
AssertionName: pulumi.String("Saturation"),
ResourceType: pulumi.String("container"),
ContainerName: pulumi.String("worker"),
Source: pulumi.String("metrics"),
Severity: pulumi.String("warning"),
Value: pulumi.Float64(75),
},
},
HealthThresholds: assert.ThresholdsHealthThresholdArray{
&assert.ThresholdsHealthThresholdArgs{
AssertionName: pulumi.String("ServiceDown"),
Expression: pulumi.String("up < 1"),
EntityType: pulumi.String("Service"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Pulumiverse.Grafana;
return await Deployment.RunAsync(() =>
{
var basic = new Grafana.Assert.Thresholds("basic", new()
{
RequestThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsRequestThresholdArgs
{
EntityName = "payment-service",
AssertionName = "ErrorRatioBreach",
RequestType = "inbound",
RequestContext = "/charge",
Value = 0.01,
},
},
ResourceThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsResourceThresholdArgs
{
AssertionName = "Saturation",
ResourceType = "container",
ContainerName = "worker",
Source = "metrics",
Severity = "warning",
Value = 75,
},
},
HealthThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsHealthThresholdArgs
{
AssertionName = "ServiceDown",
Expression = "up < 1",
EntityType = "Service",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.assert.Thresholds;
import com.pulumi.grafana.assert.ThresholdsArgs;
import com.pulumi.grafana.assert.inputs.ThresholdsRequestThresholdArgs;
import com.pulumi.grafana.assert.inputs.ThresholdsResourceThresholdArgs;
import com.pulumi.grafana.assert.inputs.ThresholdsHealthThresholdArgs;
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) {
var basic = new Thresholds("basic", ThresholdsArgs.builder()
.requestThresholds(ThresholdsRequestThresholdArgs.builder()
.entityName("payment-service")
.assertionName("ErrorRatioBreach")
.requestType("inbound")
.requestContext("/charge")
.value(0.01)
.build())
.resourceThresholds(ThresholdsResourceThresholdArgs.builder()
.assertionName("Saturation")
.resourceType("container")
.containerName("worker")
.source("metrics")
.severity("warning")
.value(75.0)
.build())
.healthThresholds(ThresholdsHealthThresholdArgs.builder()
.assertionName("ServiceDown")
.expression("up < 1")
.entityType("Service")
.build())
.build());
}
}
resources:
basic:
type: grafana:assert:Thresholds
properties:
requestThresholds:
- entityName: payment-service
assertionName: ErrorRatioBreach
requestType: inbound
requestContext: /charge
value: 0.01
resourceThresholds:
- assertionName: Saturation
resourceType: container
containerName: worker
source: metrics
severity: warning
value: 75
healthThresholds:
- assertionName: ServiceDown
expression: up < 1
entityType: Service
Create Thresholds Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Thresholds(name: string, args?: ThresholdsArgs, opts?: CustomResourceOptions);@overload
def Thresholds(resource_name: str,
args: Optional[ThresholdsArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Thresholds(resource_name: str,
opts: Optional[ResourceOptions] = None,
health_thresholds: Optional[Sequence[ThresholdsHealthThresholdArgs]] = None,
request_thresholds: Optional[Sequence[ThresholdsRequestThresholdArgs]] = None,
resource_thresholds: Optional[Sequence[ThresholdsResourceThresholdArgs]] = None)func NewThresholds(ctx *Context, name string, args *ThresholdsArgs, opts ...ResourceOption) (*Thresholds, error)public Thresholds(string name, ThresholdsArgs? args = null, CustomResourceOptions? opts = null)
public Thresholds(String name, ThresholdsArgs args)
public Thresholds(String name, ThresholdsArgs args, CustomResourceOptions options)
type: grafana:assert:Thresholds
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ThresholdsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ThresholdsArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ThresholdsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ThresholdsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ThresholdsArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var thresholdsResource = new Grafana.Assert.Thresholds("thresholdsResource", new()
{
HealthThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsHealthThresholdArgs
{
AssertionName = "string",
EntityType = "string",
Expression = "string",
AlertCategory = "string",
},
},
RequestThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsRequestThresholdArgs
{
AssertionName = "string",
EntityName = "string",
RequestContext = "string",
RequestType = "string",
Value = 0,
},
},
ResourceThresholds = new[]
{
new Grafana.Assert.Inputs.ThresholdsResourceThresholdArgs
{
AssertionName = "string",
ContainerName = "string",
ResourceType = "string",
Severity = "string",
Source = "string",
Value = 0,
},
},
});
example, err := assert.NewThresholds(ctx, "thresholdsResource", &assert.ThresholdsArgs{
HealthThresholds: assert.ThresholdsHealthThresholdArray{
&assert.ThresholdsHealthThresholdArgs{
AssertionName: pulumi.String("string"),
EntityType: pulumi.String("string"),
Expression: pulumi.String("string"),
AlertCategory: pulumi.String("string"),
},
},
RequestThresholds: assert.ThresholdsRequestThresholdArray{
&assert.ThresholdsRequestThresholdArgs{
AssertionName: pulumi.String("string"),
EntityName: pulumi.String("string"),
RequestContext: pulumi.String("string"),
RequestType: pulumi.String("string"),
Value: pulumi.Float64(0),
},
},
ResourceThresholds: assert.ThresholdsResourceThresholdArray{
&assert.ThresholdsResourceThresholdArgs{
AssertionName: pulumi.String("string"),
ContainerName: pulumi.String("string"),
ResourceType: pulumi.String("string"),
Severity: pulumi.String("string"),
Source: pulumi.String("string"),
Value: pulumi.Float64(0),
},
},
})
var thresholdsResource = new Thresholds("thresholdsResource", ThresholdsArgs.builder()
.healthThresholds(ThresholdsHealthThresholdArgs.builder()
.assertionName("string")
.entityType("string")
.expression("string")
.alertCategory("string")
.build())
.requestThresholds(ThresholdsRequestThresholdArgs.builder()
.assertionName("string")
.entityName("string")
.requestContext("string")
.requestType("string")
.value(0.0)
.build())
.resourceThresholds(ThresholdsResourceThresholdArgs.builder()
.assertionName("string")
.containerName("string")
.resourceType("string")
.severity("string")
.source("string")
.value(0.0)
.build())
.build());
thresholds_resource = grafana.assert_.Thresholds("thresholdsResource",
health_thresholds=[{
"assertion_name": "string",
"entity_type": "string",
"expression": "string",
"alert_category": "string",
}],
request_thresholds=[{
"assertion_name": "string",
"entity_name": "string",
"request_context": "string",
"request_type": "string",
"value": 0,
}],
resource_thresholds=[{
"assertion_name": "string",
"container_name": "string",
"resource_type": "string",
"severity": "string",
"source": "string",
"value": 0,
}])
const thresholdsResource = new grafana.assert.Thresholds("thresholdsResource", {
healthThresholds: [{
assertionName: "string",
entityType: "string",
expression: "string",
alertCategory: "string",
}],
requestThresholds: [{
assertionName: "string",
entityName: "string",
requestContext: "string",
requestType: "string",
value: 0,
}],
resourceThresholds: [{
assertionName: "string",
containerName: "string",
resourceType: "string",
severity: "string",
source: "string",
value: 0,
}],
});
type: grafana:assert:Thresholds
properties:
healthThresholds:
- alertCategory: string
assertionName: string
entityType: string
expression: string
requestThresholds:
- assertionName: string
entityName: string
requestContext: string
requestType: string
value: 0
resourceThresholds:
- assertionName: string
containerName: string
resourceType: string
severity: string
source: string
value: 0
Thresholds Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Thresholds resource accepts the following input properties:
- Health
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Health Threshold> - List of health thresholds.
- Request
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Request Threshold> - List of request thresholds.
- Resource
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Resource Threshold> - List of resource thresholds.
- Health
Thresholds []ThresholdsHealth Threshold Args - List of health thresholds.
- Request
Thresholds []ThresholdsRequest Threshold Args - List of request thresholds.
- Resource
Thresholds []ThresholdsResource Threshold Args - List of resource thresholds.
- health
Thresholds List<ThresholdsHealth Threshold> - List of health thresholds.
- request
Thresholds List<ThresholdsRequest Threshold> - List of request thresholds.
- resource
Thresholds List<ThresholdsResource Threshold> - List of resource thresholds.
- health
Thresholds ThresholdsHealth Threshold[] - List of health thresholds.
- request
Thresholds ThresholdsRequest Threshold[] - List of request thresholds.
- resource
Thresholds ThresholdsResource Threshold[] - List of resource thresholds.
- health_
thresholds Sequence[ThresholdsHealth Threshold Args] - List of health thresholds.
- request_
thresholds Sequence[ThresholdsRequest Threshold Args] - List of request thresholds.
- resource_
thresholds Sequence[ThresholdsResource Threshold Args] - List of resource thresholds.
- health
Thresholds List<Property Map> - List of health thresholds.
- request
Thresholds List<Property Map> - List of request thresholds.
- resource
Thresholds List<Property Map> - List of resource thresholds.
Outputs
All input properties are implicitly available as output properties. Additionally, the Thresholds resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Thresholds Resource
Get an existing Thresholds resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ThresholdsState, opts?: CustomResourceOptions): Thresholds@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
health_thresholds: Optional[Sequence[ThresholdsHealthThresholdArgs]] = None,
request_thresholds: Optional[Sequence[ThresholdsRequestThresholdArgs]] = None,
resource_thresholds: Optional[Sequence[ThresholdsResourceThresholdArgs]] = None) -> Thresholdsfunc GetThresholds(ctx *Context, name string, id IDInput, state *ThresholdsState, opts ...ResourceOption) (*Thresholds, error)public static Thresholds Get(string name, Input<string> id, ThresholdsState? state, CustomResourceOptions? opts = null)public static Thresholds get(String name, Output<String> id, ThresholdsState state, CustomResourceOptions options)resources: _: type: grafana:assert:Thresholds get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Health
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Health Threshold> - List of health thresholds.
- Request
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Request Threshold> - List of request thresholds.
- Resource
Thresholds List<Pulumiverse.Grafana. Assert. Inputs. Thresholds Resource Threshold> - List of resource thresholds.
- Health
Thresholds []ThresholdsHealth Threshold Args - List of health thresholds.
- Request
Thresholds []ThresholdsRequest Threshold Args - List of request thresholds.
- Resource
Thresholds []ThresholdsResource Threshold Args - List of resource thresholds.
- health
Thresholds List<ThresholdsHealth Threshold> - List of health thresholds.
- request
Thresholds List<ThresholdsRequest Threshold> - List of request thresholds.
- resource
Thresholds List<ThresholdsResource Threshold> - List of resource thresholds.
- health
Thresholds ThresholdsHealth Threshold[] - List of health thresholds.
- request
Thresholds ThresholdsRequest Threshold[] - List of request thresholds.
- resource
Thresholds ThresholdsResource Threshold[] - List of resource thresholds.
- health_
thresholds Sequence[ThresholdsHealth Threshold Args] - List of health thresholds.
- request_
thresholds Sequence[ThresholdsRequest Threshold Args] - List of request thresholds.
- resource_
thresholds Sequence[ThresholdsResource Threshold Args] - List of resource thresholds.
- health
Thresholds List<Property Map> - List of health thresholds.
- request
Thresholds List<Property Map> - List of request thresholds.
- resource
Thresholds List<Property Map> - List of resource thresholds.
Supporting Types
ThresholdsHealthThreshold, ThresholdsHealthThresholdArgs
- Assertion
Name string - Assertion name.
- Entity
Type string - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- Expression string
- Prometheus expression.
- Alert
Category string - Optional alert category label for the health threshold.
- Assertion
Name string - Assertion name.
- Entity
Type string - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- Expression string
- Prometheus expression.
- Alert
Category string - Optional alert category label for the health threshold.
- assertion
Name String - Assertion name.
- entity
Type String - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- expression String
- Prometheus expression.
- alert
Category String - Optional alert category label for the health threshold.
- assertion
Name string - Assertion name.
- entity
Type string - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- expression string
- Prometheus expression.
- alert
Category string - Optional alert category label for the health threshold.
- assertion_
name str - Assertion name.
- entity_
type str - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- expression str
- Prometheus expression.
- alert_
category str - Optional alert category label for the health threshold.
- assertion
Name String - Assertion name.
- entity
Type String - Entity type for the health threshold (e.g., Service, Pod, Namespace, Volume).
- expression String
- Prometheus expression.
- alert
Category String - Optional alert category label for the health threshold.
ThresholdsRequestThreshold, ThresholdsRequestThresholdArgs
- Assertion
Name string - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- Entity
Name string - Entity name the threshold applies to.
- Request
Context string - Request context (e.g., path or context identifier).
- Request
Type string - Request type (e.g., inbound/outbound).
- Value double
- Threshold value.
- Assertion
Name string - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- Entity
Name string - Entity name the threshold applies to.
- Request
Context string - Request context (e.g., path or context identifier).
- Request
Type string - Request type (e.g., inbound/outbound).
- Value float64
- Threshold value.
- assertion
Name String - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- entity
Name String - Entity name the threshold applies to.
- request
Context String - Request context (e.g., path or context identifier).
- request
Type String - Request type (e.g., inbound/outbound).
- value Double
- Threshold value.
- assertion
Name string - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- entity
Name string - Entity name the threshold applies to.
- request
Context string - Request context (e.g., path or context identifier).
- request
Type string - Request type (e.g., inbound/outbound).
- value number
- Threshold value.
- assertion_
name str - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- entity_
name str - Entity name the threshold applies to.
- request_
context str - Request context (e.g., path or context identifier).
- request_
type str - Request type (e.g., inbound/outbound).
- value float
- Threshold value.
- assertion
Name String - Assertion name (e.g., RequestRateAnomaly, ErrorRatioBreach).
- entity
Name String - Entity name the threshold applies to.
- request
Context String - Request context (e.g., path or context identifier).
- request
Type String - Request type (e.g., inbound/outbound).
- value Number
- Threshold value.
ThresholdsResourceThreshold, ThresholdsResourceThresholdArgs
- Assertion
Name string - Assertion name (e.g., Saturation, ResourceRateBreach).
- Container
Name string - Container name.
- Resource
Type string - Resource type (e.g., container/pod/node).
- Severity string
- Severity (warning or critical).
- Source string
- Data source for the threshold (e.g., metrics/logs).
- Value double
- Threshold value.
- Assertion
Name string - Assertion name (e.g., Saturation, ResourceRateBreach).
- Container
Name string - Container name.
- Resource
Type string - Resource type (e.g., container/pod/node).
- Severity string
- Severity (warning or critical).
- Source string
- Data source for the threshold (e.g., metrics/logs).
- Value float64
- Threshold value.
- assertion
Name String - Assertion name (e.g., Saturation, ResourceRateBreach).
- container
Name String - Container name.
- resource
Type String - Resource type (e.g., container/pod/node).
- severity String
- Severity (warning or critical).
- source String
- Data source for the threshold (e.g., metrics/logs).
- value Double
- Threshold value.
- assertion
Name string - Assertion name (e.g., Saturation, ResourceRateBreach).
- container
Name string - Container name.
- resource
Type string - Resource type (e.g., container/pod/node).
- severity string
- Severity (warning or critical).
- source string
- Data source for the threshold (e.g., metrics/logs).
- value number
- Threshold value.
- assertion_
name str - Assertion name (e.g., Saturation, ResourceRateBreach).
- container_
name str - Container name.
- resource_
type str - Resource type (e.g., container/pod/node).
- severity str
- Severity (warning or critical).
- source str
- Data source for the threshold (e.g., metrics/logs).
- value float
- Threshold value.
- assertion
Name String - Assertion name (e.g., Saturation, ResourceRateBreach).
- container
Name String - Container name.
- resource
Type String - Resource type (e.g., container/pod/node).
- severity String
- Severity (warning or critical).
- source String
- Data source for the threshold (e.g., metrics/logs).
- value Number
- Threshold value.
Import
$ pulumi import grafana:assert/thresholds:Thresholds name "{{ id }}"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- grafana pulumiverse/pulumi-grafana
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
grafanaTerraform Provider.
