Enable prometheus alerts

hi,
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:

rule_files:
  - 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:
Screenshot%20from%202018-05-10%2009%3A42%3A46

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:
Screenshot%20from%202018-05-10%2009%3A45%3A26

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:
rule_files:

  • rules.conf

rules.conf:
ALERT CpuUsageSpike
IF rate(container_cpu_user_seconds_total{container_label_io_rancher_container_name=“Demo-testTarget-1”}[30s]) * 100 > 70
LABELS {
severity=“critical”,
action=“up”
}
ANNOTATIONS {
summary = “ADDITIONAL CONTAINERS NEEDED”,
description = “CPU usage is above 70%”
}

Prometheus main container stuck in reinitializing state forever.

Error:
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.
Label:
key: container_label_io_rancher_container_name
value: Demo-testTarget-1
Little help would be appreciated.