I apologize for providing incomplete information. If the license expires
for one instance, then its name is sent to the slack, if there are 2 or
more of them, then it is sent without instance hostnames, but as in the
screenshot above, just the number of instances.
*docker-compose.yml*
prometheus_alertmanager:
image: prom/alertmanager:v0.21.0
container_name: prometheus-alertmanager
ports:
- '9093:9093'
volumes:
- prometheus-alertmanager-volume:/alertmanager
-
./prometheus-alertmanager/conf/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- '--cluster.advertise-address=10.10.5.187:9093'
networks:
vpcbr:
ipv4_address: 172.10.0.5
*alertmanager.yml*
global:
slack_api_url: '
https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxxxx/xxxxxxxxxxxxxxxxx'
route:
group_by: [alertname]
# Send all notifications to me.
receiver: notify-me
receivers:
- name: notify-me
email_configs:
- to: [email protected] <https://groups.google.com/>
from: [email protected] <https://groups.google.com/>
send_resolved: true
smarthost: smtp.eu.mailgun.org:587
auth_username: "[email protected] <https://groups.google.com/>"
auth_identity: "[email protected] <https://groups.google.com/>"
auth_password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
slack_configs:
- channel: '#alerts'
text: 'https://prometheus/alerts'
send_resolved: true
*Alert_rules.yml *
- alert: ssl_cert_expire
expr: ssl_cert_not_after - time() < 86400 *7
for: 2m
labels:
severity: 'warning'
annotations:
title: 'Warning: SSL cert will expire soon for the instance {{
$labels.instance }}'
description: 'SSL cert expires in 7 days {{ $labels.instance }} of
job {{ $labels.job }}'
*PromQl query:*ssl_cert_not_after{cn="server.com",dnsnames=",server.com
,",instance="server.com",issuer_cn="Let's Encrypt Authority
X3",job="ssl",serial_no="some serial"}
On Sunday, October 25, 2020 at 9:48:39 PM UTC+2 Christian Hoffmann wrote:
> Hi,
>
> On 10/23/20 5:54 PM, [email protected] wrote:
> > Hello my friends.
> > I'm using ribbybibby <https://github.com/ribbybibby>/*ssl_exporter
> > <https://github.com/ribbybibby/ssl_exporter> *for checking ssl expiry
> > for some services. All works fine but I would like to add more
> > information to the slack message. Specifically, add to the messages
> > instance on which the certificates expire.
> > Now the slack receives messages with the name of the alert, the number
> > of instances with expiring certificates and a link to the prom. I'm
> > trying to change the config but to no avail so far.
> > ```
> > - alert: ssl_cert_expire
> > expr: ssl_cert_not_after{ - time() < 86400 *7
> > for: 2m
> > labels:
> > severity: 'warning'
> > annotations:
> > title: 'Warning: SSL cert will expire soon for the site (instance
> > {{ $labels.instance }})'
> > description: 'SSL cert expires in 7 days\n VALUE = {{ $value
> > }}\n LABELS: {{ $labels }}'
> > ```
>
> I think we would need some more details in order to help:
>
> 1) Can you verify the PromQL expression (there seems to be a "{" too
> much or something else missing)?
> 2) Can you share an example result from your PromQL?
> 3) Can you show your Alertmanager config, especially the slack receiver
> part (be sure to delete any secrets)?
> 4) Can you verify that your config reloads of Prometheus and
> Alertmanager have been successful? Try checking the logs (stderr) and/or
> the config metrics.
>
> Kind regards,
> Christi
>
>
--
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/2902b157-d4e0-4dd6-b2ef-dc85cf38c6d7n%40googlegroups.com.