alerts

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Overview

Package alerts provides a programmatic API for interacting with the New Relic Alerts product. It can be used for a variety of operations, including:

- Creating, reading, updating, and deleting alert policies

- Creating, reading, updating, and deleting alert notification channels

- Associating one or more notification channels with an alert policy

- Creating, reading, updating, and deleting APM alert conditions

- Creating, reading, updating, and deleting NRQL alert conditions

- Creating, reading, updating, and deleting Synthetics alert conditions

- Creating, reading, updating, and deleting multi-location Synthetics conditions

- Creating, reading, updating, and deleting Infrastructure alert conditions

- Creating, reading, updating, and deleting Plugins alert conditions

- Associating one or more alert conditions with a policy

Authentication

You will need a valid API key to communicate with the backend New Relic APIs that provide this functionality. Using a Personal API key is the preferred method but an Admin's API key will also work. See the API key documentation below for more information on how to locate these keys:

https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys

Working with Infrastructure and Synthetics alert conditions requires an Admin's API key. If you are using the client to provision either of these resources alongside others, initializing the client with both types of keys is preferred.

Example (Policy)
// Initialize the client configuration.  A Personal API key or Admin API key
// is required to communicate with the backend API.
cfg := config.New()
cfg.AdminAPIKey = os.Getenv("NEW_RELIC_ADMIN_API_KEY")
cfg.PersonalAPIKey = os.Getenv("NEW_RELIC_API_KEY")

// Initialize the client.
client := New(cfg)

// Create a new alert policy.
p := Policy{
	Name:               "Example alert policy",
	IncidentPreference: IncidentPreferenceTypes.PerCondition,
}

policy, err := client.CreatePolicy(p)
if err != nil {
	log.Fatal("error creating policy:", err)
}

// Create a new alert notification channel.
ec := Channel{
	Name: "Example email notification channel",
	Type: ChannelTypes.Email,
	Configuration: ChannelConfiguration{
		Recipients:            "test@newrelic.com",
		IncludeJSONAttachment: "1",
	},
}

emailChannel, err := client.CreateChannel(ec)
if err != nil {
	log.Fatal("error creating notification channel:", err)
}

// Associate the new alert channel with the created policy.
_, err = client.UpdatePolicyChannels(policy.ID, []int{emailChannel.ID})
if err != nil {
	log.Fatal("error associating policy with channel:", err)
}

// Create a new NRQL alert condition.
nc := &NrqlCondition{
	Name:          "Example NRQL condition",
	Type:          "static",
	RunbookURL:    "https://www.example.com/myrunbook",
	Enabled:       true,
	ValueFunction: ValueFunctionTypes.SingleValue,
	Nrql: NrqlQuery{
		Query:      "FROM Transaction SELECT average(duration) WHERE appName = 'Example Application'",
		SinceValue: "3",
	},
	Terms: []ConditionTerm{
		{
			Duration:     5,
			Operator:     OperatorTypes.Above,
			Priority:     PriorityTypes.Warning,
			Threshold:    3,
			TimeFunction: TimeFunctionTypes.All,
		},
		{
			Duration:     5,
			Operator:     OperatorTypes.Above,
			Priority:     PriorityTypes.Critical,
			Threshold:    1,
			TimeFunction: TimeFunctionTypes.All,
		},
	},
}

_, err = client.CreateNrqlCondition(policy.ID, *nc)
if err != nil {
	log.Fatal("error creating NRQL condition:", err)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// ChannelTypes enumerates the possible channel types for an alert channel.
	ChannelTypes = struct {
		Email     ChannelType
		OpsGenie  ChannelType
		PagerDuty ChannelType
		Slack     ChannelType
		User      ChannelType
		VictorOps ChannelType
		Webhook   ChannelType
	}{
		Email:     "email",
		OpsGenie:  "opsgenie",
		PagerDuty: "pagerduty",
		Slack:     "slack",
		User:      "user",
		VictorOps: "victorops",
		Webhook:   "webhook",
	}
)
View Source
var (
	// ConditionTypes enumerates the possible condition types for an alert condition.
	ConditionTypes = struct {
		APMApplicationMetric    ConditionType
		APMKeyTransactionMetric ConditionType
		ServersMetric           ConditionType
		BrowserMetric           ConditionType
		MobileMetric            ConditionType
	}{
		APMApplicationMetric:    "apm_app_metric",
		APMKeyTransactionMetric: "apm_kt_metric",
		ServersMetric:           "servers_metric",
		BrowserMetric:           "browser_metric",
		MobileMetric:            "mobile_metric",
	}
)
View Source
var (
	// IncidentPreferenceTypes specifies the possible incident preferenece types for an alert policy.
	IncidentPreferenceTypes = struct {
		PerPolicy             IncidentPreferenceType
		PerCondition          IncidentPreferenceType
		PerConditionAndTarget IncidentPreferenceType
	}{
		PerPolicy:             "PER_POLICY",
		PerCondition:          "PER_CONDITION",
		PerConditionAndTarget: "PER_CONDITION_AND_TARGET",
	}
)
View Source
var (
	// MetricTypes enumerates the possible metric types for an alert condition.
	// Not all metric types are valid for all condition types.  See the docuentation for more details.
	MetricTypes = struct {
		AjaxResponseTime       MetricType
		AjaxThroughput         MetricType
		Apdex                  MetricType
		CPUPercentage          MetricType
		Database               MetricType
		DiskIOPercentage       MetricType
		DomProcessing          MetricType
		EndUserApdex           MetricType
		ErrorCount             MetricType
		ErrorPercentage        MetricType
		FullestDiskPercentage  MetricType
		Images                 MetricType
		JSON                   MetricType
		LoadAverageOneMinute   MetricType
		MemoryPercentage       MetricType
		MobileCrashRate        MetricType
		Network                MetricType
		NetworkErrorPercentage MetricType
		PageRendering          MetricType
		PageViewThroughput     MetricType
		PageViewsWithJsErrors  MetricType
		RequestQueuing         MetricType
		ResponseTime           MetricType
		ResponseTimeBackground MetricType
		ResponseTimeWeb        MetricType
		StatusErrorPercentage  MetricType
		Throughput             MetricType
		ThroughputBackground   MetricType
		ThroughputWeb          MetricType
		TotalPageLoad          MetricType
		UserDefined            MetricType
		ViewLoading            MetricType
		WebApplication         MetricType
	}{
		AjaxResponseTime:       "ajax_response_time",
		AjaxThroughput:         "ajax_throughput",
		Apdex:                  "apdex",
		CPUPercentage:          "cpu_percentage",
		Database:               "database",
		DiskIOPercentage:       "disk_io_percentage",
		DomProcessing:          "dom_processing",
		EndUserApdex:           "end_user_apdex",
		ErrorCount:             "error_count",
		ErrorPercentage:        "error_percentage",
		FullestDiskPercentage:  "fullest_disk_percentage",
		Images:                 "images",
		JSON:                   "json",
		LoadAverageOneMinute:   "load_average_one_minute",
		MemoryPercentage:       "memory_percentage",
		MobileCrashRate:        "mobile_crash_rate",
		Network:                "network",
		NetworkErrorPercentage: "network_error_percentage",
		PageRendering:          "page_rendering",
		PageViewThroughput:     "page_view_throughput",
		PageViewsWithJsErrors:  "page_views_with_js_errors",
		RequestQueuing:         "request_queuing",
		ResponseTime:           "response_time",
		ResponseTimeBackground: "response_time_background",
		ResponseTimeWeb:        "response_time_web",
		StatusErrorPercentage:  "status_error_percentage",
		Throughput:             "throughput",
		ThroughputBackground:   "throughput_background",
		ThroughputWeb:          "throughput_web",
		TotalPageLoad:          "total_page_load",
		UserDefined:            "user_defined",
		ViewLoading:            "view_loading",
		WebApplication:         "web_application",
	}
)
View Source
var (
	// NrqlBaselineDirections enumerates the possible baseline direction values for a baseline NRQL alert condition.
	NrqlBaselineDirections = struct {
		LowerOnly     NrqlBaselineDirection
		UpperAndLower NrqlBaselineDirection
		UpperOnly     NrqlBaselineDirection
	}{
		LowerOnly:     "LOWER_ONLY",
		UpperAndLower: "UPPER_AND_LOWER",
		UpperOnly:     "UPPER_ONLY",
	}
)
View Source
var (
	// NrqlConditionOperators enumerates the possible operator values for alert condition terms.
	NrqlConditionOperators = struct {
		Above NrqlConditionOperator
		Below NrqlConditionOperator
		Equal NrqlConditionOperator
	}{
		Above: "ABOVE",
		Below: "BELOW",
		Equal: "EQUAL",
	}
)
View Source
var (
	// NrqlConditionPriorities enumerates the possible priority values for alert condition terms.
	NrqlConditionPriorities = struct {
		Critical NrqlConditionPriority
		Warning  NrqlConditionPriority
	}{
		Critical: "CRITICAL",
		Warning:  "WARNING",
	}
)
View Source
var (
	// NrqlConditionTypes enumerates the possible NRQL condition type values for NRQL alert conditions.
	NrqlConditionTypes = struct {
		Baseline NrqlConditionType
		Static   NrqlConditionType
	}{
		Baseline: "BASELINE",
		Static:   "STATIC",
	}
)
View Source
var (
	// NrqlConditionValueFunctions enumerates the possible NRQL condition value function values for NRQL alert conditions.
	NrqlConditionValueFunctions = struct {
		SingleValue NrqlConditionValueFunction
		Sum         NrqlConditionValueFunction
	}{
		SingleValue: "SINGLE_VALUE",
		Sum:         "SUM",
	}
)
View Source
var (
	// NrqlConditionViolationTimeLimits enumerates the possible NRQL condition violation time limit values for NRQL alert conditions.
	NrqlConditionViolationTimeLimits = struct {
		OneHour         NrqlConditionViolationTimeLimit
		TwoHours        NrqlConditionViolationTimeLimit
		FourHours       NrqlConditionViolationTimeLimit
		EightHours      NrqlConditionViolationTimeLimit
		TwelveHours     NrqlConditionViolationTimeLimit
		TwentyFourHours NrqlConditionViolationTimeLimit
	}{
		OneHour:         "ONE_HOUR",
		TwoHours:        "TWO_HOURS",
		FourHours:       "FOUR_HOURS",
		EightHours:      "EIGHT_HOURS",
		TwelveHours:     "TWELVE_HOURS",
		TwentyFourHours: "TWENTY_FOUR_HOURS",
	}
)
View Source
var (
	// OperatorTypes enumerates the possible operator values for alert condition terms.
	OperatorTypes = struct {
		Above OperatorType
		Below OperatorType
	}{
		Above: "above",
		Below: "below",
	}
)
View Source
var (
	// PriorityTypes enumerates the possible priority values for alert condition terms.
	PriorityTypes = struct {
		Critical PriorityType
		Warning  PriorityType
	}{
		Critical: "critical",
		Warning:  "warning",
	}
)
View Source
var (
	// ThresholdOccurrences enumerates the possible threshold occurrence values for NRQL alert condition terms.
	ThresholdOccurrences = struct {
		All         ThresholdOccurrence
		AtLeastOnce ThresholdOccurrence
	}{
		All:         "ALL",
		AtLeastOnce: "AT_LEAST_ONCE",
	}
)
View Source
var (
	// TimeFunctionTypes enumerates the possible time function types for alert condition terms.
	TimeFunctionTypes = struct {
		All TimeFunctionType
		Any TimeFunctionType
	}{
		All: "all",
		Any: "any",
	}
)
View Source
var (
	// ValueFunctionTypes enumerates the possible value function types for custom metrics.
	ValueFunctionTypes = struct {
		Average     ValueFunctionType
		Min         ValueFunctionType
		Max         ValueFunctionType
		Total       ValueFunctionType
		SampleSize  ValueFunctionType
		SingleValue ValueFunctionType
	}{
		Average:     "average",
		Min:         "min",
		Max:         "max",
		Total:       "total",
		SampleSize:  "sample_size",
		SingleValue: "single_value",
	}
)

Functions

This section is empty.

Types

type AlertPlugin

type AlertPlugin struct {
	ID   string `json:"id,omitempty"`
	GUID string `json:"guid,omitempty"`
}

AlertPlugin represents a plugin to use with a Plugin alert condition.

type Alerts

type Alerts struct {
	// contains filtered or unexported fields
}

Alerts is used to communicate with New Relic Alerts.

func New

func New(config config.Config) Alerts

New is used to create a new Alerts client instance.

func (*Alerts) AcknowledgeIncident added in v0.3.0

func (a *Alerts) AcknowledgeIncident(id int) (*Incident, error)

AcknowledgeIncident acknowledges an existing incident.

func (*Alerts) CloseIncident added in v0.3.0

func (a *Alerts) CloseIncident(id int) (*Incident, error)

CloseIncident closes an existing open incident.

func (*Alerts) CreateChannel added in v0.3.0

func (a *Alerts) CreateChannel(channel Channel) (*Channel, error)

CreateChannel creates an alert channel within a given account. The configuration options different based on channel type. For more information on the different configurations, please view the New Relic API documentation for this endpoint. Docs: https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/rest-api-calls-new-relic-alerts#channels

func (*Alerts) CreateCondition added in v0.3.0

func (a *Alerts) CreateCondition(policyID int, condition Condition) (*Condition, error)

CreateCondition creates an alert condition for a specified policy.

func (*Alerts) CreateInfrastructureCondition

func (a *Alerts) CreateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)

CreateInfrastructureCondition is used to create a New Relic Infrastructure alert condition.

func (*Alerts) CreateMultiLocationSyntheticsCondition added in v0.9.0

func (a *Alerts) CreateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition, policyID int) (*MultiLocationSyntheticsCondition, error)

CreateMultiLocationSyntheticsCondition creates an alert condition for a specified policy.

func (*Alerts) CreateMutingRule added in v0.18.0

func (a *Alerts) CreateMutingRule(accountID int, rule MutingRuleCreateInput) (*MutingRule, error)

CreateMutingRule is the mutation to create a muting rule for the given account and input.

func (*Alerts) CreateNrqlCondition added in v0.3.0

func (a *Alerts) CreateNrqlCondition(policyID int, condition NrqlCondition) (*NrqlCondition, error)

CreateNrqlCondition creates a NRQL alert condition.

func (*Alerts) CreateNrqlConditionBaselineMutation added in v0.19.0

func (a *Alerts) CreateNrqlConditionBaselineMutation(
	accountID int,
	policyID int,
	nrqlCondition NrqlConditionInput,
) (*NrqlAlertCondition, error)

CreateNrqlConditionBaselineMutation creates a baseline NRQL alert condition via New Relic's NerdGraph API.

func (*Alerts) CreateNrqlConditionStaticMutation added in v0.19.0

func (a *Alerts) CreateNrqlConditionStaticMutation(
	accountID int,
	policyID int,
	nrqlCondition NrqlConditionInput,
) (*NrqlAlertCondition, error)

CreateNrqlConditionStaticMutation creates a static NRQL alert condition via New Relic's NerdGraph API.

func (*Alerts) CreatePluginsCondition

func (a *Alerts) CreatePluginsCondition(policyID int, condition PluginsCondition) (*PluginsCondition, error)

CreatePluginsCondition creates an alert condition for a plugin.

func (*Alerts) CreatePolicy added in v0.3.0

func (a *Alerts) CreatePolicy(policy Policy) (*Policy, error)

CreatePolicy creates a new alert policy for a given account.

func (*Alerts) CreatePolicyMutation added in v0.17.0

func (a *Alerts) CreatePolicyMutation(accountID int, policy AlertsPolicyInput) (*AlertsPolicy, error)

func (*Alerts) CreateSyntheticsCondition

func (a *Alerts) CreateSyntheticsCondition(policyID int, condition SyntheticsCondition) (*SyntheticsCondition, error)

CreateSyntheticsCondition creates a new Synthetics alert condition.

func (*Alerts) DeleteChannel added in v0.3.0

func (a *Alerts) DeleteChannel(id int) (*Channel, error)

DeleteChannel deletes the alert channel with the specified ID.

func (*Alerts) DeleteCondition added in v0.3.0

func (a *Alerts) DeleteCondition(id int) (*Condition, error)

DeleteCondition delete an alert condition.

func (*Alerts) DeleteInfrastructureCondition

func (a *Alerts) DeleteInfrastructureCondition(conditionID int) error

DeleteInfrastructureCondition is used to delete a New Relic Infrastructure alert condition.

func (*Alerts) DeleteMultiLocationSyntheticsCondition added in v0.9.0

func (a *Alerts) DeleteMultiLocationSyntheticsCondition(conditionID int) (*MultiLocationSyntheticsCondition, error)

DeleteMultiLocationSyntheticsCondition delete an alert condition.

func (*Alerts) DeleteMutingRule added in v0.18.0

func (a *Alerts) DeleteMutingRule(accountID int, ruleID int) error

DeleteMutingRule is the mutation.

func (*Alerts) DeleteNrqlCondition added in v0.3.0

func (a *Alerts) DeleteNrqlCondition(id int) (*NrqlCondition, error)

DeleteNrqlCondition deletes a NRQL alert condition.

func (*Alerts) DeletePluginsCondition

func (a *Alerts) DeletePluginsCondition(id int) (*PluginsCondition, error)

DeletePluginsCondition deletes a plugin alert condition.

func (*Alerts) DeletePolicy added in v0.3.0

func (a *Alerts) DeletePolicy(id int) (*Policy, error)

DeletePolicy deletes an existing alert policy for a given account.

func (*Alerts) DeletePolicyChannel

func (a *Alerts) DeletePolicyChannel(policyID int, channelID int) (*Channel, error)

DeletePolicyChannel deletes a notification channel from an alert policy. This method returns a response containing the Channel that was deleted from the policy.

func (*Alerts) DeletePolicyMutation added in v0.17.0

func (a *Alerts) DeletePolicyMutation(accountID, id int) (*AlertsPolicy, error)

DeletePolicyMutation is the NerdGraph mutation to delete a policy given the account ID and the policy ID.

func (*Alerts) DeleteSyntheticsCondition

func (a *Alerts) DeleteSyntheticsCondition(conditionID int) (*SyntheticsCondition, error)

DeleteSyntheticsCondition deletes a Synthetics alert condition.

func (*Alerts) GetChannel added in v0.3.0

func (a *Alerts) GetChannel(id int) (*Channel, error)

GetChannel returns a specific alert channel by ID for a given account.

func (*Alerts) GetCondition added in v0.3.0

func (a *Alerts) GetCondition(policyID int, id int) (*Condition, error)

GetCondition gets an alert condition for a specified policy ID and condition ID.

func (*Alerts) GetInfrastructureCondition

func (a *Alerts) GetInfrastructureCondition(conditionID int) (*InfrastructureCondition, error)

GetInfrastructureCondition is used to retrieve a specific New Relic Infrastructure alert condition.

func (*Alerts) GetMutingRule added in v0.18.0

func (a *Alerts) GetMutingRule(accountID, ruleID int) (*MutingRule, error)

GetMutingRule queries for a single muting rule matching the given ID.

func (*Alerts) GetNrqlCondition added in v0.3.0

func (a *Alerts) GetNrqlCondition(policyID int, id int) (*NrqlCondition, error)

GetNrqlCondition gets information about a NRQL alert condition for a specified policy ID and condition ID.

func (*Alerts) GetNrqlConditionQuery added in v0.19.0

func (a *Alerts) GetNrqlConditionQuery(
	accountID int,
	conditionID int,
) (*NrqlAlertCondition, error)

GetNrqlConditionQuery fetches a NRQL alert condition via New Relic's NerdGraph API.

func (*Alerts) GetPluginsCondition

func (a *Alerts) GetPluginsCondition(policyID int, pluginID int) (*PluginsCondition, error)

GetPluginsCondition gets information about an alert condition for a plugin given a policy ID and plugin ID.

func (*Alerts) GetPolicy added in v0.3.0

func (a *Alerts) GetPolicy(id int) (*Policy, error)

GetPolicy returns a specific alert policy by ID for a given account.

func (*Alerts) GetSyntheticsCondition added in v0.6.0

func (a *Alerts) GetSyntheticsCondition(policyID int, conditionID int) (*SyntheticsCondition, error)

GetSyntheticsCondition retrieves a specific Synthetics alert condition.

func (*Alerts) ListChannels added in v0.3.0

func (a *Alerts) ListChannels() ([]*Channel, error)

ListChannels returns all alert channels for a given account.

func (*Alerts) ListConditions added in v0.3.0

func (a *Alerts) ListConditions(policyID int) ([]*Condition, error)

ListConditions returns alert conditions for a specified policy.

func (*Alerts) ListIncidents added in v0.3.0

func (a *Alerts) ListIncidents(onlyOpen bool, excludeViolations bool) ([]*Incident, error)

ListIncidents returns all alert incidents.

func (*Alerts) ListInfrastructureConditions

func (a *Alerts) ListInfrastructureConditions(policyID int) ([]InfrastructureCondition, error)

ListInfrastructureConditions is used to retrieve New Relic Infrastructure alert conditions.

func (*Alerts) ListMultiLocationSyntheticsConditions added in v0.9.0

func (a *Alerts) ListMultiLocationSyntheticsConditions(policyID int) ([]*MultiLocationSyntheticsCondition, error)

ListMultiLocationSyntheticsConditions returns alert conditions for a specified policy.

func (*Alerts) ListMutingRules added in v0.18.0

func (a *Alerts) ListMutingRules(accountID int) ([]MutingRule, error)

ListMutingRules queries for all muting rules in a given account.

func (*Alerts) ListNrqlConditions added in v0.3.0

func (a *Alerts) ListNrqlConditions(policyID int) ([]*NrqlCondition, error)

ListNrqlConditions returns NRQL alert conditions for a specified policy.

func (*Alerts) ListPluginsConditions

func (a *Alerts) ListPluginsConditions(policyID int) ([]*PluginsCondition, error)

ListPluginsConditions returns alert conditions for New Relic plugins for a given alert policy.

func (*Alerts) ListPolicies added in v0.3.0

func (a *Alerts) ListPolicies(params *ListPoliciesParams) ([]Policy, error)

ListPolicies returns a list of Alert Policies for a given account.

func (*Alerts) ListSyntheticsConditions

func (a *Alerts) ListSyntheticsConditions(policyID int) ([]*SyntheticsCondition, error)

ListSyntheticsConditions returns a list of Synthetics alert conditions for a given policy.

func (*Alerts) QueryPolicy added in v0.17.0

func (a *Alerts) QueryPolicy(accountID, id int) (*AlertsPolicy, error)

QueryPolicy queries NerdGraph for a policy matching the given account ID and policy ID.

func (*Alerts) QueryPolicySearch added in v0.20.0

func (a *Alerts) QueryPolicySearch(accountID int, params AlertsPoliciesSearchCriteriaInput) ([]*AlertsPolicy, error)

QueryPolicySearch searches NerdGraph for policies.

func (*Alerts) SearchNrqlConditionsQuery added in v0.19.0

func (a *Alerts) SearchNrqlConditionsQuery(
	accountID int,
	searchCriteria NrqlConditionsSearchCriteria,
) ([]*NrqlAlertCondition, error)

SearchNrqlConditionsQuery fetches multiple NRQL alert conditions based on the provided search criteria via New Relic's NerdGraph API.

func (*Alerts) UpdateCondition added in v0.3.0

func (a *Alerts) UpdateCondition(condition Condition) (*Condition, error)

UpdateCondition updates an alert condition.

func (*Alerts) UpdateInfrastructureCondition

func (a *Alerts) UpdateInfrastructureCondition(condition InfrastructureCondition) (*InfrastructureCondition, error)

UpdateInfrastructureCondition is used to update a New Relic Infrastructure alert condition.

func (*Alerts) UpdateMultiLocationSyntheticsCondition added in v0.9.0

func (a *Alerts) UpdateMultiLocationSyntheticsCondition(condition MultiLocationSyntheticsCondition) (*MultiLocationSyntheticsCondition, error)

UpdateMultiLocationSyntheticsCondition updates an alert condition.

func (*Alerts) UpdateMutingRule added in v0.18.0

func (a *Alerts) UpdateMutingRule(accountID int, ruleID int, rule MutingRuleUpdateInput) (*MutingRule, error)

UpdateMutingRule is the mutation to update an existing muting rule.

func (*Alerts) UpdateNrqlCondition added in v0.3.0

func (a *Alerts) UpdateNrqlCondition(condition NrqlCondition) (*NrqlCondition, error)

UpdateNrqlCondition updates a NRQL alert condition.

func (*Alerts) UpdateNrqlConditionBaselineMutation added in v0.19.0

func (a *Alerts) UpdateNrqlConditionBaselineMutation(
	accountID int,
	conditionID int,
	nrqlCondition NrqlConditionInput,
) (*NrqlAlertCondition, error)

UpdateNrqlConditionBaselineMutation updates a baseline NRQL alert condition via New Relic's NerdGraph API.

func (*Alerts) UpdateNrqlConditionStaticMutation added in v0.19.0

func (a *Alerts) UpdateNrqlConditionStaticMutation(
	accountID int,
	conditionID int,
	nrqlCondition NrqlConditionInput,
) (*NrqlAlertCondition, error)

UpdateNrqlConditionStaticMutation updates a static NRQL alert condition via New Relic's NerdGraph API.

func (*Alerts) UpdatePluginsCondition

func (a *Alerts) UpdatePluginsCondition(condition PluginsCondition) (*PluginsCondition, error)

UpdatePluginsCondition updates an alert condition for a plugin.

func (*Alerts) UpdatePolicy added in v0.3.0

func (a *Alerts) UpdatePolicy(policy Policy) (*Policy, error)

UpdatePolicy update an alert policy for a given account.

func (*Alerts) UpdatePolicyChannels

func (a *Alerts) UpdatePolicyChannels(policyID int, channelIDs []int) (*PolicyChannels, error)

UpdatePolicyChannels updates a policy by adding the specified notification channels.

func (*Alerts) UpdatePolicyMutation added in v0.17.0

func (a *Alerts) UpdatePolicyMutation(accountID int, policyID int, policy AlertsPolicyUpdateInput) (*AlertsPolicy, error)

func (*Alerts) UpdateSyntheticsCondition

func (a *Alerts) UpdateSyntheticsCondition(condition SyntheticsCondition) (*SyntheticsCondition, error)

UpdateSyntheticsCondition updates an existing Synthetics alert condition.

type AlertsIncidentPreference added in v0.20.0

type AlertsIncidentPreference string

nolint:golint

const (
	/* A condition will create a condition-level incident when it violates its critical threshold.
	Other violating conditions will create their own incidents. */
	PER_CONDITION AlertsIncidentPreference = "PER_CONDITION" // nolint:golint
	/* Each target of each condition will create an entity-level incident upon critical violation.
	Other violating targets even on the same condition will create their own incidents. */
	PER_CONDITION_AND_TARGET AlertsIncidentPreference = "PER_CONDITION_AND_TARGET" // nolint:golint
	/* A condition will create a policy-level incident when it violates its critical threshold.
	Other violating conditions will be grouped into this incident. */
	PER_POLICY AlertsIncidentPreference = "PER_POLICY" // nolint:golint
)

type AlertsMutingRuleConditionGroupInput added in v0.20.0

type AlertsMutingRuleConditionGroupInput struct {
	/* The individual MutingRuleConditions within the group. */
	Conditions []AlertsMutingRuleConditionInput `json:"conditions"`

	/* The operator used to combine all the MutingRuleConditions within the group. */
	Operator AlertsMutingRuleConditionGroupOperator `json:"operator"`
}

nolint:golint

type AlertsMutingRuleConditionGroupOperator added in v0.20.0

type AlertsMutingRuleConditionGroupOperator string

nolint:golint

const (
	/* Match conditions by AND */
	AND AlertsMutingRuleConditionGroupOperator = "AND" // nolint:golint
	/* Match conditions by OR */
	OR AlertsMutingRuleConditionGroupOperator = "OR" // nolint:golint
)

type AlertsMutingRuleConditionInput added in v0.20.0

type AlertsMutingRuleConditionInput struct {
	/* The attribute on a violation. Expects one of:

	* **accountId** - The account id
	* **conditionId** - The alert condition id
	* **policyId** - The alert policy id
	* **policyName** - The alert policy name
	* **conditionName** - The alert condition name
	* **conditionType** - The alert condition type, such as app_metric
	* **conditionRunbookUrl** - The alert condition's runbook url
	* **product** - The target product (e.g., SYNTHETICS)
	* **targetId** - The ID of the alerts target
	* **targetName** - The name of the alerts target
	* **nrqlEventType** - The NRQL event type
	* **tag** - Arbitrary tags associated with some entity (e.g., FACET from a NRQL query)
	* **nrqlQuery** - The NRQL query string */
	Attribute string `json:"attribute"`

	/* The operator used to compare the attribute's value with the supplied value(s). */
	Operator AlertsMutingRuleConditionOperator `json:"operator"`

	/* The value(s) to compare against the attribute's value. */
	Values []string `json:"values"`
}

nolint:golint

type AlertsMutingRuleConditionOperator added in v0.20.0

type AlertsMutingRuleConditionOperator string

nolint:golint

const (
	/* Where any. */
	ANY AlertsMutingRuleConditionOperator = "ANY" // nolint:golint
	/* Where contain value. */
	CONTAINS AlertsMutingRuleConditionOperator = "CONTAINS" // nolint:golint
	/* Where ends with. */
	ENDS_WITH AlertsMutingRuleConditionOperator = "ENDS_WITH" // nolint:golint
	/* Where values equals. */
	EQUALS AlertsMutingRuleConditionOperator = "EQUALS" // nolint:golint
	/* Where in value. */
	IN AlertsMutingRuleConditionOperator = "IN" // nolint:golint
	/* Where blank. */
	IS_BLANK AlertsMutingRuleConditionOperator = "IS_BLANK" // nolint:golint
	/* Where not blank. */
	IS_NOT_BLANK AlertsMutingRuleConditionOperator = "IS_NOT_BLANK" // nolint:golint
	/* Where do not contain value. */
	NOT_CONTAINS AlertsMutingRuleConditionOperator = "NOT_CONTAINS" // nolint:golint
	/* Where does not end with. */
	NOT_ENDS_WITH AlertsMutingRuleConditionOperator = "NOT_ENDS_WITH" // nolint:golint
	/* Where do not equal value. */
	NOT_EQUALS AlertsMutingRuleConditionOperator = "NOT_EQUALS" // nolint:golint
	/* Where not in value. */
	NOT_IN AlertsMutingRuleConditionOperator = "NOT_IN" // nolint:golint
	/* Where does not start with. */
	NOT_STARTS_WITH AlertsMutingRuleConditionOperator = "NOT_STARTS_WITH" // nolint:golint
	/* Where starts with. */
	STARTS_WITH AlertsMutingRuleConditionOperator = "STARTS_WITH" // nolint:golint
)

type AlertsMutingRuleInput added in v0.20.0

type AlertsMutingRuleInput struct {
	/* The condition that defines which violations to target. */
	Condition AlertsMutingRuleConditionGroupInput `json:"condition"`

	/* The description of the MutingRule. */
	Description string `json:"description"`

	/* Whether the MutingRule is enabled */
	Enabled bool `json:"enabled"`

	/* The name of the MutingRule. */
	Name string `json:"name"`
}

nolint:golint

type AlertsPoliciesSearchCriteriaInput added in v0.20.0

type AlertsPoliciesSearchCriteriaInput struct {
	/* The list of policy ids to return. */
	IDs []int `json:"ids"`
}

nolint:golint

type AlertsPoliciesSearchResultSet added in v0.20.0

type AlertsPoliciesSearchResultSet struct {

	/* Cursor pointing to the end of the current page of Policy records. Null if final page. */
	NextCursor string `json:"nextCursor"`

	/* Set of Policies returned for the supplied cursor and criteria. */
	Policies []AlertsPolicy `json:"policies"`

	/* Total number of Policy records for the given search criteria. */
	TotalCount int `json:"totalCount"`
}

nolint:golint

type AlertsPolicy added in v0.20.0

type AlertsPolicy struct {

	/* The account id of the Policy. */
	AccountID int `json:"accountId"`

	/* Primary key for Policies. */
	ID int `json:"id,string"`

	/* Determines how incidents are created for critical violations of the conditions contained in the policy. */
	IncidentPreference AlertsIncidentPreference `json:"incidentPreference"`

	/* A text description of the policy for display purposes. */
	Name string `json:"name"`
}

nolint:golint

type AlertsPolicyInput added in v0.20.0

type AlertsPolicyInput struct {
	/* Determines how incidents are created for critical violations of the conditions contained in the policy. */
	IncidentPreference AlertsIncidentPreference `json:"incidentPreference"`

	/* A text description of the policy for display purposes. */
	Name string `json:"name"`
}

nolint:golint

type AlertsPolicyUpdateInput added in v0.20.0

type AlertsPolicyUpdateInput struct {
	/* Determines how incidents are created for critical violations of the conditions contained in the policy. */
	IncidentPreference AlertsIncidentPreference `json:"incidentPreference"`

	/* A text description of the policy for display purposes. */
	Name string `json:"name"`
}

nolint:golint

type Channel added in v0.3.0

type Channel struct {
	ID            int                  `json:"id,omitempty"`
	Name          string               `json:"name,omitempty"`
	Type          ChannelType          `json:"type,omitempty"`
	Configuration ChannelConfiguration `json:"configuration,omitempty"`
	Links         ChannelLinks         `json:"links,omitempty"`
}

Channel represents a New Relic alert notification channel

type ChannelConfiguration added in v0.3.0

type ChannelConfiguration struct {
	Recipients            string `json:"recipients,omitempty"`
	IncludeJSONAttachment string `json:"include_json_attachment,omitempty"`
	AuthToken             string `json:"auth_token,omitempty"`
	APIKey                string `json:"api_key,omitempty"`
	Teams                 string `json:"teams,omitempty"`
	Tags                  string `json:"tags,omitempty"`
	URL                   string `json:"url,omitempty"`
	Channel               string `json:"channel,omitempty"`
	Key                   string `json:"key,omitempty"`
	RouteKey              string `json:"route_key,omitempty"`
	ServiceKey            string `json:"service_key,omitempty"`
	BaseURL               string `json:"base_url,omitempty"`
	AuthUsername          string `json:"auth_username,omitempty"`
	AuthPassword          string `json:"auth_password,omitempty"`
	PayloadType           string `json:"payload_type,omitempty"`
	Region                string `json:"region,omitempty"`
	UserID                string `json:"user_id,omitempty"`

	// Payload is unmarshaled to type map[string]string
	Payload serialization.MapStringInterface `json:"payload,omitempty"`

	// Headers is unmarshaled to type map[string]string
	Headers serialization.MapStringInterface `json:"headers,omitempty"`
}

ChannelConfiguration represents a Configuration type within Channels

type ChannelLinks struct {
	PolicyIDs []int `json:"policy_ids,omitempty"`
}

ChannelLinks represent the links between policies and alert channels

type ChannelType added in v0.14.0

type ChannelType string

ChannelType specifies the channel type used when creating the alert channel.

type Condition added in v0.3.0

type Condition struct {
	ID                  int                  `json:"id,omitempty"`
	Type                ConditionType        `json:"type,omitempty"`
	Name                string               `json:"name,omitempty"`
	Enabled             bool                 `json:"enabled"`
	Entities            []string             `json:"entities,omitempty"`
	Metric              MetricType           `json:"metric,omitempty"`
	RunbookURL          string               `json:"runbook_url,omitempty"`
	Terms               []ConditionTerm      `json:"terms,omitempty"`
	UserDefined         ConditionUserDefined `json:"user_defined,omitempty"`
	Scope               string               `json:"condition_scope,omitempty"`
	GCMetric            string               `json:"gc_metric,omitempty"`
	ViolationCloseTimer int                  `json:"violation_close_timer,omitempty"`
}

Condition represents a New Relic alert condition. TODO: custom unmarshal entities to ints?

type ConditionTerm added in v0.3.0

type ConditionTerm struct {
	Duration     int              `json:"duration,string,omitempty"`
	Operator     OperatorType     `json:"operator,omitempty"`
	Priority     PriorityType     `json:"priority,omitempty"`
	Threshold    float64          `json:"threshold,string"`
	TimeFunction TimeFunctionType `json:"time_function,omitempty"`
}

ConditionTerm represents the terms of a New Relic alert condition.

func (*ConditionTerm) UnmarshalJSON added in v0.17.1

func (c *ConditionTerm) UnmarshalJSON(data []byte) error

UnmarshalJSON is responsible for unmarshaling the ConditionTerm type.

type ConditionType added in v0.14.0

type ConditionType string

ConditionType specifies the condition type used when creating the alert condition.

type ConditionUserDefined added in v0.3.0

type ConditionUserDefined struct {
	Metric        string            `json:"metric,omitempty"`
	ValueFunction ValueFunctionType `json:"value_function,omitempty"`
}

ConditionUserDefined represents user defined metrics for the New Relic alert condition.

type Incident added in v0.3.0

type Incident struct {
	ID                 int                      `json:"id,omitempty"`
	OpenedAt           *serialization.EpochTime `json:"opened_at,omitempty"`
	ClosedAt           *serialization.EpochTime `json:"closed_at,omitempty"`
	IncidentPreference string                   `json:"incident_preference,omitempty"`
	Links              IncidentLink             `json:"links"`
}

Incident represents a New Relic alert incident.

type IncidentLink struct {
	Violations []int `json:"violations,omitempty"`
	PolicyID   int   `json:"policy_id"`
}

IncidentLink represents a link between a New Relic alert incident and its violations

type IncidentPreferenceType added in v0.14.0

type IncidentPreferenceType string

IncidentPreferenceType specifies rollup settings for alert policies.

type InfrastructureCondition

type InfrastructureCondition struct {
	Comparison          string                            `json:"comparison,omitempty"`
	CreatedAt           *serialization.EpochTime          `json:"created_at_epoch_millis,omitempty"`
	Critical            *InfrastructureConditionThreshold `json:"critical_threshold,omitempty"`
	Enabled             bool                              `json:"enabled"`
	Event               string                            `json:"event_type,omitempty"`
	ID                  int                               `json:"id,omitempty"`
	IntegrationProvider string                            `json:"integration_provider,omitempty"`
	Name                string                            `json:"name,omitempty"`
	PolicyID            int                               `json:"policy_id,omitempty"`
	ProcessWhere        string                            `json:"process_where_clause,omitempty"`
	RunbookURL          string                            `json:"runbook_url,omitempty"`
	Select              string                            `json:"select_value,omitempty"`
	Type                string                            `json:"type,omitempty"`
	UpdatedAt           *serialization.EpochTime          `json:"updated_at_epoch_millis,omitempty"`
	ViolationCloseTimer *int                              `json:"violation_close_timer,omitempty"`
	Warning             *InfrastructureConditionThreshold `json:"warning_threshold,omitempty"`
	Where               string                            `json:"where_clause,omitempty"`
}

InfrastructureCondition represents a New Relic Infrastructure alert condition.

type InfrastructureConditionThreshold

type InfrastructureConditionThreshold struct {
	Duration int     `json:"duration_minutes,omitempty"`
	Function string  `json:"time_function,omitempty"`
	Value    float64 `json:"value,omitempty"`
}

InfrastructureConditionThreshold represents an New Relic Infrastructure alert condition threshold.

type ListPoliciesParams added in v0.3.0

type ListPoliciesParams struct {
	Name string `url:"filter[name],omitempty"`
}

ListPoliciesParams represents a set of filters to be used when querying New Relic alert policies.

type MetricType added in v0.14.0

type MetricType string

MetricType specifies the metric type used when creating the alert condition.

type MultiLocationSyntheticsCondition added in v0.9.0

type MultiLocationSyntheticsCondition struct {
	ID                        int                                    `json:"id,omitempty"`
	Name                      string                                 `json:"name,omitempty"`
	Enabled                   bool                                   `json:"enabled"`
	RunbookURL                string                                 `json:"runbook_url,omitempty"`
	MonitorID                 string                                 `json:"monitor_id,omitempty"`
	Entities                  []string                               `json:"entities,omitempty"`
	Terms                     []MultiLocationSyntheticsConditionTerm `json:"terms,omitempty"`
	ViolationTimeLimitSeconds int                                    `json:"violation_time_limit_seconds,omitempty"`
}

MultiLocationSyntheticsCondition represents a location-based failure condition.

ViolationTimeLimitSeconds must be one of 3600, 7200, 14400, 28800, 43200, 86400.

type MultiLocationSyntheticsConditionTerm added in v0.9.0

type MultiLocationSyntheticsConditionTerm struct {
	Priority  string `json:"priority,omitempty"`
	Threshold int    `json:"threshold,omitempty"`
}

MultiLocationSyntheticsConditionTerm represents a single term for a location-based failure condition.

Priority must be "warning" or "critical". Threshold must be greater than zero.

type MutingRule added in v0.18.0

type MutingRule struct {
	ID          int                      `json:"id,string,omitempty"`
	AccountID   int                      `json:"accountId,omitempty"`
	Condition   MutingRuleConditionGroup `json:"condition,omitempty"`
	CreatedAt   string                   `json:"createdAt,omitempty"`
	CreatedBy   string                   `json:"createdBy,omitempty"`
	Description string                   `json:"description,omitempty"`
	Enabled     bool                     `json:"enabled,omitempty"`
	Name        string                   `json:"name,omitempty"`
	UpdatedAt   string                   `json:"updatedAt,omitempty"`
	UpdatedBy   string                   `json:"updatedBy,omitempty"`
}

MutingRule represents the alert suppression mechanism in the Alerts API.

type MutingRuleCondition added in v0.18.0

type MutingRuleCondition struct {
	Attribute string   `json:"attribute"`
	Operator  string   `json:"operator"`
	Values    []string `json:"values"`
}

MutingRuleCondition is a single muting rule condition.

type MutingRuleConditionGroup added in v0.18.0

type MutingRuleConditionGroup struct {
	Conditions []MutingRuleCondition `json:"conditions"`
	Operator   string                `json:"operator"`
}

MutingRuleConditionGroup is a collection of conditions for muting.

type MutingRuleCreateInput added in v0.18.0

type MutingRuleCreateInput struct {
	Condition   MutingRuleConditionGroup `json:"condition"`
	Description string                   `json:"description"`
	Enabled     bool                     `json:"enabled"`
	Name        string                   `json:"name"`
}

MutingRuleCreateInput is the input for creating muting rules.

type MutingRuleUpdateInput added in v0.18.0

type MutingRuleUpdateInput struct {
	Condition   *MutingRuleConditionGroup `json:"condition,omitempty"`
	Description string                    `json:"description,omitempty"`
	Enabled     bool                      `json:"enabled,omitempty"`
	Name        string                    `json:"name,omitempty"`
}

MutingRuleUpdateInput is the input for updating a rule.

type NrqlAlertCondition added in v0.19.0

type NrqlAlertCondition struct {
	NrqlConditionBase

	ID       string `json:"id,omitempty"`
	PolicyID string `json:"policyId,omitempty"`

	// BaselineDirection exists ONLY for NRQL conditions of type BASELINE.
	BaselineDirection *NrqlBaselineDirection `json:"baselineDirection,omitempty"`

	// ValueFunction is returned ONLY for NRQL conditions of type STATIC.
	ValueFunction *NrqlConditionValueFunction `json:"valueFunction,omitempty"`
}

NrqlAlertCondition represents a NerdGraph NRQL alert condition, which is type AlertsNrqlCondition in NerdGraph. NrqlAlertCondition could be a baseline condition OR a static condition.

type NrqlBaselineDirection added in v0.19.0

type NrqlBaselineDirection string

type NrqlCondition

type NrqlCondition struct {
	Terms               []ConditionTerm   `json:"terms,omitempty"`
	Nrql                NrqlQuery         `json:"nrql,omitempty"`
	Type                string            `json:"type,omitempty"`
	Name                string            `json:"name,omitempty"`
	RunbookURL          string            `json:"runbook_url,omitempty"`
	ValueFunction       ValueFunctionType `json:"value_function,omitempty"`
	ID                  int               `json:"id,omitempty"`
	ViolationCloseTimer int               `json:"violation_time_limit_seconds,omitempty"`
	ExpectedGroups      int               `json:"expected_groups,omitempty"`
	IgnoreOverlap       bool              `json:"ignore_overlap,omitempty"`
	Enabled             bool              `json:"enabled"`
}

NrqlCondition represents a New Relic NRQL Alert condition.

type NrqlConditionBase added in v0.19.0

type NrqlConditionBase struct {
	Description        string                          `json:"description,omitempty"`
	Enabled            bool                            `json:"enabled"`
	Name               string                          `json:"name,omitempty"`
	Nrql               NrqlConditionQuery              `json:"nrql,omitempty"`
	RunbookURL         string                          `json:"runbookUrl,omitempty"`
	Terms              []NrqlConditionTerms            `json:"terms,omitempty"`
	Type               NrqlConditionType               `json:"type,omitempty"`
	ViolationTimeLimit NrqlConditionViolationTimeLimit `json:"violationTimeLimit,omitempty"`
}

NrqlConditionBase represents the base fields for a New Relic NRQL Alert condition. These fields shared between the NrqlConditionMutationInput struct and NrqlConditionMutationResponse struct.

type NrqlConditionInput added in v0.19.0

type NrqlConditionInput struct {
	NrqlConditionBase

	// BaselineDirection exists ONLY for NRQL conditions of type BASELINE.
	BaselineDirection *NrqlBaselineDirection `json:"baselineDirection,omitempty"`

	// ValueFunction is returned ONLY for NRQL conditions of type STATIC.
	ValueFunction *NrqlConditionValueFunction `json:"value_function,omitempty"`
}

NrqlConditionInput represents the input options for creating or updating a Nrql Condition.

type NrqlConditionOperator added in v0.19.0

type NrqlConditionOperator string

NrqlConditionOperator specifies the operator for alert condition terms.

type NrqlConditionPriority added in v0.19.0

type NrqlConditionPriority string

NrqlConditionPriority specifies the priority for alert condition terms.

type NrqlConditionQuery added in v0.19.0

type NrqlConditionQuery struct {
	Query            string `json:"query,omitempty"`
	EvaluationOffset int    `json:"evaluationOffset,omitempty"`
}

NrqlConditionQuery represents the NRQL query object returned in a NerdGraph response object.

type NrqlConditionTerms added in v0.19.0

type NrqlConditionTerms struct {
	Operator             NrqlConditionOperator `json:"operator,omitempty"`
	Priority             NrqlConditionPriority `json:"priority,omitempty"`
	Threshold            float64               `json:"threshold,omitempty"`
	ThresholdDuration    int                   `json:"thresholdDuration,omitempty"`
	ThresholdOccurrences ThresholdOccurrence   `json:"thresholdOccurrences,omitempty"`
}

NrqlConditionTerms represents the terms of a New Relic alert condition.

type NrqlConditionType added in v0.19.0

type NrqlConditionType string

NrqlConditionType specifies the type of NRQL alert condition.

type NrqlConditionValueFunction added in v0.19.0

type NrqlConditionValueFunction string

NrqlConditionValueFunction specifies the value function of NRQL alert condition.

type NrqlConditionViolationTimeLimit added in v0.19.0

type NrqlConditionViolationTimeLimit string

NrqlConditionValueFunction specifies the value function of NRQL alert condition.

type NrqlConditionsSearchCriteria added in v0.19.0

type NrqlConditionsSearchCriteria struct {
	Name      string `json:"name,omitempty"`
	NameLike  string `json:"nameLike,omitempty"`
	PolicyID  string `json:"policyId,omitempty"`
	Query     string `json:"query,omitempty"`
	QueryLike string `json:"queryLike,omitempty"`
}

type NrqlQuery

type NrqlQuery struct {
	Query      string `json:"query,omitempty"`
	SinceValue string `json:"since_value,omitempty"`
}

NrqlQuery represents a NRQL query to use with a NRQL alert condition

type OperatorType added in v0.17.0

type OperatorType string

OperatorType specifies the operator for alert condition terms.

type PluginsCondition

type PluginsCondition struct {
	ID                int             `json:"id,omitempty"`
	Name              string          `json:"name,omitempty"`
	Enabled           bool            `json:"enabled"`
	Entities          []string        `json:"entities,omitempty"`
	Metric            string          `json:"metric,omitempty"`
	MetricDescription string          `json:"metric_description,omitempty"`
	RunbookURL        string          `json:"runbook_url,omitempty"`
	Terms             []ConditionTerm `json:"terms,omitempty"`
	ValueFunction     string          `json:"value_function,omitempty"`
	Plugin            AlertPlugin     `json:"plugin,omitempty"`
}

PluginsCondition represents an alert condition for New Relic Plugins.

type Policy added in v0.3.0

type Policy struct {
	ID                 int                      `json:"id,omitempty"`
	IncidentPreference IncidentPreferenceType   `json:"incident_preference,omitempty"`
	Name               string                   `json:"name,omitempty"`
	CreatedAt          *serialization.EpochTime `json:"created_at,omitempty"`
	UpdatedAt          *serialization.EpochTime `json:"updated_at,omitempty"`
}

Policy represents a New Relic alert policy.

type PolicyChannels

type PolicyChannels struct {
	ID         int   `json:"id,omitempty"`
	ChannelIDs []int `json:"channel_ids,omitempty"`
}

PolicyChannels represents an association of alert channels to a specific alert policy.

type PriorityType added in v0.17.0

type PriorityType string

PriorityType specifies the priority for alert condition terms.

type SyntheticsCondition

type SyntheticsCondition struct {
	ID         int    `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	Enabled    bool   `json:"enabled"`
	RunbookURL string `json:"runbook_url,omitempty"`
	MonitorID  string `json:"monitor_id,omitempty"`
}

SyntheticsCondition represents a New Relic Synthetics alert condition.

type ThresholdOccurrence added in v0.20.0

type ThresholdOccurrence string

ThresholdOccurrence specifies the threshold occurrence for NRQL alert condition terms.

type TimeFunctionType added in v0.14.0

type TimeFunctionType string

TimeFunctionType specifies the time function to be used for alert condition terms.

type ValueFunctionType added in v0.14.0

type ValueFunctionType string

ValueFunctionType specifies the value function to be used for returning custom metric data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL