# Enable prometheus alerts

**URL:** https://forums.suse.com/t/enable-prometheus-alerts/5399
**Category:** General
**Created:** [February 3, 2017, 10:01am UTC](https://forums.suse.com/t/enable-prometheus-alerts/5399 "2017-02-03T10:01:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mitkaua](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mitkaua](https://forums.suse.com/u/mitkaua)
#### Post date: [February 3, 2017, 10:01am UTC](https://forums.suse.com/t/enable-prometheus-alerts/5399/1 "2017-02-03T10:01:02Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![mrajashree](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mrajashree/32/2764_2.png) [@mrajashree](https://forums.suse.com/u/mrajashree)
#### Post date: [February 4, 2017, 6:29pm UTC](https://forums.suse.com/t/enable-prometheus-alerts/5399/2 "2017-02-04T18:29:02Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

### Author: ![ranjith](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@ranjith](https://forums.suse.com/u/ranjith)
#### Post date: [May 10, 2018, 4:17am UTC](https://forums.suse.com/t/enable-prometheus-alerts/5399/3 "2018-05-10T04:17:56Z")

</div>

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](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/0/0976049133ff802c4da82747ac1ca4ebc629d283.png)

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](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/9/9fcd5ff49428ce8e85dfb1fa867033cd1176554d.png)

---

<div class="post-metadata">

### Author: ![ranjith](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@ranjith](https://forums.suse.com/u/ranjith)
#### Post date: [May 10, 2018, 10:19am UTC](https://forums.suse.com/t/enable-prometheus-alerts/5399/4 "2018-05-10T10:19:31Z")

</div>

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.
