ssl - monit:监控证书

标签 ssl certificate monit

我目前正在尝试监控我的系统证书,以确保在过期前 30 天收到警报。作为示例,我以 google.com 为例并监控其证书。查看 monitrc 文件,我添加了这个:

check host google.com with address google.com
            if failed
                    port 443
                    protocol https
                    with ssl options {verify: enable}
                    certificate valid > 1095 days
            then alert

当我重新启动 monit 时出现错误,没有名为 google.com 的服务

最佳答案

当设置新的 monit 配置或更改/编辑当前配置时,应首先重新加载以确保 monit 重新初始化守护进程

重现问题

# Edit monit config
root@home:~# vim /etc/monit/conf-enabled/test

# Restart right way will fail
root@home:~# monit restart all
There is no service named "google.com"

# Logs
[CEST Sep 12 19:16:29] info     : 'home' trying to restart
[CEST Sep 12 19:16:29] info     : 'home' restart action done
[CEST Sep 12 19:17:09] info     : 'home' restart on user request
[CEST Sep 12 19:17:09] error    : HttpRequest: error -- client [::1]: HTTP/1.0 400 There is no service named "google.com"
[CEST Sep 12 19:17:09] error    : There is no service named "google.com"

解决方案

# Edit monit config
root@home:~# vim /etc/monit/conf-enabled/test

# Reload to reinitialize monit
root@home:~# monit reload
Reinitializing monit daemon

root@home:~# monit status
Monit 5.25.2 uptime: 24m

Remote Host 'google.com'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  port response time           878.069 ms to google.com:443 type TCP/IP using TLS (certificate valid for 69 days) protocol HTTP
  data collected               Thu, 12 Sep 2019 19:24:06

关于ssl - monit:监控证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55945079/

相关文章:

c++ - SCHANNEL TLS 服务器端无法 CertFindCertificateInStore

java - 使用可信证书签署我的小程序

linux - 使用 supervisord 优于 monit 有什么优势

监视 "cron-like"任务

java - 通过 HTTP SSL 的流未被刷新

ssl - 将 GoDaddy DNS 指向 GitHub 页面使用 http over https

java - 在 Apache 和游戏服务器之间拆分 https

python-3.x - 读取 pem 证书期间 python 3.6 出现 x509 错误

java - 无法为 Java 应用程序安装 SSL 证书