나는 MariaDB
모니터를 원해요 monit tools
. 내 monit script
것은:
check process mariadb_pid with pidfile /var/lib/mysql/db1.pid
check program telnet with path "/root/telnet.sh"
if status eq 99 then exec "/usr/bin/systemctl restart mariadb.service"
그리고 telnet script
는:
#!/bin/bash
cat /root/ips | \
while read host port; do
result=$(bash -c 'exec 3<> /dev/tcp/'$host'/'$port';echo $?' 2>/dev/null)
echo $result
if [ "$result" != "0" ]; then
exit 99
fi
done
ips
파일은 다음과 같습니다.
192.168.10.10 3306 192.168.10.20 3306
이제 ips 파일의 mariadb ip1 및 ip2가 닫히면 실행될 것으로 예상됩니다.
if status eq 99 then exec "/usr/bin/systemctl restart mariadb.service"
하지만 달리지는 마세요. 모니터링 로그를 확인해주세요.
[EST Mar 5 00:34:19] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:24] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:29] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:34] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:39] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:44] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:49] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:54] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:34:59] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:04] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:09] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:14] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:19] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:24] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:29] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:34] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:39] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:44] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:49] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:35:54] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:00] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:05] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:10] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:15] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:20] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:25] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:30] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:35] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:40] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:45] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:50] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:36:55] error : 'telnet' status failed (99) -- 1
또한 이 줄은 monit이 다시 시작될 때 처음으로 실행됩니다.
[EST Mar 5 00:39:05] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:10] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:15] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:20] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:25] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:26] info : Reinitializing monit daemon
[EST Mar 5 00:39:26] info : Reinitializing Monit -- control file '/etc/monitrc
[EST Mar 5 00:39:26] info : 'db1' Monit reloaded
[EST Mar 5 00:39:31] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:31] info : 'telnet' exec: '/usr/bin/systemctl restart mariadb.service'
[EST Mar 5 00:39:36] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:41] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:46] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:51] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:39:56] error : 'telnet' status failed (99) -- 1
[EST Mar 5 00:40:01] error : 'telnet' status failed (99) -- 1
누구든지 이것에 대한 경험이 있습니까?