In the client cluster (local alerting)

In the “Shturval” platform, centralized alerting is implemented by default for client clusters with metrics and alert rules located in the management cluster. When using centralized alerting, setting up alert rules from the cluster interface is available.

If the management cluster is unavailable, centralized alerting is disabled, or centralized alerting is not required, you can configure local alerting in the client cluster. In that case, the GUI for configuring notification rules, routes, and silences is unavailable.

  1. Prepare a ShturvalServicePatch to apply to the Monitoring Engine Control Component (shturval-metrics-collector) specification (ssc) where include the local vmsingle metrics storage database and required components as in the following example, using your parameter values.
Example ShturvalServicePatch
apiVersion: ops.shturval.tech/v1beta2
kind: ShturvalServicePatch
metadata:
  name: <resource name>
spec:
  shturvalServiceConfigName: shturval-metrics-collector
  customvalues:
    alertmanager:
      enabled: true
    defaultRules:
      create: true
    vmagent:
      additionalRemoteWrites:
        - url: <your parameter value>
    vmalert:
      enabled: true
    vmsingle:
      enabled: true
ParameterDescriptionData typeExample
metadata.nameName of the created PatchSSCstringmetrics-collector-vmsingle
additionalRemoteWrites.urlVictoria Metrics Insert URL as specified in the pre-change specificationstringhttps://vminsert.clustername.ip-10-11-12-13.shturval.link/insert/2452490585/prometheus/

The additionalRemoteWrites.url parameter must be specified so that metrics are sent not only to the local cluster database, but also centrally to the management cluster.

  1. In the cluster, load the prepared ShturvalServicePatch using import manifests.
Screenshot

metrics_alertspatch

After downloading ShturvalServicePatch it will take time for the changes to take effect.

As a result:

  • metrics will be sent to the local VM Single database and (if centralized storage is available), then additionally to the management cluster;
  • custom resources of the API group “operator.victoriametrics.com” have been added to the client cluster: VMAlertmanager, VMAlert, VMSingle and system rules VMRule.
  • it is possible to configure the local alerting configuration.

Please note!

  • In the graphical interface from the Alerts section, you can only configure centralized alerting.
  • Local alerting configuration must be configured in ssc (specification) shturval-metrics-collector.
  • If you need to create a new rule for local alerting, you must add the rule to the client cluster by importing the VMRule object manifest.
  1. To configure routes, recipients, alert blocking, prepare a ShturvalServicePatch to apply to the Monitor Module Control Component (shturval-metrics-collector) specification (ssc), where set the required configuration in alertmanager.
Example configuration in ShturvalServicePatch, where the recipient is a webhook
apiVersion: ops.shturval.tech/v1beta2
kind: ShturvalServicePatch
metadata:
  name: <resource name>
spec:
  shturvalServiceConfigName: shturval-metrics-collector
  customvalues:
    alertmanager:
      enabled: true
      config:
        receivers:
          - name: blackhole # Default receiver. Must be specified
          - name: <your parameter value>
            webhook_configs:
              - max_alerts: <your parameter value>
                send_resolved: false
                url: <your parameter value>
        route:
          routes:
            - matchers:
              - <your parameter value>
              receiver: <your parameter value>
ParameterDescriptionData typeExample
metadata.nameName of the created PatchSSCstringmetrics-collector-config
receivers.nameAlert Recipient Namestringexample-webhook
receivers.webhook_configs.max_alertsThe maximum number of alerts included in a single webhook message. Alerts exceeding thisvalue, cut off. Default 0 (unlimited number, all alerts will be included in the message)int5
receivers.webhook_configs.urlURL: endpoint for sending HTTP requests to webhookstringhttp://example-webhook.svc/webhook
route.routes.matchersList of recipient labels where alerts will be routedstringapp = “example-webhook”
route.routes.receiversAlert recipient name valuestringexample-webhook
  1. In the cluster, load the prepared ShturvalServicePatch using import manifests.
Screenshot

metrics_configpatch

  1. Perform a check of local alerting settings and, if necessary, check its work, for example, using a webhook.