阿里云如何通过函数计算和云监控服务监控消息服务MNS的消费堆积情况
阿里云消息服务MNS并没有自带堆积预警配置,如果消费有问题就会发生生产故障。通过函数计算做一个定时执行函数发送队列状态到云监控,再通过云监控配置预警即可。 函数实现明细build.gradle123456789101112dependencies { compile group: 'com.aliyun.mns', name: 'aliyun-sdk-mns
阿里云消息服务MNS并没有自带堆积预警配置,如果消费有问题就会发生生产故障。通过函数计算做一个定时执行函数发送队列状态到云监控,再通过云监控配置预警即可。 函数实现明细build.gradle123456789101112dependencies { compile group: 'com.aliyun.mns', name: 'aliyun-sdk-mns
1System.out.println("value: "+ System.getenv("key")); 参考:https://help.aliyun.com/document_detail/164354.html?spm=5176.11065259.1996646101.searchclickresult.45e05493j4M6UG
5分钟时间窗口,上游服务response time大于1秒的数量 1*| SELECT time_series(__time__, '5m', '%Y-%m-%d %H:%i:%s' ,'0') as Time, count(1) as T where upstream_response_time > 1 group by Time order
配置Nginx 1vim /etc/nginx/nginx.conf Nginx新增一个日志格式 123log_format timed_combined '$remote_addr - $remote_user [$time_local] "$request" $http_host ' '$status $request_length $body_bytes_sent "$http_referer" ' '"$http_user_agent" $request_time $upstream_response_time "$sent_http_content_type"'; 设置日志输出路径 1access_log /var/log/nginx/aliyun.log timed_combined; 重新加载Nginx 1nginx -s reload