百度已收录

服务器监控-哪吒探针

超耐磨泡泡 108 0

一个开源、轻量的服务器和网站监控、运维工具。支持一键脚本安装面板和监控服务,轻松使用;Linux、Windows、MacOS、OpenWRT等主流系统均受支持。支持同时监控多个服务器的系统状态,支持监控网页、端口、SSL证书状态;支持故障、流量等状态报警,支持多种通知方式(Telegram、邮件、微信等)

GitHub仓库:https://github.com/naiba/nezha
官方文档:https://nezhahq.github.io/

哪吒监控接入 Github、Gitlab、Jihulab、Gitee 作为后台管理员账号

  • 首先我们需要新建一个验证应用,以 Github 为例,登录 Github 后,打开 https://github.com/settings/developers ,依次选择“OAuth Apps” - “New OAuth App”
    Application name - 随意填写
    Homepage URL - 填写面板的访问域名,如:"http://cnmpp.com/"
    Authorization callback URL - 填写回调地址,如:"http://cnmpp.com/oauth2/callback"
  • 点击 “Register application”
  • 保存页面中的 Client ID,然后点击 “Generate a new client secret“,创建一个新的 Client Secret,新建的密钥仅会显示一次,请妥善保存

在linux中安装 Dashboard(监控面板)

如果没有curl请安装:yum -y install curl

# 国外机
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh  -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh

# 国内机
curl -L https://jihulab.com/nezha/nezha/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
# 安装/升级 遇到docker启动失败问题先用旧脚本 
curl -L https://raw.githubusercontent.com/naiba/nezha/851a3dfe1fc78c5420caad45e5312821e50bde54/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh

# Daocloud 镜像站点现在还是装的老版本docker,没有自带compose插件…新脚本只是取消了下载docker-compose,遇到问题可以先用旧的

安装过程

  • 默认选择GitHub,回车
  • 输入Client ID,回车
  • 输入Client Secret,回车
  • 输入GitHub账户

面板默认监听8008端口
面板安装完就可以访问IP+端口

配置反向代理

  • 在宝塔面板中新建一个站点,域名填写公开访问域名,如 “cnmpp.com“ ,然后点击“设置”进入站点设置选项,选择“反向代理” - “新建反向代理”
  • 自定义一个代理名称,在下方“目标 URL”中填入 http://127.0.0.1 然后点击“保存”
  • 打开刚刚新建的反向代理右边的“配置文件”,将配置文件替换为以下内容:
#PROXY-START/
location / {
    proxy_pass http://127.0.0.1:8008;
    proxy_set_header Host $http_host;
    proxy_set_header      Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$  {
    proxy_pass http://127.0.0.1:8008;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
}
#PROXY-END/

如何更新 Dashboard?

运行脚本 ./nezha.sh ,选择重启面板并更新

一键安装 Agent(被监控端)

目前哪吒监控已支持在 Windows 和 Linux上一键安装 Agent

方法一:

你需要提前在管理面板中设置好通信域名,此域名不可以接入CDN,这里以前面提到过的示例通信域名 “nztz.tencent.cf” 来做演示
进入后台管理面板,转到“设置”页,在“未接入 CDN 的面板服务器域名/IP”项中填入通信域名,然后点击"保存"

在 Linux 中一键安装 (Ubuntu、Debian、CentOS)

  • 首先登录自己的管理面板http://cnmpp.com/server
  • 管理面板中添加一台服务器
  • 点击新添加的服务器旁,绿色的 Linux 图标按钮,复制一键安装命令
  • 在被控端服务器中运行复制的一键安装命令,等待安装完成后返回到 Dashboard 主页查看服务器是否上线

在 Windows 中一键安装

  • 首先登录自己的管理面板http://cnmpp.com/server
  • 点击新添加的服务器旁,绿色的 Windows 图标按钮,复制一键安装命令
  • 进入 Windows 服务器,运行 PowerShell,在 PowerShell 中运行复制的安装命令
  • 如遇到确认「执行策略变更」请选择 Y
  • 等待安装完成后返回 Dashboard 主页查看服务器是否上线

方法二:

在 Linux 中安装Agent (Ubuntu、Debian、CentOS)

  • 首先在管理面板中添加一台服务器
  • 在被控服务器中,运行脚本
# 国外机
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh  -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh

# 国内机
curl -L https://jihulab.com/nezha/nezha/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
  • 选择“安装监控 Agent”
  • 输入通信域名,如:”nztz.tencent.cf“
  • 输入 Agent 密钥,Agent 密钥在管理面板中添加服务器时生成,可以在管理面板中的“主机”页中找到
  • 等待安装完成后返回 Dashboard 主页查看服务器是否上线

美化面板

在后台粘贴进去保存就行了

<style>
/* 屏幕适配 */

@media only screen and (min-width: 1200px) {
  .ui.container {
    width: 77%;
  }
}

@media only screen and (max-width: 767px) {
  .ui.card>.content>.header:not(.ui), .ui.cards>.card>.content>.header:not(.ui) {
    margin-top: 0.4em;
  }
}



/* 图标颜色和大小*/

i.icon {
        color: #000;
/*下载图标间距*/
        width: 1em !important;
}



/* 菜单颜色 */

.ui.large.menu {
  border: 0;
  border-radius: 0px;
  background-color: rgba(255, 255, 255, 55%);
}

.ui.menu .active.item {
    background-color: transparent;    
}

.ui.dropdown .menu {
  border: 0;
  border-radius: 0px;
  background-color: rgba(255, 255, 255, 55%);
}



/* 登录按钮颜色 */

.nezha-primary-btn {
    background-color: #21ba45 !important;
    color: #fff;
}



/* 背景图片 */

body {
 content: " ";
  background: fixed;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-position: top;
  background-repeat: no-repeat;
  background-size: cover;
  background-image: url(https://picture.mefj.com.cn/%E5%B4%96%E4%B8%8A%E7%9A%84%E6%B3%A2%E5%A6%9E4k%E9%AB%98%E6%B8%85%E5%A3%81%E7%BA%B8.jpg);
  font-family: Arial,Helvetica,sans-serif;
}



/* 大卡片 */

#app .ui.fluid.accordion {
    background-color: #fbfbfb26;
    border-radius: 0.6rem;
}



/* 小卡片 */

.ui.four.cards>.card {
    border-radius: 0.6rem;
    background-color: #fafafaa3;
}



/* 小卡片右上角图标颜色 */

.nezha-secondary-font {
  color: rgba(252, 166, 7, 0.952) !important;
}



/* 小卡片右上角图标位置 */

.ui.right.center.popup {
  margin: -3px 0 0 0.914286em !important;
  -webkit-transform-origin: left 50%;
  transform-origin: left 50%;
}
.ui.bottom.left.popup {
  margin-left: 1px !important;
  margin-top: 3px !important;
}
.ui.top.left.popup {
  margin-left: 0;
  margin-bottom: 10px !important;
}
.ui.top.right.popup {
  margin-right: 0;
  margin-bottom: 8px !important;
}
.ui.left.center.popup {
  margin: -3px .91428571em 0 0 !important;
  -webkit-transform-origin: right 50%;
  transform-origin: right 50%;
}



/* 小卡片布局 */

.status.cards .flag {
  margin-right: 0 !important;
}
.status.cards .header > .info.icon {
  float: right;
  margin-right: 0;
  cursor: pointer;
}
.status.cards .wide.column {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  height: 2.4rem !important;
}
.status.cards .three.wide.column {
  padding-right: 0 !important;
}
.status.cards .wide.column:nth-child(1) {
  margin-top: 1.2rem !important;
}
.status.cards .wide.column:nth-child(2) {
  margin-top: 1.2rem !important;
}
.status.cards .description {
  padding-bottom: 0.8rem !important;
}
.status.cards .ui.content.popup {
  min-width: 292px;
  min-width: 21rem;
}
.status.cards .outline.icon {
  margin-right: 4px;
}



/* 弹出来的卡片 */

.status.cards .ui.content.popup {
    line-height: 2rem;
    border-radius: 8px;
    border: 1px solid transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    inset: 28.1562px auto auto 214.82px;
    background-color: #fafafaeb;
    -webkit-transition: all .3s ease;
    transition: all .3s ease;
    -webkit-box-shadow: 0 1px 4px 0 rgb(0 0 0 / 20%);
    box-shadow: 0 1px 4px 0 rgb(0 0 0 / 20%);
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    font-family: Arial,Helvetica,sans-serif;
}
.ui.content {
  margin: 0;
  padding: 1em !important;
}
.ui.top.popup:before {
    border-color: #fafafaeb transparent transparent;
}
.ui.popup:before {
    border-color: #fafafaeb transparent transparent;
}
.ui.bottom.left.popup:before {
    border-radius: 0px;
    border: 1px solid transparent;
    border-color: #fafafaeb transparent transparent;
    background: #fafafaeb;
    -webkit-box-shadow: 0px 0px 0 0 #fafafaeb;
    box-shadow: 0px 0px 0 0 #fafafaeb;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ui.bottom.right.popup:before {
    border-radius: 0px;
    border: 1px solid transparent;
    border-color: #fafafaeb transparent transparent;
    background: #fafafaeb;
    -webkit-box-shadow: 0px 0px 0 0 #fafafaeb;
    box-shadow: 0px 0px 0 0 #fafafaeb;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ui.top.left.popup:before {
    border-radius: 0px;
    border: 1px solid transparent;
    border-color: #fafafaeb transparent transparent;
    background: #fafafaeb;
    -webkit-box-shadow: 0px 0px 0 0 #fafafaeb;
    box-shadow: 0px 0px 0 0 #fafafaeb;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ui.top.right.popup:before {
    border-radius: 0px;
    border: 1px solid transparent;
    border-color: #fafafaeb transparent transparent;
    background: #fafafaeb;
    -webkit-box-shadow: 0px 0px 0 0 #fafafaeb;
    box-shadow: 0px 0px 0 0 #fafafaeb;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ui.left.center.popup:before {
    border-radius: 0px;
    border: 1px solid transparent;
    border-color: #fafafaeb transparent transparent;
    background: #fafafaeb;
    -webkit-box-shadow: 0px 0px 0 0 #fafafaeb;
    box-shadow: 0px 0px 0 0 #fafafaeb;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}



/* 进度条圆角和颜色 */

.ui.progress{border-radius:40rem}
.ui.progress .bar {
  min-width: 1.85em !important;
  border-radius: 15px;
/*进度条数字高度*/
  line-height: 1.65em;
  }

.ui.fine.progress> .bar {
  background-color: #21ba45!important;
}
.ui.progress> .bar {
  background-color: #000!important;
}
.ui.progress.fine .bar {
  background-color: #21ba45!important;
}
.ui.progress.warning .bar {
  background-color: #ff9800!important;
}
.ui.progress.error .bar {
  background-color: #e41e10!important;
}
.ui.progress.offline .bar {
  background-color: #000!important;
}



/* 上传下载图标颜色 */

i.arrow.alternate.circle.down.outline.icon {
    color: green;
}

i.arrow.alternate.circle.up.outline.icon {
    color: #ff0000;
}


/* 服务 */

.ui.table {
    background: RGB(225,225,225,0.6) !important;
}

.ui.table thead th {
    background: transparent !important;
}

.service-status .good {
    background-color: #21ba45 !important;
}

.service-status .danger {
  background-color: red !important;
}

.service-status .warning {
  background-color: orange !important;
}

/* 版权 */

.ui.inverted.segment, .ui.primary.inverted.segment {
    color: #000;
    font-weight: bold;
    background-color: #fafafaa3
}
</style>


<!--Logo和版权-->
<script>
window.onload = function(){
var avatar=document.querySelector(".item img")
var footer=document.querySelector("div.is-size-7")
footer.innerHTML="©2024 服务器探针"
footer.style.visibility="visible"
avatar.src="http://q1.qlogo.cn/g?b=qq&nk=87260034&s=160"
avatar.style.visibility="visible"
}
var faviconurl="http://q1.qlogo.cn/g?b=qq&nk=87260034&s=160" ;                  
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = faviconurl;
document.getElementsByTagName('head')[0].appendChild(link);
</script>

免服务器搭建哪吒探针面板

项目地址:
https://github.com/fscarmen2/Argo-Nezha-Service-Container/

发表评论 取消回复
表情 图片 链接 代码

分享