ini
[Unit]
OnFailure=failover-alert@%i.service[Service]
ExecStopPost=/usr/local/bin/health-check.sh配套的failover-alert.service :
ini [Service] Type=oneshot ExecStart=/usr/bin/curl -X POST http://alert-gateway/trigger这种架构实现了:
1. 主服务异常时触发告警
2. ExecStopPost执行最终状态检查
3. 可扩展对接Prometheus等监控系统对于数据库等有依赖顺序的服务