3.3.1 Applying Alerts Rule to CNE without Prometheus Operator

SCP Helm Chart Release Name: _NAME_

Prometheus NameSpace: _Namespace _

Perform the following procedure to configure Service Communication Proxy alerts in Prometheus.
  1. Run the following command to check the name of the config map used by Prometheus:
    $kubectl get configmap -n <_Namespace_>
    Example:
    $kubectl get configmap -n prometheus-alert2
    NAME                                  DATA   AGE
    lisa-prometheus-alert2-alertmanager   1      146d
    lisa-prometheus-alert2-server         4      146d
  2. Take a backup of the current config map of Prometheus. This command saves the configmap in the provided file. In the following command, the configmap is stored in the /tmp/tempConfig.yaml file:
    $ kubectl get configmaps <_NAME_>-server -o yaml -n <_Namespace_> /tmp/tempConfig.yaml
    
    Example:
    $ kubectl get configmaps lisa-prometheus-alert2-server -o yaml -n prometheus-alert2 > /tmp/tempConfig.yaml
  3. Check and delete the "alertsscp" rule if it has already configured in the prometheus config map. If configured, this step removes the " alertsscp " rule. This is an optional step if configuring the alerts for the first time.
    $ sed -i '/etc\/config\/alertsscp/d' /tmp/tempConfig.yaml
  4. Add the "alertsscp" rule in the configmap dump file under the ' rule_files ' tag.
    $ sed -i '/rule_files:/a\    \- /etc/config/alertsscp'  /tmp/tempConfig.yaml
  5. Update the configmap using below command. Ensure to use the same configmap name that was used to take a backup of the prometheus configmap.
    $ kubectl replace configmap <_NAME_>-server -f /tmp/tempConfig.yaml
    Example:
    $ kubectl replace configmap lisa-prometheus-alert2-server -f /tmp/tempConfig.yaml
  6. Run the following command to patch the configmap with a new "alertsscp" rule:

    Note:

    The patch file provided is the ocscp_csar_23_2_0_0_0.zip folder provided with SCP, that is, SCPAlertrules.yaml.
    $ kubectl patch  configmap _NAME_-server -n _Namespace_ --type merge --patch "$(cat ~/SCPAlertrules.yaml)"
    
    Example:
    $ kubectl replace configmap lisa-prometheus-alert2-server -f /tmp/tempConfig.yaml

Note:

Prometheus takes about 20 seconds to apply the updated Config map.