1. Grafana+onealert alarm
Prometheus alarms need to use the alertmanager component, and the alarm rules need to be written manually (not friendly to operation and maintenance). So I choose grafana+onealert to call the police here. Note: Before realizing the alarm, check the time synchronization of all machines and then log in
to http://www.onealert.com/ → register an account → log in to the background management
1. Configure the Webhook URL in Grafana
① Create a Notification channel in Grafana, select the type as Webhook;
② It is recommended to select Send on all alerts and Include image, the Cloud Alert experience is better;
③ Fill in the Webhook URL generated in the first step into Webhook settings Url;
URL format:
http://api.aiops.com/alert/api/event/grafana/v1/ 3ebae767310c43cdaa3cd680013d0f19 / (Save the current application to get the complete webhook address information)④ Http Method select POST;
⑤ Send Test&Save;
created successfully
2. Test cpu load alarm
Now you can set an alarm to test (here we use the cpu load monitoring we added earlier to test)
#查看cpu占用率
(1- ((sum(increase(node_cpu_seconds_total{mode="idle"}[1m])) by(instance)) / (sum(increase(node_cpu_seconds_total[1m])) by(instance))))*100
test alarm
Download a stress test tool on the monitored end
yum install -y epel*
yum install -y stress
start testing