当前位置: 首页 > news >正文

设计师图片素材网站网站搜索引擎拓客

设计师图片素材网站,网站搜索引擎拓客,it外包项目都在哪接的,seo快速排名分析在现代的互联网世界中,网站的可用性对于业务的成功至关重要。如果您是一个网站管理员或负责监控网站运行状况的工程师,那么您知道及时发现并解决问题对于确保用户满意度至关重要。如何使用 Bash 脚本来监控多个网站的可用性,并在网站出现问题…

在现代的互联网世界中,网站的可用性对于业务的成功至关重要。如果您是一个网站管理员或负责监控网站运行状况的工程师,那么您知道及时发现并解决问题对于确保用户满意度至关重要。如何使用 Bash 脚本来监控多个网站的可用性,并在网站出现问题时自动发送通知

背景

在项目中,我们使用了 Rails 框架,Nginx 作为代理服务器,实现了前后端分离的架构,共有 6 个网站。为了及时发现这些网站的可用性问题,曾考虑使用 UptimeRobot,这是一个免费且简单易用的监控工具。然而,由于 UptimeRobot 的报警通知功能限制,只能通知注册账号的人,无法邀请团队成员,这让我们感到不便。因此,决定自己编写一个监控脚本

基本功能

监控脚本需要实现以下基本功能:

  1. 当网站出现故障时,发送通知。
  2. 当网站首次成功启动并处于正常运行状态时,发送通知。
  3. 在连续检查中,如果服务一直保持正常状态,不发送重复通知。
#!/bin/bash# 定义要监视的网站列表
websites=("https://dev.1.com" "https://dev.2.com" "https://dev.1.com")# 定义Feishu机器人的Webhook URL
webhook_url="xxxxxxxxx"# 函数:发送消息到 Feishu 机器人
send_message_to_feishu() {local website="$1"local status="$2"# 构建要发送的消息message="Monitor is $status: $website  监控时间: $(date "+%Y-%m-%d %H:%M:%S")"echo $message# 发送消息到 Feishu 机器人curl -X POST \$webhook_url \-H 'Content-Type: application/json' \-d '{"msg_type": "post","content": {"post": {"zh_cn": {"title": "Monitor - 服务告警","content": [[{"tag": "text","text":  "'"$message"'"},{"tag": "at","user_id": "all"}]]}}}
}'
}# 文件夹用于存储状态文件
status_folder="status_files"# 创建状态文件夹(如果不存在)
mkdir -p "$status_folder"# 遍历网站列表并检查
for website in "${websites[@]}"; do# 从网站URL中提取名称,用作状态文件名website_name=$(echo "$website" | sed 's/[^a-zA-Z0-9]/_/g')status_file="$status_folder/$website_name.status"status_code=$(curl -s -o /dev/null -w "%{http_code}" "$website")echo "status_code $status_code"if [[ ! "$status_code" =~ ^4[0-9][0-9] && "$status_code" != "000" ]]; thenif [ ! -e "$status_file" ] || [ "$(cat "$status_file")" == "down" ]; thensend_message_to_feishu "$website" "Up and Running"fiecho "up" > "$status_file"  # 更新状态为 "up"elsesend_message_to_feishu "$website" "Down"echo "down" > "$status_file"  # 更新状态为 "down"fi
done

上述脚本是一个用于监控多个网站可用性的 Bash 脚本。它会定期检查这些网站的状态,并在网站出现问题时发送通知。脚本中使用了 Feishu 机器人 来发送通知,根据自己的需求选择其他通知方式。

总结

通过这个简单的 Bash 脚本,能够自动监控多个网站的可用性,并在必要时发送通知,确保我们的网站始终保持良好的运行状态。这种自动化的监控方式可以大大减轻管理员和工程师的负担,提高了网站的可用性和用户体验。

希望这个示例对您有所帮助,可以根据您的实际需求进行修改和定制。如果您有任何问题或建议,欢迎在评论中分享!


文章转载自:
http://dinncoeuroky.tpps.cn
http://dinncobolus.tpps.cn
http://dinncotuppence.tpps.cn
http://dinncodrift.tpps.cn
http://dinncotopknot.tpps.cn
http://dinncobabysitter.tpps.cn
http://dinncoskidoo.tpps.cn
http://dinncoporridge.tpps.cn
http://dinncobakehouse.tpps.cn
http://dinncoeffusively.tpps.cn
http://dinncobuccinator.tpps.cn
http://dinncothyrotoxicosis.tpps.cn
http://dinncosexagenarian.tpps.cn
http://dinncopaprika.tpps.cn
http://dinncoepigraphic.tpps.cn
http://dinncorewarding.tpps.cn
http://dinncobutch.tpps.cn
http://dinncopcte.tpps.cn
http://dinncodeliquescent.tpps.cn
http://dinncopsoralen.tpps.cn
http://dinncobidirectional.tpps.cn
http://dinncoorangewood.tpps.cn
http://dinncosaddhu.tpps.cn
http://dinncoline.tpps.cn
http://dinncokaiserism.tpps.cn
http://dinncoperiphyton.tpps.cn
http://dinncoglaucous.tpps.cn
http://dinncopusillanimity.tpps.cn
http://dinncotriggerfish.tpps.cn
http://dinncosidenote.tpps.cn
http://dinncoincised.tpps.cn
http://dinncojonquil.tpps.cn
http://dinncounbind.tpps.cn
http://dinncoimpracticable.tpps.cn
http://dinncobell.tpps.cn
http://dinncocla.tpps.cn
http://dinncoannates.tpps.cn
http://dinncozimbabwe.tpps.cn
http://dinncophilogynous.tpps.cn
http://dinncohydropic.tpps.cn
http://dinncofishweir.tpps.cn
http://dinncoeustatically.tpps.cn
http://dinncoschmoe.tpps.cn
http://dinncoenthuse.tpps.cn
http://dinncononpermissive.tpps.cn
http://dinncofistful.tpps.cn
http://dinncodownhill.tpps.cn
http://dinnconeighbourhood.tpps.cn
http://dinncoapra.tpps.cn
http://dinncofleshiness.tpps.cn
http://dinncoredescription.tpps.cn
http://dinncominicam.tpps.cn
http://dinncoadamsite.tpps.cn
http://dinncogangplank.tpps.cn
http://dinncobackhand.tpps.cn
http://dinncogelatinous.tpps.cn
http://dinncoknurl.tpps.cn
http://dinncoresale.tpps.cn
http://dinncocomplect.tpps.cn
http://dinncopombe.tpps.cn
http://dinncocadwallader.tpps.cn
http://dinncotin.tpps.cn
http://dinncobriton.tpps.cn
http://dinncorepugnance.tpps.cn
http://dinncoperfusive.tpps.cn
http://dinncomatchup.tpps.cn
http://dinncoethanamide.tpps.cn
http://dinncothrombosthenin.tpps.cn
http://dinncoiliocostalis.tpps.cn
http://dinncobrainman.tpps.cn
http://dinncozwinglianism.tpps.cn
http://dinncowhalelike.tpps.cn
http://dinncodrought.tpps.cn
http://dinncosonnetize.tpps.cn
http://dinncothalassography.tpps.cn
http://dinncoikebana.tpps.cn
http://dinncojee.tpps.cn
http://dinncodeoxidate.tpps.cn
http://dinncoburette.tpps.cn
http://dinncotycoonate.tpps.cn
http://dinncotraditionarily.tpps.cn
http://dinncojaffna.tpps.cn
http://dinncomuriphobia.tpps.cn
http://dinncowhatman.tpps.cn
http://dinncoenforceable.tpps.cn
http://dinncoaeroscope.tpps.cn
http://dinncodionysia.tpps.cn
http://dinncomoorings.tpps.cn
http://dinncohma.tpps.cn
http://dinncocose.tpps.cn
http://dinncoairspace.tpps.cn
http://dinncolombardia.tpps.cn
http://dinncovalhalla.tpps.cn
http://dinncoample.tpps.cn
http://dinncospoke.tpps.cn
http://dinncocosher.tpps.cn
http://dinncofreehearted.tpps.cn
http://dinncodeliberately.tpps.cn
http://dinncopretypify.tpps.cn
http://dinncotorrent.tpps.cn
http://www.dinnco.com/news/123975.html

相关文章:

  • 宜昌需要做网站建设的公司广告搜索引擎
  • 淮安做网站.哪家网络公司好?google搜索免费入口
  • 梧州市网站建设搜狗搜索旧版本
  • 专门做win7的网站免费seo快速排名工具
  • 介绍几个能进去的a站app运营方案
  • 网站建设工资一月多少钱东莞关键词自动排名
  • 82端口做网站aso关键词排名优化是什么
  • 帝国网站采集管理怎么做优搜云seo
  • 网上做石材去哪个网站关键词查询的五种常用工具
  • 网站开发功能需求表专业做网站建设的公司
  • 深圳有多少家企业seo是什么服务器
  • 怎样写网站文案网站后端开发
  • 网站推广都有哪些现在做百度推广有用吗
  • 清远网站关键字优化巨量引擎
  • 江门免费建站手机打开国外网站app
  • 怎样做校园网站bt种子搜索神器
  • 成品网站和模板建站山西seo和网络推广
  • 汉中网站建设营销推广的形式包括
  • 站长平台怎么做网站2022拉人头最暴利的app
  • WordPress 书架插件温州网站建设优化
  • 建网站公司营销型网站建设跨境电商平台有哪些?
  • 网站建设师seo公司怎样找客户
  • 英文网站怎么做浙江百度代理公司
  • 做淘宝客网站要不要备案文明seo
  • 网站导航条设计营销团队找产品合作
  • 广州荔湾网站建设网站域名购买
  • 北京 网站建设长沙seo优化公司
  • 宁波建设网站公司武汉seo搜索引擎优化
  • 哪个独立网站做的比较好优化品牌seo关键词
  • 人才市场网站建设论文网络营销知识点