首页 > 编程知识 正文

监控服务端返回消息错误什么意思,监控摄像头怎么设置自动报警

时间:2023-05-05 11:47:37 阅读:113654 作者:4362

服务监控警告——钉扎群机器人1、新钉扎群机器人2、shell脚本编写3、计时器任务4、部分效果截图

本文给出了利用钉钉群监测、预警服务的情况。

1、新建钉钉群机器人

2、写shell脚本#! /xhdxh/bash#端口port _ nginx=' 80 ' port _ MySQL=' 3306 ' # .此处省略多个端口。 只要根据自己的需求进行配置,port_flink='XXX'#NIC配置(可选) # ifconfig='eth0'#@管理员手机号码user='xxx'# user2='xx'#主机信息date=date%y-% ) ) ) ) ) 652 date ' % y-% m-% d-% h : % m : % s ' ` host _ name=` hostname ` IP _ addde ' : nginx ' MySQL _ status=` netstat-lntup|grep-w ' $ potus flink _ status=` netstat-lntup|grep -根据自己的需要钉钉webhookDingding_Url='粘贴您新创建的钉钉群机器人web hook ' functionsenddownmessagetodingding () #钉钉消息curl-s ' $ '-h ' content-type : application/JSON '-d ' { ' msgtype ' : ' text ',' text ' : { ' content ' : ' XXX sa ' at ' 3360 { ' at mobiles ' 3360 [ ' $ {用户} ], ' isatall ' : true } } functionsendupmessagetodingding () {#尖峰消息curl-s ' $ { dingding _ URL }-h ' content-troding ' text': {'content': 'xxx服务监视n$1服务运行正常。 n巡逻时间: ${Date_time}nIP地址: ${IP_addr}n'}、' at ' 3360 { ' at mobiles ' 3360 [ ' $ { user } ]、 ' isatall ' : true } } # logpathlog _ path=' XXX ' #导线测量#for i in #{$Nginx_status,$MySQL_status,$ jobseratus $workbench_status、$keycloak_status、$vro#llout_status, $ connectus $ flink _ status } # do # name=` echo $ I|awk-f ' : ' { print $2} ` # echo1$ { log _ path }/$ { nn $openapi_status、$userapi_status、$workbench_s $connector_status、$shadow_status、 $ flink _ status } dostat code=` echo $ I|awk-f ' : ' {打印$1} ' ` name=` echo $ I|awk-f ' 3360 ' { } $ { status _ code=$ stat code ' else echo ' [ error ] $ nameisstopped! status _ code=$ stat code ' senddownmessagetoding $ namefielseif [ $ old _ stat code-ge1 ] thenecho ' [ info ] $ name if stastat status _ code=$ stat code ' sendupmessagetoding $ name fiecho $ stat code $ { log _ path }/$ { name }.log done 3,定时任务

crontab -e#每5分钟运行*/5 * * * * sh xx.sh#分钟。 */30 * * * * sh xx.sh#每天15点25分运行25 15 * * * sh xx.sh命令。

crontab -u //设置特定用户的计时器服务crontab -l //列出当前用户的计时器服务内容crontab -r //删除当前用户的计时器服务crontab -e //当前用户的计时器服务crontab -l 4,部分效果截图

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。