Enable prometheus alerts

I instaled Prometheus in my environment.
Add IP http://<SERVER_IP>:8080/v1/settings/graphite.host.

I can’t find alerts list in Pmotenteus http://<Server_IP>:9090/alerts.

How I can enable or attach alert.conf to prometheus ?

Hi, for adding alerts you need to add the path to your alert.conf in the prometheus container. At the end of your prometheus.yml add this section for adding the alert file:

  - alert.conf

This is assuming your prometheus.yml and alerts.conf are in the same location that is /etc/prom-conf/ in the Prometheus container.

I tried to do the same. But I can’t edit the prometheus.yml file and I am not able to create rules.conf file as mentioned in the rancher docs.
Here I have posted the screenshot of the error:

Because of this issue. I tried the same in the second container. But after restarting the prometheus service, the first container will be constantly changing into reinitialise state.

Here I have posted the screenshot of containers inside prometheus service:

No thanks. I solved it by editing the yml file from prometheus sidekick container. It shares the same volume as the prometheus container. So if i change something in sidekick container it will be changed in main container also because of shared volumes. Now I have a new issue. Even though I follow the same example as given in Rancher docs for Webhooks, I got error in running the main container because of the changes I have made in yml file.

Added this line at the end of the yml file:

  • rules.conf

ALERT CpuUsageSpike
IF rate(container_cpu_user_seconds_total{container_label_io_rancher_container_name=“Demo-testTarget-1”}[30s]) * 100 > 70
description = “CPU usage is above 70%”

Prometheus main container stuck in reinitializing state forever.

yaml: unmarshal errors:\n line 1: cannot unmarshal !!str ALERT C... into rulefmt.RuleGroups

I have container with the same label as mentioned in the rules.conf file.
key: container_label_io_rancher_container_name
value: Demo-testTarget-1
Little help would be appreciated.