服务监控 监控逻辑: 定时监控服务运行->发现监控服务异常->写入错误值1到文件->node_exporter采集文件状态值->通过Prometheus->Grafana设置预警规则->Grafana设置告警推送->人员修复->定时监控服务运行->发现监控服务正常->写入正确值0到文件->node_exporter采集文件状态值->通过Prometheus->Grafana设置预警规则->Grafana设置告警推送【OK】 node_exporter --collector.textfile.directory=./textfile_collector 定义文件目录,读取 middleware.prom nohup ./node_exporter \ --web.listen-address=:9100 \ --collector.textfile.directory=./textfile_collector \ > node_exporter.log 2>&1 & doc.... 服务监控 op
运维脚本 批量测试密码 脚本1 #!/bin/bash # 1、需要在同级目录准备测试文件,例:./test.txt;字段 ip port user pass; # 2、需要提前安装sshpass,(yum install sshpass 或 apt install sshpass)。 host_file="./test.txt" if [ ! -f "${host_file}" ];then echo "错误:${host_file} 文件不存在!" exit 1 fi echo "==================== SSH批量连通测试开始 ====================" while read -r ip port user pass <&3; do # 跳过注释、空行 if [[ -z "${ip}" || "${ip}" =~ ^# ]];then continue fi echo "正在检测:${user}@${ip}:${port}" sshpass -p "${pass}" ssh \ -o StrictHostKeyChecking=no .... 有更新! 运维脚本 op