巡检脚本更新部署记录

1、下载最新的inspection压缩包

#备份
mv /root/inspection /root/inspection.bak

#下载inspection.zip到AG
ossutil64 cp -f oss://xxxxx/scripts/xxxxxx/latest.zip latest.zip --config-file /var/lib/jenkins/.ossutilconfig

#解压
unzip /root/latest.zip

2、修改config文件

脚本中的APP/ENVIRONMENT/ALDABA_VERSION变量从config中取值,ENABLED控制脚本的开关(ENABLED=1为开,=0为关)

不同环境修改ENVIRONMENT

vim /root/inspection/config

APP=xxxxx
ENVIRONMENT=xxxxx
ENABLED=1

3、修改推送脚本push_metrics.sh

不同环境修改JOB_NAME

vim /root/inspection/push_metrics.sh

#!/bin/bash
PUSHGATEWAY_SERVER=http://xxxxx.xxxxx.xxxx.xxxx.com
JOB_NAME=xxxxxx
curl -s localhost:9100/metrics | curl --data-binary @- $PUSHGATEWAY_SERVER/metrics/job/$JOB_NAME

4、手动触发验证执行是否成功

(1)如打包上传,会存在格式问题,需用dos2unix转换格式

dos2unix /root/inspection/oneconf_download.sh
dos2unix /root/inspection/config
dos2unix /root/inspection/push_metrics.sh

dos2unix /root/inspection/connections/run.sh
dos2unix /root/inspection/core_dump_file_found/run.sh
dos2unix /root/inspection/directory_size/run.sh
dos2unix /root/inspection/disk_size/run.sh
dos2unix /root/inspection/limits/run.sh
dos2unix /root/inspection/mount_error/run.sh
dos2unix /root/inspection/open_ports/run.sh
dos2unix /root/inspection/process_total_error/run.sh
dos2unix /root/inspection/service_enabled/run.sh
dos2unix /root/inspection/system_contract_error/run.sh
dos2unix /root/inspection/config_error/aldaba_file_runtime/run.sh
dos2unix /root/inspection/config_error/aldaba_oneconf_file/run.sh
dos2unix /root/inspection/config_error/storage_service_oneconf_file/run.sh

(2)替换完成后bash执行一遍

bash /root/inspection/oneconf_download.sh
bash /root/inspection/push_metrics.sh

bash /root/inspection/connections/run.sh
bash /root/inspection/core_dump_file_found/run.sh
bash /root/inspection/directory_size/run.sh
bash /root/inspection/disk_size/run.sh
bash /root/inspection/limits/run.sh
bash /root/inspection/mount_error/run.sh
bash /root/inspection/open_ports/run.sh
bash /root/inspection/process_total_error/run.sh
bash /root/inspection/service_enabled/run.sh
bash /root/inspection/system_contract_error/run.sh
bash /root/inspection/config_error/aldaba_file_runtime/run.sh
bash /root/inspection/config_error/aldaba_oneconf_file/run.sh
bash /root/inspection/config_error/storage_service_oneconf_file/run.sh

5、修改定时任务

crontab -e

*/1 * * * * bash /root/inspection/oneconf_download.sh
*/1 * * * * bash /root/inspection/push_metrics.sh

*/1 * * * * bash /root/inspection/connections/run.sh
*/1 * * * * bash /root/inspection/core_dump_file_found/run.sh
*/1 * * * * bash /root/inspection/directory_size/run.sh
*/1 * * * * bash /root/inspection/disk_size/run.sh
*/1 * * * * bash /root/inspection/open_ports/run.sh
*/1 * * * * bash /root/inspection/process_total_error/run.sh

*/10 * * * * bash /root/inspection/limits/run.sh
*/10 * * * * bash /root/inspection/mount_error/run.sh
*/10 * * * * bash /root/inspection/service_enabled/run.sh
*/10 * * * * bash /root/inspection/system_contract_error/run.sh
*/10 * * * * bash /root/inspection/config_error/aldaba_file_runtime/run.sh
*/10 * * * * bash /root/inspection/config_error/aldaba_oneconf_file/run.sh
*/10 * * * * bash /root/inspection/config_error/storage_service_oneconf_file/run.sh


crontab -l
#查看crond服务状态
systemctl status crond

6、查看指标更新

cd /var/lib/node_exporter/textfile_collector
相关推荐
sun0077001 小时前
ubuntu dpkg 删除安装包
运维·服务器·ubuntu
吃肉不能购3 小时前
Label-studio-ml-backend 和YOLOV8 YOLO11自动化标注,目标检测,实例分割,图像分类,关键点估计,视频跟踪
运维·yolo·自动化
学Linux的语莫3 小时前
Ansible使用简介和基础使用
linux·运维·服务器·nginx·云计算·ansible
qq_312920113 小时前
docker 部署 kvm 图形化管理工具 WebVirtMgr
运维·docker·容器
学Linux的语莫3 小时前
搭建服务器VPN,Linux客户端连接WireGuard,Windows客户端连接WireGuard
linux·运维·服务器
黑牛先生3 小时前
【Linux】进程-PCB
linux·运维·服务器
Karoku0663 小时前
【企业级分布式系统】ELK优化
运维·服务器·数据库·elk·elasticsearch
安迁岚5 小时前
【SQL Server】华中农业大学空间数据库实验报告 实验三 数据操作
运维·服务器·数据库·sql·mysql
打码人的日常分享5 小时前
商用密码应用安全性评估,密评整体方案,密评管理测评要求和指南,运维文档,软件项目安全设计相关文档合集(Word原件)
运维·安全·web安全·系统安全·规格说明书