# PagerDuty integration with Prometheus

1. Öncelikle [*www.pagerduty.com*](https://www.pagerduty.com/) *adresine gidip, bir hesap oluşturuyoruz.*

<figure><img src="https://4292351715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbaWe7--NyAIbXm2ywy%2Fuploads%2FCvLGFhcTzgMjdDR2VB4m%2FEkran%20g%C3%B6r%C3%BCnt%C3%BCs%C3%BC%202023-05-22%20143120.png?alt=media&#x26;token=24da13f4-0ad6-448a-b7c9-ae04ab965770" alt=""><figcaption></figcaption></figure>

2. Ardından service oluşturma ekranına gelip, "New Service" butonuna tıklıyoruz.

<figure><img src="https://4292351715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbaWe7--NyAIbXm2ywy%2Fuploads%2FuRgfBfsLJmSRaCYe5Y8A%2Fimage.png?alt=media&#x26;token=52cd4465-f396-428c-b7f1-dbeba3dac017" alt=""><figcaption></figcaption></figure>

3. Name kısmına bir isim verip, "integrations" kısmına kadar ilerliyoruz.

<figure><img src="https://4292351715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbaWe7--NyAIbXm2ywy%2Fuploads%2F5n6So8g8Ku2QFDKcboep%2Fimage.png?alt=media&#x26;token=3b0f2e2c-fe83-402e-ad75-2263c69816a6" alt=""><figcaption></figcaption></figure>

4. integrations kısmında "prometheus" seçip, "create service" butonuna tıklıyoruz.

Böylelikle servisimiz oluşturuldu. En son gelen ekranda lazım olacak 2 kısım mevcut,

1. Integration Key
2. Integration URL

Bu bilgileri bir yere kaydediyoruz. Ardından alertmanager yapılandırma dosyamıza giriyoruz.

```yaml
global:
  smtp_from: 'alert@example.com'
  smtp_smarthost: mail.example.com:587
  smtp_auth_username: 'alert@example.com'
  smtp_auth_identity: 'alert@example.com'
  smtp_auth_password: 'JhwhWAbVcWG3b734Zjq6U'
  resolve_timeout: 1m
  pagerduty_url: 'https://events.eu.pagerduty.com/generic/2010-04-15/create_event.json'
```

Service oluştururken aldığımız Integration URL bilgisini, alertmanager yapılandırma dosyası içerisinde bulunan global argümanının altına "pagerduty\_url": parametresine yapıştırıyoruz.

```yaml
- name: linux-team-manager
  pagerduty_configs:
  - service_key: 'fe5512dsadasd220bfbsss32236d'
    send_resolved: true
```

Ardından, alarmlarını pagerduty'e göndereceğimiz grubu yukarıdaki şekilde tanımlıyoruz. "service\_key" kısmını, yukarıda kopyaladığımız Integration Key bilgisinden yapıştırıyoruz.

<figure><img src="https://4292351715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbaWe7--NyAIbXm2ywy%2Fuploads%2FGFw9Zbh1M7VvTVljanBl%2Fimage.png?alt=media&#x26;token=b252cdc4-005e-4534-a350-8a333db3c4b4" alt=""><figcaption></figcaption></figure>

Görüldüğü üzere, alarmlar pagerduty hesabımıza ulaşıyor.
