巡检脚本更新部署记录

news/2024/5/19 0:57:27 标签: 运维, prometheus, servlet

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

http://www.niftyadmin.cn/n/4967307.html

相关文章

微服务(rpc)

微服务(rpc) 微服务必备的模块生产者消费者管理平台流量控制集群情况下如何做到流量监控 负载均衡服务发现和治理序列化传输序列化和反序列化 微服务是一种架构风格,将一个应用程序拆分为一组小型、独立的服务,每个服务都可以独立…

网络安全工具和资源推荐: 介绍网络安全领域中常用的工具、框架、资源和学习资料

章节1: 前言 随着数字化时代的不断深入,网络安全的重要性愈发凸显。在这个信息爆炸的时代,我们必须保护个人隐私、敏感数据以及网络基础设施免受各种威胁。本文将为您介绍一些网络安全领域中常用的工具、框架、资源和学习资料,帮助您更好地入…

一种采用KeePass+自建webdav服务的密码管理方案

一、概述 出于密码管理需求,查找了几种密码方案,发现KeePass坚果云keepass2android是大家反馈比较好的一种,支持电脑手机同步管理密码,深入使用后发现体验还不错,恰巧本身有公网ip,遂决定自建webdav服务来…

Prompt本质解密及Evaluation实战(二)

一、LangChain基于evaluation的prompt使用解析 我们来看下LangChain中关于prompt的使用,下面是取自LangChain源码中的一个经典的示例,描述了AI模型被授予访问几种工具来帮助回答用户的问题,其中“tool_descriptions”是至关重要的&#xff0…

基于redisson实现延时队列解耦业务

前言 今天跟大家分享的是一个基于redisson实现的延时队列,有个初版的封装工具,使用者只用关心延时时间到了取到的数据处理(或者之前处理,到时间只做剩下的业务),废话不多说,直接上货。 一、业务…

等保测评--安全区域边界--测评方法

安全子类--边界防护 a) 应保证跨越边界的访问和数据流通过边界设备提供的受控接口进行通信; 一、测评对象 网闸、防火墙、路由器、交换机和无线接入网关设备等提供访问控制功能的设备或相关组件 二、测评实施 1)应核查在网络边界处是否部署访问控制设备&#x…

c++ qt--页面布局(第五部分)

c qt–页面布局(第五部分) 一.页面布局 在设计页面的左侧一栏的组件中我们可以看到进行页面布局的一些组件 布局组件的使用 1.水平布局 使用:将别的组件拖到水平布局的组件中即可,可以选择是在哪个位置 2.垂直布局 使用&…

Spring之Spring案例分析

Spring案例分析 Spring案例分析 摘要引言词汇解释详细介绍不同领域的案例分析实战项目示例注意事项总结 参考资料 博主 默语带您 Go to New World. ✍ 个人主页—— 默语 的博客👦🏻 《java 面试题大全》 🍩惟余辈才疏学浅,临摹之…