* Creates a contact point for an alert e.g email/slack.
*
* @name alert_contact.new
*
* @param uid: This is a unique identifier for the alert contact point. It is automatically generated by Grafana when the contact point is created.
* @param name: This is a user-defined name for the contact point. It is used to identify the contact point within Grafana.
* @param type: This field specifies the type of notification that will be sent, such as "email", "slack", "pagerduty", or "webhook".
* @param settings: This field contains the specific settings for the notification type, such as the email address to send the notification to or the webhook URL to post to. In the example you provided, the email address
* @param disableResolveMessage: This field controls whether or not a message should be sent when an alert condition is resolved. If set to false, a message will be sent when the alert condition is resolved.
* @return A json that represent alert contact point
* @param refId: The unique reference ID for the query used in the alert rule. if the "refId" field is set to "B", which is used to reference this query in other parts of the alert rule.
* @param from: This field specifies the time range for the alert query, relative to the current time. In this case, the value of 600 means that the query should retrieve data from 600 seconds (10 minutes) ago to the current time.
* @param to: This field specifies the end time of the alert query relative to the current time. In this case, the value of 0 means that the end time of the query is the current time.
* @param datasourceUid: This field in the alert rule model specifies the unique identifier of the data source that the query for the alert is going to be executed on.
* @param editorMode: This field specifies the mode in which the query was created. In this case, it is "code" mode, which means that the query was written using the query language
* @param expr: Query expression to be run on the alert rule
* @param expression: This field specifies the name of the query that should be evaluated to determine if the alert condition is met. The query can be specified using either the query editor or the code editor in Grafana. The value of the "expression" field is "A", which means that the query with the reference ID "A" will be evaluated to determine if the alert condition is met.
* @param hide: Whether or not to show the result of the alert evaluation in the panel. In this example, it's set to false
* @param intervalMs: The interval at which to evaluate the alert. In this example, it's set to 1000 milliseconds.
* @param legendFormat: (optional) Set to `true` to hide the target from the panel.
* @param maxDataPoints: The maximum number of data points to retrieve for the query. In this example, it's set to 43200.
* @param range: This field specifies whether the query should include the time range in the query. If set to "true", the query will return data points within the specified time range.
* @param type: The type of the query. In this example, it's a "reduce" query.
* @param modelCondition: (optional) A list of conditions that must be met for the alert to trigger. In this example, there is only one condition that checks whether the value of the query result is greater than a certain threshold.
* @param reducer: The method used to reduce the time series data before performing the evaluation. In this example, it's the "count" method.
* @return A Alert Model to be added in Alert-Rule.
*/
{
new(
refId,
from,
to,
datasourceUid=null,
editorMode=null,
expr=null,
expression=null,
hide=null,
intervalMs,
legendFormat=null,
maxDataPoints,
range=null,
type=null,
modelCondition=null,
reducer=null
):: {
refId: refId,
relativeTimeRange: {
from: from,
to: to
},
datasourceUid: datasourceUid,
model: {
[if editorMode != null then 'editorMode']: editorMode,
[if expr != null then 'expr']: expr,
hide: hide,
intervalMs: intervalMs,
[if legendFormat != null then 'legendFormat']: legendFormat,
maxDataPoints: maxDataPoints,
[if modelCondition != null then 'conditions']: [modelCondition],
[if range != null then 'range']: range,
refId: refId,
[if reducer != null then 'reducer']: reducer,
[if type != null then 'type']: type,
[if expression != null then 'expression']: expression,
* @param id: Unique identifier of Alert-Rule in numbers
* @param uid: Unique Identifier of Alert-Rule is Unique UID in String format
* @param orgID: organization id for Alert-Rule
* @param folderUID: Name of Folder available on Grafana server to make it attach with Alert-Rule
* @param ruleGroup: Name of the Group so Alert-Rule could be bundled in groups
* @param title: Unique title of Alert-Rule
* @param condition: Query or expression that determines whether the alert should be triggered.
* @param data: Array of sub-queries or conditions over query like (aggr. avg. threshold. Greater|Less) over above query
* @param updated: Reffers to the time when actually Alert-Rule was updated last time
* @param noDataState: This field specifies the state that the alert should be in if there is no data available to evaluate the condition. In this case, the value is NoData, indicating that the alert will enter the "no data" state
* @param execErrState: This field specifies the state that the alert should be in if there is an error while executing the condition. In this case, the value is Error, indicating that the alert will enter the "error" state.
* @param isPaused: This field specifies whether the alert is currently paused. In this case, the value is false, indicating that the alert is not paused and can trigger if the condition is met
* @method addAlertCondition(alert_data): Add sub conditions with refIds to the Alert-Rules
* @return A json that represents an Alert-Rule
*/
new(
id,
uid,
orgID,
folderUID,
ruleGroup,
title,
condition,
data=[],
updated,
noDataState,
execErrState,
isPaused,
dashboardUid=null,
panelId=null,
interval,
annotationDesc=null,
annotationSummary=null
)::
{
id: id,
uid: uid,
orgID: orgID,
folderUID: folderUID,
ruleGroup: ruleGroup,
title: title,
condition: condition,
updated: updated,
noDataState: noDataState,
execErrState: execErrState,
isPaused: isPaused,
[if dashboardUid != null then 'dashboardUid']:dashboardUid,
[if panelId != null then 'panelId']:panelId,
interval: interval,
annotations:{
description: annotationDesc,
summary: annotationSummary,
[if dashboardUid != null then '__dashboardUid__']: dashboardUid,