hc - python

Grafana alerts 健康检查

我们可以在Grafana的panel中设置alert
当报警触发, 我们有另外的程序会捕捉到它, 并通过创建jira工单的方式, 通报给相应的Team去处理
为了能成功创建jira工单, 我们需要在报警内容中以特定的格式提供Summary/Category/Priority/Description等内容
于是我开发一个程序, 定期检查Grafana上所有alerts的格式是否符合要求. 检查结果以表格形式交付到MySQL, 展示于Grafana

Grafana 定制化报告

这个程序用于统计Grafana上, 当前有多少个Org(Team), 每个Org(Team)创建了多少个Folder, 每个Folder中有多少个Dashboard
报告以表格形式交付到MySQL, 展示于Grafana
后面如果需要, 我们可以探索进更深的层次, 到Dashboard中, 看它里面有哪些内容
我们还可以创建panel, 将历史结果组织起来, 画一个趋势图, 展示出量的变化

Caller 自动拨打电话

这个程序有3个的组件
MonitorQ用于收集High/Critical级别的JIRA工单, 解析其所属Team, 确定oncall人员及电话号码
Scanner用于控制拨打流程, 用户接没接电话, 按没按确认键, 要不要重复拨打, 等等
CallAPI用于整理待拨打数据, 交给下游Genesys去执行拨打电话
另外, 还有一个程序, 叫scaner_guard, 用于保护scanner, 它很重要. 一是容器要存活, 二是容器内部要在正常运转, 不能假死

PROD [root@whdcbosd001 scanner_guard]# ps aux |grep 'scanner_guard' |grep -v 'grep'
root     110143  0.0  0.3 245564 23720 ?        S    Sep21   4:06 /opt/servicedesk/scanner_guard/venv/bin/python3 /opt/servicedesk/scanner_guard/scanner_guard.py
PROD [root@whdcbosd001 scanner_guard]# docker ps -a |grep -E "oncallsolution"
11f72eef486a   caller_api_oncallsolution     "/bin/sh -c '\"python…"   7 weeks ago    Up 7 weeks    0.0.0.0:8008->8008/tcp                           theapi_oncallSolution
388eecf74b28   thescanner_oncallsolution     "/bin/sh -c '\"python…"   7 weeks ago    Up 3 hours                                                     scanner_oncallsolution
a25cdf472188   ticketcol_oncallsolution      "/bin/sh -c '\"python…"   7 weeks ago    Up 7 weeks                                                     ticketcol_oncallsolution
PROD [root@whdcbosd001 scanner_guard]#
posted @ 2022-11-16 09:43  奔驴儿2  阅读(210)  评论(0编辑  收藏  举报