mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
服务延迟报警 [no ci]
This commit is contained in:
15
resource/l10n/zh-CN.toml
vendored
15
resource/l10n/zh-CN.toml
vendored
@@ -130,6 +130,21 @@ other = "秒"
|
||||
[EnableFailureNotification]
|
||||
other = "启用故障通知"
|
||||
|
||||
[FailureNotification]
|
||||
other = "故障通知"
|
||||
|
||||
[MaxLatency]
|
||||
other = "最大延迟(ms)"
|
||||
|
||||
[MinLatency]
|
||||
other = "最小延迟(ms)"
|
||||
|
||||
[EnableLatencyNotification]
|
||||
other = "启用延迟通知"
|
||||
|
||||
[LatencyNotification]
|
||||
other = "延迟通知"
|
||||
|
||||
[IntroductionOfMonitor]
|
||||
other = """
|
||||
类型为 <b>HTTP-GET</b> 时输入URL(带 http/https, HTTPS协议的会顺带监控SSL证书);<br>
|
||||
|
||||
@@ -77,6 +77,8 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
||||
item.name === "Duration"
|
||||
) {
|
||||
obj[item.name] = parseInt(item.value);
|
||||
} else if (item.name.endsWith("Latency")) {
|
||||
obj[item.name] = parseFloat(item.value);
|
||||
} else {
|
||||
obj[item.name] = item.value;
|
||||
}
|
||||
@@ -94,9 +96,9 @@ function showFormModal(modelSelector, formID, URL, getData) {
|
||||
if (item.name.endsWith("TasksRaw")) {
|
||||
if (item.value.length > 2) {
|
||||
obj[item.name] = JSON.stringify(
|
||||
[...item.value.matchAll(/\d+/gm)].map((k) =>
|
||||
parseInt(k[0])
|
||||
)
|
||||
[...item.value.matchAll(/\d+/gm)].map((k) =>
|
||||
parseInt(k[0])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -163,29 +165,29 @@ function addOrEditAlertRule(rule) {
|
||||
const node2 = modal.find("i.dropdown.icon.2");
|
||||
for (let i = 0; i < failTriggerTasksList.length; i++) {
|
||||
node1.after(
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
failTriggerTasksList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
failTriggerTasksList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
failTriggerTasksList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
failTriggerTasksList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
);
|
||||
}
|
||||
for (let i = 0; i < recoverTriggerTasksList.length; i++) {
|
||||
node2.after(
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
recoverTriggerTasksList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
recoverTriggerTasksList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
'<a class="ui label transition visible" data-value="' +
|
||||
recoverTriggerTasksList[i] +
|
||||
'" style="display: inline-block !important;">ID:' +
|
||||
recoverTriggerTasksList[i] +
|
||||
'<i class="delete icon"></i></a>'
|
||||
);
|
||||
}
|
||||
}
|
||||
modal
|
||||
.find("input[name=FailTriggerTasksRaw]")
|
||||
.val(rule ? "[]," + failTriggerTasks.substr(1, failTriggerTasks.length - 2) : "[]");
|
||||
.find("input[name=FailTriggerTasksRaw]")
|
||||
.val(rule ? "[]," + failTriggerTasks.substr(1, failTriggerTasks.length - 2) : "[]");
|
||||
modal
|
||||
.find("input[name=RecoverTriggerTasksRaw]")
|
||||
.val(rule ? "[]," + recoverTriggerTasks.substr(1, recoverTriggerTasks.length - 2) : "[]");
|
||||
.find("input[name=RecoverTriggerTasksRaw]")
|
||||
.val(rule ? "[]," + recoverTriggerTasks.substr(1, recoverTriggerTasks.length - 2) : "[]");
|
||||
|
||||
showFormModal(".rule.modal", "#ruleForm", "/api/alert-rule");
|
||||
}
|
||||
@@ -257,10 +259,10 @@ function issueNewApiToken(apiToken) {
|
||||
const modal = $(".api.modal");
|
||||
modal.children(".header").text((apiToken ? LANG.Edit : LANG.Add) + ' ' + "API Token");
|
||||
modal
|
||||
.find(".nezha-primary-btn.button")
|
||||
.html(
|
||||
apiToken ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
|
||||
);
|
||||
.find(".nezha-primary-btn.button")
|
||||
.html(
|
||||
apiToken ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
|
||||
);
|
||||
modal.find("textarea[name=Note]").val(apiToken ? apiToken.Note : null);
|
||||
showFormModal(".api.modal", "#apiForm", "/api/token");
|
||||
}
|
||||
@@ -313,6 +315,13 @@ function addOrEditMonitor(monitor) {
|
||||
} else {
|
||||
modal.find(".ui.nb-notify.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
modal.find("input[name=MaxLatency]").val(monitor ? monitor.MaxLatency : null);
|
||||
modal.find("input[name=MinLatency]").val(monitor ? monitor.MinLatency : null);
|
||||
if (monitor && monitor.LatencyNotify) {
|
||||
modal.find(".ui.nb-lt-notify.checkbox").checkbox("set checked");
|
||||
} else {
|
||||
modal.find(".ui.nb-lt-notify.checkbox").checkbox("set unchecked");
|
||||
}
|
||||
modal.find("a.ui.label.visible").each((i, el) => {
|
||||
el.remove();
|
||||
});
|
||||
|
||||
2
resource/template/common/footer.html
vendored
2
resource/template/common/footer.html
vendored
@@ -10,7 +10,7 @@
|
||||
<script src="https://cdn.staticfile.org/semantic-ui/2.4.1/semantic.min.js"></script>
|
||||
<script src="/static/semantic-ui-alerts.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
|
||||
<script src="/static/main.js?v20220915"></script>
|
||||
<script src="/static/main.js?v20220917"></script>
|
||||
<script>
|
||||
(function () {
|
||||
updateLang({{.LANG }});
|
||||
|
||||
14
resource/template/component/monitor.html
vendored
14
resource/template/component/monitor.html
vendored
@@ -54,6 +54,20 @@
|
||||
<label>{{tr "EnableFailureNotification"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "MaxLatency"}}</label>
|
||||
<input type="number" name="MaxLatency" placeholder="100.88" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{tr "MinLatency"}}</label>
|
||||
<input type="number" name="MinLatency" placeholder="100.88" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui nb-lt-notify checkbox">
|
||||
<input name="LatencyNotify" type="checkbox" tabindex="0" class="hidden" />
|
||||
<label>{{tr "EnableLatencyNotification"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="ui warning message">
|
||||
<p>
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
<th>{{tr "Type"}}</th>
|
||||
<th>{{tr "Duration"}}</th>
|
||||
<th>{{tr "NotificationMethodGroup"}}</th>
|
||||
<th>{{tr "Notification"}}</th>
|
||||
<th>{{tr "FailureNotification"}}</th>
|
||||
<th>{{tr "LatencyNotification"}}</th>
|
||||
<th>{{tr "Administration"}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -39,6 +40,7 @@
|
||||
<td>{{$monitor.Duration}} {{tr "Seconds"}}</td>
|
||||
<td>{{$monitor.NotificationTag}}</td>
|
||||
<td>{{$monitor.Notify}}</td>
|
||||
<td>{{$monitor.LatencyNotify}}</td>
|
||||
<td>
|
||||
<div class="ui mini icon buttons">
|
||||
<button class="ui button" onclick="addOrEditMonitor({{$monitor}})">
|
||||
|
||||
Reference in New Issue
Block a user