Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
#27: update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gessnerfl committed Dec 17, 2019
1 parent 0a3f72f commit b9db7d3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 10 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changes Log: **[CHANGELOG.md](https://github.com/gessnerfl/terraform-provider-in
- [Event Settings](#event-settings)
- [Custom Event Specification](#custom-event-specification)
- [Custom Event Specification with System Rules](#custom-event-specification-with-system-rules)
- [Custom Event Specification with Entity Verification Rules](#custom-event-specification-with-entity-verification-rules)
- [Custom Event Specification with Threshold Rules](#custom-event-specification-with-threshold-rules)
- [Settings](#settings)
- [User Roles](#user-roles)
Expand Down Expand Up @@ -143,6 +144,28 @@ resource "instana_custom_event_spec_system_rule" "example" {
}
```

###### Custom Event Specification with Entity Verification Rules

Entity verification rules is a specialized system rule to check for hosts which do not have matching entities running on them.

```hcl
resource "instana_custom_event_spec_entity_verification_rule" "example" {
name = "name"
entity_type = "entity_type"
query = "query"
enabled = true
triggering = true
description = "description"
expiration_time = 60000
rule_severity = "warning"
rule_matching_entity_label = "entity-label"
rule_matching_entity_type = "process"
rule_matching_operator = "IS"
downstream_integration_ids = [ "integration-id-1", "integration-id-2" ]
downstream_broadcast_to_all_alerting_configs = true
}
```

###### Custom Event Specification with Threshold Rules

A threshold rule is verifies if a certain condition applies to a given metric. Therefore you can either use `rule_rollup` or `rule_window` or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const (
customEntityVerificationEventDescription = "description"
customEntityVerificationEventRuleMatchingEntityLabel = "matching-entity-label"
customEntityVerificationEventRuleMatchingEntityType = "matching-entity-type"
customEntityVerificationEventRuleMatchingOperator = restapi.MatchingOperatorIS
customEntityVerificationEventRuleMatchingOperator = restapi.MatchingOperatorIs
customEntityVerificationEventDownStringIntegrationId1 = "integration-id-1"
customEntityVerificationEventDownStringIntegrationId2 = "integration-id-2"

Expand Down
6 changes: 3 additions & 3 deletions instana/restapi/custom-event-specficiations-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ func (types MatchingOperatorTypes) ToStringSlice() []string {
}

const (
//MatchingOperatorIS const for IS condition operator
MatchingOperatorIS = MatchingOperatorType("IS")
//MatchingOperatorIs const for IS condition operator
MatchingOperatorIs = MatchingOperatorType("IS")
//MatchingOperatorContains const for CONTAINS condition operator
MatchingOperatorContains = MatchingOperatorType("CONTAINS")
//MatchingOperatorStartsWith const for STARTS_WITH condition operator
Expand All @@ -133,7 +133,7 @@ const (
)

//SupportedMatchingOperatorTypes slice of supported matching operatorTypes types
var SupportedMatchingOperatorTypes = MatchingOperatorTypes{MatchingOperatorIS, MatchingOperatorContains, MatchingOperatorStartsWith, MatchingOperatorEndsWith, MatchingOperatorNone}
var SupportedMatchingOperatorTypes = MatchingOperatorTypes{MatchingOperatorIs, MatchingOperatorContains, MatchingOperatorStartsWith, MatchingOperatorEndsWith, MatchingOperatorNone}

//IsSupportedMatchingOperatorType check if the provided matching operator type is supported
func IsSupportedMatchingOperatorType(operator MatchingOperatorType) bool {
Expand Down
12 changes: 6 additions & 6 deletions instana/restapi/custom-event-specficiations-api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ func TestShouldFailToValidateThresholdRuleSpecificationWithWindowWhenConditionOp
func TestShouldValidateEntityVerificationRuleSpecificationWhenAllRequiredFieldsAreProvided(t *testing.T) {
entityLabel := customEventMatchingEntityLabel
entityType := customEventMatchingEntityType
operator := MatchingOperatorIS
operator := MatchingOperatorIs
rule := RuleSpecification{
DType: EntityVerificationRuleType,
Severity: SeverityWarning.GetAPIRepresentation(),
Expand All @@ -536,7 +536,7 @@ func TestShouldValidateEntityVerificationRuleSpecificationWhenAllRequiredFieldsA

func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityLabelIsMissing(t *testing.T) {
entityType := customEventMatchingEntityType
operator := MatchingOperatorIS
operator := MatchingOperatorIs
rule := RuleSpecification{
DType: EntityVerificationRuleType,
MatchingEntityType: &entityType,
Expand All @@ -551,7 +551,7 @@ func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityLabel
func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityLabelIsBlank(t *testing.T) {
entityLabel := ""
entityType := customEventMatchingEntityType
operator := MatchingOperatorIS
operator := MatchingOperatorIs
rule := RuleSpecification{
DType: EntityVerificationRuleType,
MatchingEntityLabel: &entityLabel,
Expand All @@ -566,7 +566,7 @@ func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityLabel

func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityTypeIsMissing(t *testing.T) {
entityLabel := customEventMatchingEntityLabel
operator := MatchingOperatorIS
operator := MatchingOperatorIs
rule := RuleSpecification{
DType: EntityVerificationRuleType,
MatchingEntityLabel: &entityLabel,
Expand All @@ -581,7 +581,7 @@ func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityTypeI
func TestShouldFaileToValidateEntityVerificationRuleSpecificationWhenEntityTypeIsBlank(t *testing.T) {
entityLabel := customEventMatchingEntityLabel
entityType := ""
operator := MatchingOperatorIS
operator := MatchingOperatorIs
rule := RuleSpecification{
DType: EntityVerificationRuleType,
MatchingEntityLabel: &entityLabel,
Expand Down Expand Up @@ -643,7 +643,7 @@ func TestShouldConvertSupportedConditionOperatorTypesToSliceOfString(t *testing.
}

func TestShouldConvertMatchingOperatorTypesToSliceOfString(t *testing.T) {
expectedResult := []string{string(MatchingOperatorIS), string(MatchingOperatorContains), string(MatchingOperatorStartsWith), string(MatchingOperatorEndsWith), string(MatchingOperatorNone)}
expectedResult := []string{string(MatchingOperatorIs), string(MatchingOperatorContains), string(MatchingOperatorStartsWith), string(MatchingOperatorEndsWith), string(MatchingOperatorNone)}
result := SupportedMatchingOperatorTypes.ToStringSlice()

if !cmp.Equal(result, expectedResult) {
Expand Down
16 changes: 16 additions & 0 deletions test-sample.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,20 @@ resource "instana_custom_event_spec_threshold_rule" "example" {
rule_aggregation = "sum"
rule_condition_operator = ">"
rule_condition_value = 0.0
}

resource "instana_custom_event_spec_entity_verification_rule" "example" {
name = "name"
entity_type = "entity_type"
query = "query"
enabled = true
triggering = true
description = "description"
expiration_time = 60000
rule_severity = "warning"
rule_matching_entity_label = "entity-label"
rule_matching_entity_type = "process"
rule_matching_operator = "IS"
downstream_integration_ids = [ "integration-id-1", "integration-id-2" ]
downstream_broadcast_to_all_alerting_configs = true
}

0 comments on commit b9db7d3

Please sign in to comment.