On 20/11/2020 16:47, juan chaves wrote:
what did you say i understand.

however there is the blackbox_exporter and the files site01.yml and site02.yml in file_sd_configs, I need each one to direct to an alert rule. then it is easy to target the alert rules matching the alertmanager routes.

You can set labels within the YAML or JSON files used by file_sd. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config

You could add a label in each file with two different values (so value 1 in file 1 and value 2 in file 2). You can then use that label in your alerting rules in a way that then allows you to direct the alerts as desired in the Alertmanager routing as mentioned.


Em sexta-feira, 20 de novembro de 2020 às 13:15:51 UTC-3, [email protected] escreveu:

    By adding labels to some alerts (which you can do in your alerting
    rules), and by matching on those labels in the "routes
    <https://prometheus.io/docs/alerting/latest/configuration/#route>"
    section of your alertmanager config.

    There are examples here
    <https://prometheus.io/docs/alerting/latest/configuration/#example>
    and in the archives of this group.  Also, you may find this
    interactive routing tree editor/tester helpful:
    https://prometheus.io/webtools/alerting/routing-tree-editor/

    On Friday, 20 November 2020 at 16:05:51 UTC [email protected] wrote:

        Hello people.
        this is my blackbox configuration it has two files (lists of
        sites). below my configuration of alerts using slack.


        my question is, how can i use different receiver for each list
        in the blackbox. ex: sites01.yml use slack
        sites02.yml use email.


        ####config blackbox
        - job_name: 'blackbox'
            scrape_interval: 30s
            scrape_timeout: 20s
            metrics_path: /probe
            params:
              module: [http_2xx]  # Look for a HTTP 200 response.
            file_sd_configs:
              - files:
                - /etc/prometheus/sites01.yml
                - /etc/prometheus/sites02.yml
            relabel_configs:
              - source_labels: [__address__]
                target_label: __param_target
              - source_labels: [__param_target]
                target_label: instance
              - target_label: __address__
                replacement: "blackbox_exporter:9115"  # Blackbox
        exporter.

        ###config alertmanager
        receivers:
          - name: 'slack'
            slack_configs:
            - api_url: 'https://hooks.slack.com/services/...'
              send_resolved: true
              username: 'jcm'
              channel: '#alert'
              title: '[{{ .Status | toUpper }}{{ if eq .Status
        "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Notificações
        de Status - {{if eq .Status "firing"}}Site(s)
        OffLine!{{else}}Sites Sucessfull!{{end}} {{if eq .Status
        "firing"}}:fire:{{else}}:raised_hands:{{end}}'
              text: "{{ range .Alerts }}*Description:*
        {{.Annotations.description}}\n{{end}}

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/469913fc-8ab0-4a8a-b2fb-dfb3ea03dad2n%40googlegroups.com <https://groups.google.com/d/msgid/prometheus-users/469913fc-8ab0-4a8a-b2fb-dfb3ea03dad2n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/c8ecdb01-75f0-39b0-ffee-3743941d9e06%40Jahingo.com.

Reply via email to