基于服务状态的 Stackdriver 警报

Stackdriver Alert based on service status

是否可以根据自定义服务的状态设置警报。例如,stackdriver-agent 服务一度崩溃。当 运行 'service stackdriver-agent status" 时,我收到 'Active: inactive (dead)' 响应。

是否可以根据上述条件设置警报? stackdriver-agent 服务只是一个例子。理论上,我想在任何服务上设置此警报条件。

答案是肯定的。在 Stackdriver 中,您可以为机器中的任何进程设置警报。选择选项 Add Process Health Condition you can configure alarms to receive notifications if your process starts or stops. Bear in mind that you first have to set up the Stackdriver Agent in your machine and that this option is only available in Stackdriver premium.

Thrahir 的回答很好,尽管 UI 从那以后发生了变化(单击 "Metric" 和 "Uptime Check" 旁边的右箭头以查看其他条件类型;"Process Health" 是最后一个)。

如果您的服务是服务器,您可能更愿意使用正常运行时间检查 (https://cloud.google.com/monitoring/uptime-checks/) 来监控其状态;与直接监控您的流程相比,这可以让您更好地模拟服务用户将看到的内容。

Aaron Sher,Stackdriver 工程师