效果图
哪吒面板项目地址:
naiba/nezha: Self-hosted, lightweight server and website monitoring and O&M tool (github.com)
Server端安装环境
Centos系统VPS一台(8008、5555端口打开)
Github账号
域名(可选)(我没用域名,所以这里演示的都使用IP地址)
Server端安装
创建Github应用
打开Sign in to GitHub · GitHub 使用Github账号登录,创建新应用,按下图填写
一个ID 一个密钥需要记住
下载安装
SSH到VPS中,输入命令
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
大陆VPS使用命令
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
面板命令
选择1,开始安装(会安装Docker,我的VPS安装时间较长,不知道是不是配置垃圾的原因,可以多等会,不要以为是卡住了)
按下图填写一些信息就行,完成后面板服务端就启动了
./nezha.sh #脚本管理
访问面板
访问地址:ip:8008,需要使用你的Github账号登录
服务端到这里就安装完成了,因为没有添加客户端,所以页面一片空白。接下来可以进入面板后面开始添加客户端
客户端安装
Linux端安装
添加服务器
首先需要先在面板后面添加一台服务器,拿到密钥
安装客户端
SSH到VPS,输入命令
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
选择8,安装Agent
按下图填写一些信息,完成安装
打开面板可以看到Linux主机已添加到面板中,且信息也都显示出来了
Windows Server端安装
添加服务器
同样的,先在面板后面添加服务器,拿到密钥,这个就不贴图了
下载工具
哪吒探针地址:Releases · naiba/nezha · GitHub
nssm地址:https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip
安装工具
解压下载的两个工具,以管理员方式打开cmd窗口,将地址指向刚刚解压的nssm工具目录,输入命令
nssm install nezha
在NSSM工具中填写配置 ,填完后选择Install service
Path 之前下载的哪吒工具地址
Statup directory是哪吒工具地址目录地址
Arguments -s 面板ip:5555 -p 上一步添加服务器获取的密钥 -d
出现 下面的语句说明已安装成功,打开面板后就可以看到这台Windows Server的信息了
自定义CSS
可以在后面自定义CSS,让主页更好看些,懂CSS可以自己修改,下面是我设置的,好像不怎么样。。。文章来源:https://www.toymoban.com/news/detail-785919.html
<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://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F202008%2F06%2F20200806090514_TZ4QZ.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1682563462&t=27a9ab44ae87dfaaf7c1085d201c674e);
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>
<script>
window.onload = function(){
var avatar=document.querySelector(".item img")
var footer=document.querySelector("div.is-size-7")
footer.innerHTML="©2021 运维密码 & Powered by TLFang"
}
</script>
参考文章
哪吒探针 – Windows 和Linux端agent安装(详细注意版) | 运维密码 (mefj.com.cn)文章来源地址https://www.toymoban.com/news/detail-785919.html
到了这里,关于哪吒面板安装与配置(server与agent)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!