巡检脚本更新部署记录

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
相关推荐
卑微的码蚁23 分钟前
服务器相关问题
运维·服务器
博洋科技25 分钟前
网站建设的服务器该如何选择?
运维·服务器·网站建设·保定响应式网站建设·保定h5网站建设·保定网站建设
人类群星闪耀时30 分钟前
服务器管理:从零开始的服务器安装与配置指南
运维·服务器
NiNg_1_2341 小时前
使用Docker Compose一键部署
运维·docker·容器
萠哥啥都行1 小时前
Linux安装Docker以及Docker入门操作
运维·docker·容器
小江湖19941 小时前
元数据保护者,Caesium压缩不丢重要信息
运维·学习·软件需求·改行学it
gopher95111 小时前
linux驱动开发-中断子系统
linux·运维·驱动开发
吃面不喝汤662 小时前
如何配置和使用自己的私有 Docker Registry
运维·docker·容器
Rookie_explorers3 小时前
Linux下go环境安装、环境配置并执行第一个go程序
linux·运维·golang
学习向前冲3 小时前
AD域控服务器
运维·服务器