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