在 CentOS 里,“trigger” 这个词常见于几种不同场景,先帮你梳理一下,再给出对应的监控方法。
CentOS 7+ 使用 systemd,trigger 通常指:
systemctl triggersystemctl list-triggers
或查看某个服务:
systemctl show xxx.service | grep Triggers
journalctl -u xxx.service -f
或全局看触发:
journalctl -f | grep -i trigger
journalctl -p 3 -xb
比如:
yum install inotify-tools
inotifywait -m /path/to/dir
inotifywait -m -e create -e modify /data |
while read path action file
do
echo "$file $action"
done
cat /var/log/cron
systemctl list-timers
journalctl -u your.timer -f
mysqlbinlog /var/lib/mysql/mysql-bin.000001
SELECT * FROM pg_trigger;
结合日志:
tail -f /var/lib/pgsql/data/log/postgresql.log
可以告诉我:
我可以直接给你可复制的配置或脚本。