运维八一 运维八一
首页
运维杂记
编程浅尝
周积跬步
专栏
生活
关于
收藏
  • 分类
  • 标签
  • 归档
Source (opens new window)

运维八一

运维,运维!
首页
运维杂记
编程浅尝
周积跬步
专栏
生活
关于
收藏
  • 分类
  • 标签
  • 归档
Source (opens new window)
  • 操作系统

  • 域名解析

  • 公有云

  • CI&CD

    • Jenkins安装及常用插件
    • Jenkins配置回滚
    • Jenkins不显示maven
    • Jenkins添加健康检查
      • 1. chkhealth函数
      • 2. 添加函数
        • 3. 修改变量
    • k8s+jenkins+helm+springboot部署
  • 数据库

  • 负载均衡&反向代理

  • 存储系统

  • 容器&容器编排

  • 批量管理

  • 邮件系统

  • 监控系统

  • Web服务

  • 虚拟化

  • 防火墙

  • 压测

  • 文件同步

  • 私有云

  • 日志系统

  • 代码仓库&版本管理

  • 安全审计

  • 远程拨号

  • 大数据

  • 统一认证

  • 消息队列

  • Apollo

  • 运维杂记
  • CI&CD
lyndon
2022-09-30
目录

Jenkins添加健康检查

# 1. chkhealth函数

在每个JOB的command位置增加,在monitor 上面增加函数

chkhealth() {
#根据每个工程的启动时间修改
sleep 30s
#如果端口不是eth0请修改
ip=$(/sbin/ifconfig eth0|grep inet|head -n 1|awk '{print $2}')
修改为每个工程的端口
port="8080"
http_code=`curl -m 3 -o /dev/null -s -w %{http_code} "http://$ip:$port"`
if [ "${http_code}" -eq "200" ];then
echo "check $ip sucess status is ${http_code}"

elif [ "${http_code}" -eq "301" ];then
echo "check $ip sucess status is ${http_code}"

elif [ "${http_code}" -eq "302" ];then
echo "check $ip sucess status is ${http_code}"

elif [ "${http_code}" -eq "401" ];then
echo "check $ip sucess status is ${http_code}"

elif [ "${http_code}" -eq "403" ];then
echo "check $ip sucess status is ${http_code}"

elif [ "${http_code}" -eq "404" ];then
echo "check $ip sucess status is ${http_code}"
elif [ "${http_code}" -eq "405" ];then
echo "check $ip sucess status is ${http_code}"

else
echo "check $ip fail status is ${http_code}"
fi
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

# 2. 添加函数

在主函数 function monitor() 最下面增加

chkhealth

# 3. 修改变量

sleep 的时间 根据每个工程的启动时间修改

ip 如果端口不是eth0请修改

port 修改为每个工程的端口

上次更新: 2022/09/30, 15:27:27
Jenkins不显示maven
k8s+jenkins+helm+springboot部署

← Jenkins不显示maven k8s+jenkins+helm+springboot部署→

最近更新
01
ctr和crictl显示镜像不一致
03-13
02
alpine镜像集成常用数据库客户端
03-13
03
create-cluster
02-26
更多文章>
Theme by Vdoing | Copyright © 2015-2024 op81.com
苏ICP备18041258号-2
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式