监控SSL证书

IT
IT
IT
335
文章
1
评论
2020年3月23日12:24:42 评论 1,518 1510字阅读5分2秒

添加监控项

[root@10 prometheus]# vim prometheus.yml
rule_files:
 - "ssl_expiry.rules.yml" ###添加监控规则
  - job_name: 'blackbox'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
    - targets:
       - https://www.centoscn.cn
    relabel_configs:
     - source_labels: [__address__]
       target_label: __param_target
     - source_labels: [__param_target]
       target_label: instance
     - target_label: __address__
	 replacement: 10.11.0.217:9115

添加规则

[root@10 prometheus]# vim ssl_expiry.rules.yml
groups:
  - name: ssl_expiry.rules
    rules:
      - alert: SSLCertExpiringSoon
        expr: probe_ssl_earliest_cert_expiry{job="blackbox"} - time() < 86400 * 30
        for: 10m

添加报警规则

[root@10 prometheus]# vim first_rules.yml
 
- name: 证书还有30天过期
  rules:
  - alert: SslCertificateWillExpireSoon
    expr: probe_ssl_earliest_cert_expiry - time() < 86400 * 30
    for: 5m
    labels:
      severity: warning
    annotations:
      summary: "SSL certificate will expire soon (instance {{ $labels.instance }})"
      description: "SSL certificate expires in 30 days\n  VALUE = {{ $value }}\n  LABELS: {{ $labels }}"
- name: 证书已过期
  rules:
  - alert: SslCertificateExpired
    expr: probe_ssl_earliest_cert_expiry - time()  <= 0
    for: 5m
    labels:
      severity: error
    annotations:
      summary: "SSL certificate expired (instance {{ $labels.instance }})"
      description: "SSL certificate has expired already\n  VALUE = {{ $value }}\n  LABELS: {{ $labels }}"

检查配置文件,加载服务。

[root@10 prometheus]# ./promtool check config prometheus.yml
Checking prometheus.yml
  SUCCESS: 2 rule files found
 
Checking first_rules.yml
  SUCCESS: 17 rules found
 
Checking ssl_expiry.rules.yml
  SUCCESS: 1 rules found
 
[root@10 prometheus]# systemctl reload prometheus
[root@10 prometheus]# systemctl restart alertmanager.service

钉钉报警

此处为隐藏的内容!
登录后方可查看!

监控SSL证书

继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
IT
  • 本文由 发表于 2020年3月23日12:24:42
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
完全删除zabbix zabbix

完全删除zabbix

停止服务 $ sudo systemctl stop zabbix-agent.service 简单直接暴力 $ sudo find / -name zabbix-agent | xargs rm -...
zabbix4.4配置自动发现 zabbix

zabbix4.4配置自动发现

配置->自动发现->创建发现规则   添加自动发现动作 配置->动作 事件源选自动发现 监测->自动发现 配置->主机