巡检脚本更新部署记录

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
相关推荐
上海文顺负载箱7 分钟前
如何评估焊机测试负载均衡性能
运维·负载均衡
铁锤妹妹头发多1 小时前
新手用docker真**难受
运维·docker·容器
超栈1 小时前
HCIP(11)-期中综合实验(BGP、Peer、OSPF、VLAN、IP、Route-Policy)
运维·网络·网络协议·计算机网络·web安全·网络安全·信息与通信
Cachel wood1 小时前
Github配置ssh key原理及操作步骤
运维·开发语言·数据库·windows·postgresql·ssh·github
编程一生1 小时前
回调数据丢了?
运维·服务器·前端
华为云PaaS服务小智2 小时前
华为大咖说 | 浅谈智能运维技术
运维·华为·华为云
zhd15306915625ff4 小时前
化工厂主要涉及的自动化备件有哪些?
运维·自动化·化工厂
Jason-河山4 小时前
利用API返回值实现商品信息自动化更新:技术与实践
运维·自动化
wowocpp4 小时前
查看 linux ubuntu 分区 和 挂载 情况 lsblk
linux·运维·ubuntu
_.Switch8 小时前
高级Python自动化运维:容器安全与网络策略的深度解析
运维·网络·python·安全·自动化·devops