Compare commits

..
6 Commits
Author SHA1 Message Date
zhucaidanandnaiba 12c6b8a6f6 Update en-US.toml (#429)
* Update en-US.toml

Optimize translation

* refine

---------

Co-authored-by: naiba <[email protected]>
2024-10-06 11:41:19 +08:00
UUBulb ebcc8a6efb installer: fix docker-compose detection logic (#428) 2024-10-06 09:35:12 +08:00
UUBulb c4d8b63d32 installer: fix docker-compose detection (#427) 2024-10-05 23:43:16 +08:00
nap0o 318da135b9 improve: status-server主题agent账单信息展示 (#425)
1. 支持价格和期限单独设置
2. 账单信息附加到group分组控制
3. 一些其他优化
2024-10-04 23:35:44 +08:00
github-actions[bot] da74bf4749 update contributors[no ci] 2024-10-04 15:33:58 +00:00
lyjandnaiba 3250283ef9 fix: 允许更新默认分组 (#426)
* fix: 允许更新默认分组

* improve: check null

---------

Co-authored-by: naiba <[email protected]>
2024-10-04 23:33:40 +08:00
8 changed files with 163 additions and 79 deletions
+3 -2
View File
@@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br>
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.19.0-brightgreen?style=for-the-badge&logo=linux">
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.19.2-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>
@@ -66,7 +66,6 @@ You can change the dashboard language in the settings page (`/setting`) after th
<a href="https://github.com/DarcJC" title="Darc Z."><img src="https://avatars.githubusercontent.com/u/53445798?v=4" width="50;" alt="Darc Z."/></a>
<a href="https://github.com/Creling" title="Creling"><img src="https://avatars.githubusercontent.com/u/43109504?v=4" width="50;" alt="Creling"/></a>
<a href="https://github.com/coreff" title="Core F"><img src="https://avatars.githubusercontent.com/u/38347122?v=4" width="50;" alt="Core F"/></a>
<a href="https://github.com/nickfox-taterli" title="Tater Li"><img src="https://avatars.githubusercontent.com/u/19658596?v=4" width="50;" alt="Tater Li"/></a>
<a href="https://github.com/hmsjy2017" title="Tony"><img src="https://avatars.githubusercontent.com/u/42692274?v=4" width="50;" alt="Tony"/></a>
<a href="https://github.com/adminsama" title="adminsama"><img src="https://avatars.githubusercontent.com/u/60880076?v=4" width="50;" alt="adminsama"/></a>
<a href="https://github.com/acgpiano" title="Acgpiano"><img src="https://avatars.githubusercontent.com/u/15900800?v=4" width="50;" alt="Acgpiano"/></a>
@@ -75,11 +74,13 @@ You can change the dashboard language in the settings page (`/setting`) after th
<a href="https://github.com/hiDandelion" title="hiDandelion"><img src="https://avatars.githubusercontent.com/u/77157418?v=4" width="50;" alt="hiDandelion"/></a>
<a href="https://github.com/yuanweize" title="I"><img src="https://avatars.githubusercontent.com/u/30067203?v=4" width="50;" alt="I"/></a>
<a href="https://github.com/lvyaoting" title="lvyaoting"><img src="https://avatars.githubusercontent.com/u/166296299?v=4" width="50;" alt="lvyaoting"/></a>
<a href="https://github.com/lyj0309" title="lyj"><img src="https://avatars.githubusercontent.com/u/50474995?v=4" width="50;" alt="lyj"/></a>
<a href="https://github.com/unclezs" title="unclezs"><img src="https://avatars.githubusercontent.com/u/42318775?v=4" width="50;" alt="unclezs"/></a>
<a href="https://github.com/ysicing" title="缘生"><img src="https://avatars.githubusercontent.com/u/8605565?v=4" width="50;" alt="缘生"/></a>
<a href="https://github.com/zhucaidan" title="zhucaidan"><img src="https://avatars.githubusercontent.com/u/47970938?v=4" width="50;" alt="zhucaidan"/></a>
<a href="https://github.com/arkylin" title="凌"><img src="https://avatars.githubusercontent.com/u/35104502?v=4" width="50;" alt="凌"/></a>
<a href="https://github.com/colour93" title="玖叁"><img src="https://avatars.githubusercontent.com/u/64313711?v=4" width="50;" alt="玖叁"/></a>
<a href="https://github.com/nickfox-taterli" title="Tater Li"><img src="https://avatars.githubusercontent.com/u/19658596?v=4" width="50;" alt="Tater Li"/></a>
<a href="https://github.com/IamTaoChen" title="Tao Chen"><img src="https://avatars.githubusercontent.com/u/42793494?v=4" width="50;" alt="Tao Chen"/></a>
<a href="https://github.com/Septrum101" title="Spetrum"><img src="https://avatars.githubusercontent.com/u/11692994?v=4" width="50;" alt="Spetrum"/></a>
<a href="https://github.com/dreamingsleeping" title="Nanjing Hopefun Network Technology Co. Ltd."><img src="https://avatars.githubusercontent.com/u/13828658?v=4" width="50;" alt="Nanjing Hopefun Network Technology Co. Ltd."/></a>
+4 -4
View File
@@ -95,7 +95,7 @@ other = "Cron Task"
other = "Trigger Task"
[TheFormaOfTheScheduleIs]
other = "The Cron Expression is like:"
other = "The Cron Expression format is:"
[SecondsMinutesHoursDaysMonthsWeeksSeeDetails]
other = "Sec Min Hour Day Month Week, see details in "
@@ -182,7 +182,7 @@ other = "Notification Trigger Mode"
other = "Always Trigger"
[ModeOnetimeTrigger]
other = "Always Trigger"
other = "Single Trigger"
[EnableTriggerTask]
other = "Enable Trigger Task"
@@ -296,7 +296,7 @@ other = "Delete Notification Method"
other = "Confirm to Delete This Notification Method?"
[ForceUpdate]
other = "Force to Update"
other = "Force Update Agent"
[SelectAll]
other = "Select All"
@@ -611,7 +611,7 @@ other = "Admin Panel Theme"
other = "Info"
[HideForGuest]
other = "Hide for Guest"
other = "Hide from Guest"
[Menu]
other = "Menu"
+2 -2
View File
@@ -159,8 +159,8 @@
}
function batchEditServerGroup() {
let groupName = prompt('{{tr "InputServerGroupName"}}')
if (!groupName) {
return;
if (groupName === null) {
return
}
const servers = []
checkBoxList.forEach(cb => {
+13 -13
View File
@@ -6,7 +6,7 @@
<th class="node-cell name center">{{tr "Name"}}</th>
<th class="node-cell os center">{{tr "Platform"}}</th>
<th class="node-cell location center">{{tr "Location"}}</th>
<th v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">{{tr "Price"}}</th>
<th v-if="nodesNoTag.some(item => item.additional && item.additional.price && Object.keys(item.additional.price).length > 0)" class="node-cell price center">{{tr "Price"}}</th>
<th class="node-cell uptime center">{{tr "Uptime"}}</th>
<th class="node-cell load center">{{tr "Load"}}</th>
<th class="node-cell network center">{{tr "NetSpeed"}}↓|↑</th>
@@ -14,7 +14,7 @@
<th class="node-cell cpu center">{{tr "CpuUsed"}}</th>
<th class="node-cell memory center">{{tr "MemUsed"}}</th>
<th class="node-cell hdd center">{{tr "DiskUsed"}}</th>
<th v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining center">{{tr "Remaining"}}</th>
<th v-if="nodesNoTag.some(item => item.additional && item.additional.remaining && Object.keys(item.additional.remaining).length > 0)" class="node-cell remaining center">{{tr "Remaining"}}</th>
</tr>
</thead>
<tbody id="servers">
@@ -38,10 +38,10 @@
<i :class="'fi fi-' + node.location"></i>
<span class="node-cell-location-text text-uppercase">@#node.location#@</span>
</td>
<td v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">
<template v-if="additional[node.ID] && additional[node.ID].price">
<span v-if="additional[node.ID].price.amount == 0" class="node-cell-price-text">Free</span>
<span v-else class="node-cell-price-text">@#additional[node.ID].price.amount#@@#(additional[node.ID].price.cycle ? '/' + additional[node.ID].price.cycle : '')#@</span>
<td v-if="nodesNoTag.some(item => item.additional && item.additional.price && Object.keys(item.additional.price).length > 0)" class="node-cell price center">
<template v-if="node.additional && node.additional.price">
<span v-if="node.additional.price.amount == 0" class="node-cell-price-text">Free</span>
<span v-else class="node-cell-price-text">@#node.additional.price.amount#@@#(node.additional.price.cycle ? '/' + node.additional.price.cycle : '')#@</span>
</template>
</td>
<td style="text-align: center;" class="node-cell uptime">@#node.uptime#@</td>
@@ -67,16 +67,16 @@
</div>
</div>
</td>
<td v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining">
<td v-if="nodesNoTag.some(item => item.additional && item.additional.remaining && Object.keys(item.additional.remaining).length > 0)" class="node-cell remaining">
<div :class="['progress', node.online ? 'progress-online' : 'progress-offline']">
<template v-if="additional[node.ID] && additional[node.ID].remaining.format">
<div :style="additional[node.ID].remaining.format.style" :class="additional[node.ID].remaining.days == 'lifetime' ? '' : additional[node.ID].remaining.format.class"></div>
<template v-if="node.additional && node.additional.remaining.format">
<div :style="node.additional.remaining.format.style" :class="node.additional.remaining.days == 'lifetime' ? '' : node.additional.remaining.format.class"></div>
<div class="additional">
<small v-if="additional[node.ID].remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
<small v-else-if="additional[node.ID].remaining.days < 0">{{tr "Expired"}}</small>
<small v-if="node.additional.remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
<small v-else-if="node.additional.remaining.days < 0">{{tr "Expired"}}</small>
<small v-else>
<span class="node-cell-remaining-days">@#additional[node.ID].remaining.days#@{{tr "Days"}}</span>
<span class="node-cell-remaining-percent">@#additional[node.ID].remaining.percent#@%</span>
<span class="node-cell-remaining-days">@#node.additional.remaining.days#@{{tr "Days"}}</span>
<span class="node-cell-remaining-percent">@#node.additional.remaining.percent#@%</span>
</small>
</div>
</template>
+13 -13
View File
@@ -9,7 +9,7 @@
<th class="node-cell name center">{{tr "Name"}}</th>
<th class="node-cell os center">{{tr "Platform"}}</th>
<th class="node-cell location center">{{tr "Location"}}</th>
<th v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">{{tr "Price"}}</th>
<th v-if="group.data.some(item => item.additional && item.additional.price && Object.keys(item.additional.price).length > 0)" class="node-cell price center">{{tr "Price"}}</th>
<th class="node-cell uptime center">{{tr "Uptime"}}</th>
<th class="node-cell load center">{{tr "Load"}}</th>
<th class="node-cell network center">{{tr "NetSpeed"}}↓|↑</th>
@@ -17,7 +17,7 @@
<th class="node-cell cpu center">{{tr "CpuUsed"}}</th>
<th class="node-cell memory center">{{tr "MemUsed"}}</th>
<th class="node-cell hdd center">{{tr "DiskUsed"}}</th>
<th v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining center">{{tr "Remaining"}}</th>
<th v-if="group.data.some(item => item.additional && item.additional.remaining && Object.keys(item.additional.remaining).length > 0)" class="node-cell remaining center">{{tr "Remaining"}}</th>
</tr>
</thead>
<tbody id="servers">
@@ -41,10 +41,10 @@
<i :class="'fi fi-' + node.location"></i>
<span class="node-cell-location-text text-uppercase">&nbsp;@#node.location#@</span>
</td>
<td v-if="additional && Object.values(additional).filter(item => item.price).length > 0" class="node-cell price center">
<template v-if="additional[node.ID] && additional[node.ID].price">
<span v-if="additional[node.ID].price.amount == 0" class="node-cell-price-text">Free</span>
<span v-else class="node-cell-price-text">@#additional[node.ID].price.amount#@@#(additional[node.ID].price.cycle ? '/' + additional[node.ID].price.cycle : '')#@</span>
<td v-if="group.data.some(item => item.additional && item.additional.price && Object.keys(item.additional.price).length > 0)" class="node-cell price center">
<template v-if="node.additional && node.additional.price">
<span v-if="node.additional.price.amount == 0" class="node-cell-price-text">Free</span>
<span v-else class="node-cell-price-text">@#node.additional.price.amount#@@#(node.additional.price.cycle ? '/' + node.additional.price.cycle : '')#@</span>
</template>
</td>
<td style="text-align: center;" class="node-cell uptime">@#node.uptime#@</td>
@@ -70,16 +70,16 @@
</div>
</div>
</td>
<td v-if="additional && Object.values(additional).filter(item => item.remaining).length > 0" class="node-cell remaining">
<td v-if="group.data.some(item => item.additional && item.additional.remaining && Object.keys(item.additional.remaining).length > 0)" class="node-cell remaining">
<div :class="['progress', node.online ? 'progress-online' : 'progress-offline']">
<template v-if="additional[node.ID] && additional[node.ID].remaining.format">
<div :style="additional[node.ID].remaining.format.style" :class="additional[node.ID].remaining.days == 'lifetime' ? '' : additional[node.ID].remaining.format.class"></div>
<template v-if="node.additional && node.additional.remaining.format">
<div :style="node.additional.remaining.format.style" :class="node.additional.remaining.days == 'lifetime' ? '' : node.additional.remaining.format.class"></div>
<div class="additional">
<small v-if="additional[node.ID].remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
<small v-else-if="additional[node.ID].remaining.days < 0">{{tr "Expired"}}</small>
<small v-if="node.additional.remaining.days == 'lifetime'">{{tr "Lifetime"}}</small>
<small v-else-if="node.additional.remaining.days < 0">{{tr "Expired"}}</small>
<small v-else>
<span class="node-cell-remaining-days">@#additional[node.ID].remaining.days#@{{tr "Days"}}</span>
<span class="node-cell-remaining-percent">@#additional[node.ID].remaining.percent#@%</span>
<span class="node-cell-remaining-days">@#node.additional.remaining.days#@{{tr "Days"}}</span>
<span class="node-cell-remaining-percent">@#node.additional.remaining.percent#@%</span>
</small>
</div>
</template>
+102 -27
View File
@@ -72,10 +72,25 @@
mixins: [mixinsVue],
created() {
this.servers = JSON.parse('{{.Servers}}').servers;
this.additional = this.initAdditional(this.servers);
if(this.showGroup) {
this.nodesTag = this.groupingData(this.handleNodes(this.servers),"Tag");
this.nodesTag.forEach(group => {
group.data.forEach(item => {
const additionalData = this.additional[item.ID];
if (additionalData) {
item.additional = additionalData; // 添加 additional 属性
}
});
});
} else {
this.nodesNoTag = this.handleNodes(this.servers);
this.nodesNoTag.forEach(item => {
const additionalData = this.additional[item.ID];
if (additionalData) {
item.additional = additionalData; // 添加 additional 属性
}
});
}
this.initCountryMap().then(countryMap => {
this.countryMap = countryMap;
@@ -83,7 +98,6 @@
this.countryServer = this.initCountryServer();
this.countryMapChartData = this.initCountryMapChartData();
});
this.additional = this.initAdditional(this.servers);
},
mounted() {
// 初始化时建立WebSocket连接
@@ -103,18 +117,42 @@
initAdditional(servers) {
let nodes = {};
servers?.forEach(server => {
if(server.PublicNote) {
if (server.PublicNote) {
const remainingFormat = this.getRemainingFormat(server.live, server.PublicNote);
const remainingDays = this.getRemainingDays(this.getNoteElementValue(server.PublicNote, "billingDataMod", "endDate"), server.PublicNote);
const remainingPercent = this.getRemainingPercent(
this.getNoteElementValue(server.PublicNote, "billingDataMod", "startDate"),
this.getNoteElementValue(server.PublicNote, "billingDataMod", "endDate"),
server.PublicNote
);
const priceAmount = this.getNoteElementValue(server.PublicNote, "billingDataMod", "amount");
const priceCycle = this.getNoteElementValue(server.PublicNote, "billingDataMod", "cycle");
// 初始化节点
nodes[server.ID] = {
"remaining": {
format: this.getRemainingFormat(server.live, server.PublicNote),
days: this.getRemainingDays(this.getNoteElementValue(server.PublicNote, "billingDataMod", "endDate"),server.PublicNote),
percent: this.toFixed2(100 - this.getRemainingPercent(this.getNoteElementValue(server.PublicNote, "billingDataMod", "startDate"), this.getNoteElementValue(server.PublicNote, "billingDataMod", "endDate"), server.PublicNote))
},
"price": {
amount: this.getNoteElementValue(server.PublicNote, "billingDataMod", "amount"),
cycle: this.getNoteElementValue(server.PublicNote, "billingDataMod", "cycle")
}
"remaining": {},
"price": {}
};
if (remainingFormat) {
nodes[server.ID].remaining.format = remainingFormat;
}
if (remainingDays) {
nodes[server.ID].remaining.days = remainingDays;
}
if (remainingPercent) {
nodes[server.ID].remaining.percent = this.toFixed2(100 - remainingPercent);
}
if (priceAmount) {
nodes[server.ID].price.amount = priceAmount;
}
if (priceCycle && priceAmount) {
nodes[server.ID].price.cycle = priceCycle;
}
}
});
return nodes;
@@ -416,8 +454,22 @@
}
if(this.showGroup) {
this.nodesTag = this.groupingData(this.handleNodes(data.servers),"Tag");
this.nodesTag.forEach(group => {
group.data.forEach(item => {
const additionalData = this.additional[item.ID];
if (additionalData) {
item.additional = additionalData; // 添加 additional 属性
}
});
});
} else {
this.nodesNoTag = this.handleNodes(data.servers);
this.nodesNoTag.forEach(item => {
const additionalData = this.additional[item.ID];
if (additionalData) {
item.additional = additionalData; // 添加 additional 属性
}
});
}
}
this.ws.onclose = () => {
@@ -528,7 +580,7 @@
}
})
.catch(error => {
console.error('Error fetching data:', error);
console.log('Error fetching data:', error);
});
},
renderCharts(id, reload = false) {
@@ -807,7 +859,7 @@
// 如果 expiration 无效,返回 null 并记录日志
if (isNaN(expiration.getTime())) {
console.error("getAutoRenewalEndDate: Invalid expiration format");
console.log("getAutoRenewalEndDate: Invalid expiration format");
}
const result = {
@@ -924,7 +976,7 @@
// 检查 startDate 格式是否有效,若无效返回 null
if (isNaN(start.getTime())) {
console.error("getAutoRenewalStartDate: Invalid startDate format");
console.log("getAutoRenewalStartDate: Invalid startDate format");
}
// 如果 flag 为 0,直接返回开始日期
@@ -976,31 +1028,47 @@
if (!note) return null;
const startDate = this.getNoteElementValue(note, "billingDataMod", "startDate");
const endDate = this.getNoteElementValue(note, "billingDataMod", "endDate");
// 检查 startDate 和 endDate 是否有效
if (!startDate || !endDate || typeof startDate !== 'string' || typeof endDate !== 'string') {
console.error("getRemainingFormat: Invalid startDate or endDate in note");
return null; // 如果无效,返回 null 或其他错误处理逻辑
}
//处理特殊时间格式
// 处理特殊时间格式
if (startDate.includes('0000-00-00') || endDate.includes("0000-00-00")) {
return this.formatPercents(online, this.toFixed2(100));
} else {
const percent = this.getRemainingPercent(startDate, endDate, note);
return this.formatPercents(online, this.toFixed2(percent));
}
// 检查 startDate 和 endDate 是否为合法的Date
if (isNaN(new Date(startDate).getTime()) || isNaN(new Date(endDate).getTime())) {
return {
"class": "",
"style": "width: 0%",
"percent": "0"
}
}
//处理特殊时间格式
const percent = this.getRemainingPercent(startDate, endDate, note);
return this.formatPercents(online, this.toFixed2(percent));
},
getRemainingDays(endDate, note) {
// 检查 endDate 是否有效
if (!endDate || typeof endDate !== 'string') {
console.error("getRemainingDays: Invalid endDate format");
return null;
}
// 处理特殊时间格式
if (endDate.includes("0000-00-00")) return "lifetime";
if (endDate.includes("0000-00-00")) {
return "lifetime";
}
// 检查 startDate 和 endDate 是否为合法的Date
if (isNaN(new Date(endDate).getTime())) {
return "NaN";
}
// 获取当前时间,并调整时区
const currentTime = this.getAdjustTimezone(new Date(endDate), new Date());
@@ -1025,13 +1093,20 @@
},
getRemainingPercent(startDate, endDate, note) {
// 检查 startDate 和 endDate 是否为有效字符串并处理特殊格式
if (typeof startDate !== 'string' || typeof endDate !== 'string') {
console.error("getRemainingPercent: Invalid startDate or endDate format");
if (!startDate || !endDate || typeof startDate !== 'string' || typeof endDate !== 'string') {
return null;
}
if (startDate.includes("0000-00-00") || endDate.includes("0000-00-00")) return 100;
// 处理特殊时间格式
if (startDate.includes("0000-00-00") || endDate.includes("0000-00-00")) {
return 100;
}
// 检查 startDate 和 endDate 是否为合法的Date
if (isNaN(new Date(startDate).getTime()) || isNaN(new Date(endDate).getTime())) {
return "NaN";
}
// 获取当前时间并调整时区
const now = this.getAdjustTimezone(new Date(endDate), new Date());
@@ -1056,7 +1131,7 @@
// 计算剩余百分比
if (now < start) {
return 0;
return 0.01; //避免当条件判断!percent被过滤
}
if (now >= end) {
return 100;
+13 -9
View File
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
NZ_VERSION="v0.19.0"
NZ_VERSION="v0.19.2"
red='\033[0;31m'
green='\033[0;32m'
@@ -65,6 +65,8 @@ geo_check() {
}
pre_check() {
umask 077
## os_arch
if uname -m | grep -q 'x86_64'; then
os_arch="amd64"
@@ -288,8 +290,6 @@ install_dashboard() {
esac
fi
sudo chmod -R 700 $NZ_DASHBOARD_PATH
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
install_dashboard_docker
elif [ "$IS_DOCKER_NEZHA" = 0 ]; then
@@ -375,7 +375,6 @@ install_agent() {
# 哪吒监控文件夹
sudo mkdir -p $NZ_AGENT_PATH
sudo chmod -R 700 $NZ_AGENT_PATH
echo "正在下载监控端"
if [ -z "$CN" ]; then
@@ -454,11 +453,16 @@ modify_dashboard_config() {
echo "> 修改面板配置"
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
echo "正在下载 Docker 脚本"
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
if [ $? != 0 ]; then
err "下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
return 0
if [ ! -z "$DOCKER_COMPOSE_COMMAND" ]; then
echo "正在下载 Docker 脚本"
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
if [ $? != 0 ]; then
err "下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
return 0
fi
else
err "请手动安装 docker-compose。https://docs.docker.com/compose/install/linux/"
before_show_menu
fi
fi
+13 -9
View File
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
NZ_VERSION="v0.19.0"
NZ_VERSION="v0.19.2"
red='\033[0;31m'
green='\033[0;32m'
@@ -65,6 +65,8 @@ geo_check() {
}
pre_check() {
umask 077
## os_arch
if uname -m | grep -q 'x86_64'; then
os_arch="amd64"
@@ -287,8 +289,6 @@ install_dashboard() {
esac
fi
sudo chmod -R 700 $NZ_DASHBOARD_PATH
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
install_dashboard_docker
elif [ "$IS_DOCKER_NEZHA" = 0 ]; then
@@ -374,7 +374,6 @@ install_agent() {
# Nezha Monitoring Folder
sudo mkdir -p $NZ_AGENT_PATH
sudo chmod -R 700 $NZ_AGENT_PATH
echo "Downloading Agent"
wget -t 2 -T 60 -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/nezhahq/agent/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
@@ -448,11 +447,16 @@ modify_dashboard_config() {
echo "> Modify Dashboard Configuration"
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
echo "Download Docker Script"
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
if [ $? != 0 ]; then
err "Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
return 0
if [ ! -z "$DOCKER_COMPOSE_COMMAND" ]; then
echo "Download Docker Script"
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
if [ $? != 0 ]; then
err "Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
return 0
fi
else
err "请手动安装 docker-compose。https://docs.docker.com/compose/install/linux/"
before_show_menu
fi
fi