Configuring Alert Rules
To configure the alert rules, use the following configuration:
configure
alerts rules group alert_group_name
interval-seconds seconds
rule rule_name
expression promql_expression
duration duration
severity severity_level
type alert-type
annotation annotation_name
value annotation_value
exit
exit
NOTES:
-
alerts rules : Specifies the Prometheus alerting rules.
-
group alert_group_name : Specifies the Prometheus alerting rule group. One alert group can have multiple lists of rules. alert-group-name is the name of the alert group. The alert-group-name must be a string in the range of 0–64 characters.
-
interval-seconds seconds : Specifies the evaluation interval of the rule group in seconds.
-
rule rule_name : Specifies the alerting rule definition. rule_name is the name of the rule.
-
expression promql_expression : Specifies the PromQL alerting rule expression. promql_expression is the alert rule query expressed in PromQL syntax.
-
duration duration : Specifies the duration of a true condition before it is considered true. duration is the time interval before the alert is triggered.
-
severity severity_level : Specifies the severity of the alert. severity-level is the severity level of the alert. The severity levels are critical, major, minor, and warning.
-
type alert_type : Specifies the type of the alert. alert_type is the user-defined alert type. For example, Communications Alarm, Environmental Alarm, Equipment Alarm, Indeterminate Integrity Violation Alarm, Operational Violation Alarm, Physical Violation Alarm, Processing Error Alarm, Quality of Service Alarm, Security Service Alarm, Mechanism Violation Alarm, or Time Domain Violation Alarm.
-
annotation annotation_name : Specifies the annotation to attach to the alerts. annotation_name is the name of the annotation.
-
value annotation_value : Specifies the annotation value. annotation_value is the value of the annotation.
The following example configures an alert, which is triggered when the percentage of Unified Data Management (UDM) responses is less than the specified threshold limit.
Example:
configure terminal
alerts rules group SMFUDMchk_incr
interval-seconds 300
rule SMFUDMchk_incr
expression "sum(increase(smf_restep_http_msg_total{nf_type=\"udm\", message_direction=\"outbound\", response_status=~\"2..\"}[3m])) / sum(increase(smf_restep_http_msg_total{nf_type=\"udm\", message_direction=\"outbound\"}[3m])) < 0.95"
severity major
type "Communications Alarm"
annotation summary
value "This alert is fired when the percentage of UDM responses is less than threshold“
exit
exit
exit
You can view the configured alert using the show running-config alerts command.
Example:
The following example displays the alerts configured in the running configuration:
show running-config alerts
interval-seconds 300
rule SMFUDMchk_incr
expression "sum(increase(smf_restep_http_msg_total{nf_type=\"udm\", message_direction=\"outbound\", response_status=~\"2..\"}[3m])) / sum(increase(smf_restep_http_msg_total{nf_type=\"udm\", message_direction=\"outbound\"}[3m])) < 0.95"
severity major
type "Communications Alarm"
annotation summary
value "This alert is fired when the percentage of UDM responses is less than threshold“
exit
exit
exit