巡检脚本更新部署记录

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
相关推荐
IT 古月方源1 小时前
ospf 的 状态机详解
运维·网络·tcp/ip·智能路由器
九河云1 小时前
Amazon Bedrock Claude 3 在客户服务自动化中的应用方法
运维·人工智能·自动化·aws
hc_bmxxf1 小时前
Linux应用软件编程-多任务处理(进程)
linux·运维·服务器
M-C-B1 小时前
配置带外与更改密码
运维·服务器
猿经验2 小时前
tar.gz压缩文件在linux上解压异常问题:gzip:stdin:invalid compressed data
linux·运维·服务器
dawn2 小时前
通过GRE协议组建VPN网络
运维·网络·vpn·gre
m0_647999032 小时前
服务器分区与挂载(新手友好)
运维·服务器
跨境商城搭建开发2 小时前
一个服务器可以搭建几个网站?搭建一个网站的流程介绍
运维·服务器·前端·vue.js·mysql·npm·php
灰勒塔德2 小时前
Linux-----进程处理(文件IO资源使用)
linux·运维·算法
mqiqe2 小时前
Linux 安装rpm
linux·运维·数据库