我使用 Monit 来监控 MariaDB,但是当推出 MariaDB 的小更新时,Monit 无法监控,因为校验和已经发生了变化:
Checksum failed Service mysql_bin
Description: checksum failed, expected af2e102140d77547325043f7455bf066 got 31504246e59e43692b6b4979b2664ab8
这是我的 MariaDB 配置:
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
group mysql
start program = "/etc/init.d/mariadb start"
stop program = "/etc/init.d/mariadb stop"
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart
if 5 restarts with 5 cycles then timeout
depend mysql_bin
depend mysql_rc
check file mysql_bin with path /usr/sbin/mysqld
group mysql
include /etc/monit/templates/rootbin
check file mysql_rc with path /etc/init.d/mariadb
group mysql
include /etc/monit/templates/rootbin
我知道再次监控服务的唯一方法是重新启动服务器,有没有办法自动重建校验和或让 Monit 忽略校验和?
日志:
[2024-02-10T06:45:50+1100] error : 'mysql_bin' checksum failed, expected b9bb633ea538cdb7bb39b956d6d3601d got afc49fc5a024a4f7473670a81d23e539
[2024-02-10T09:09:01+1100] info : Monit daemon with pid [1566] stopped
[2024-02-10T09:09:01+1100] info : 'syd5.mydomain.com' Monit 5.31.0 stopped
with http interface at [localhost]:2812
[2024-02-10T09:09:24+1100] info : 'syd5.mydomain.com' Monit 5.31.0 started
[2024-02-10T09:23:28+1100] error : 'mysqld' process is not running
[2024-02-10T09:23:28+1100] info : 'mysqld' trying to restart
[2024-02-10T09:23:28+1100] info : 'mysqld' start: '/etc/init.d/mariadb start'
[2024-02-10T09:25:28+1100] info : 'mysqld' process is running with pid 3715
答案1
重新启动/重新加载 monit 应该重建使用的校验和(另请参阅MariaDB 重新安装并升级到新版本后,Monit 提示校验和失败)。