ref: Adjust the content of alert information (#10152)

This commit is contained in:
2025-08-26 22:04:01 +08:00 committed by GitHub
parent 5f33c083bf
commit 0685984a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 67 additions and 78 deletions

View file

@ -394,7 +394,6 @@ func loadPanelLogin(alert dto.AlertDTO) {
alertType := alert.Type
quota := strconv.Itoa(count)
quotaType := strconv.Itoa(int(alert.Cycle))
var params []dto.Param
if err != nil {
global.LOG.Errorf("Failed to count recent failed login logs: %v", err)
}
@ -402,7 +401,7 @@ func loadPanelLogin(alert dto.AlertDTO) {
alertType = "panelLogin"
quota = strconv.Itoa(count)
quotaType = "panelLogin"
params = append([]dto.Param{
params := []dto.Param{
{
Index: "1",
Key: "cycle",
@ -413,7 +412,7 @@ func loadPanelLogin(alert dto.AlertDTO) {
Key: "project",
Value: "",
},
})
}
sendAlerts(alert, alertType, quota, quotaType, params)
}
@ -432,7 +431,7 @@ func loadPanelLogin(alert dto.AlertDTO) {
}(), "\n")
alertType = "panelIpLogin"
quotaType = "panelIpLogin"
params = append([]dto.Param{
params := []dto.Param{
{
Index: "1",
Key: "cycle",
@ -443,7 +442,7 @@ func loadPanelLogin(alert dto.AlertDTO) {
Key: "project",
Value: " IP ",
},
})
}
sendAlerts(alert, alertType, quota, quotaType, params)
}
}
@ -453,7 +452,6 @@ func loadSSHLogin(alert dto.AlertDTO) {
alertType := alert.Type
quota := strconv.Itoa(count)
quotaType := strconv.Itoa(int(alert.Cycle))
var params []dto.Param
if err != nil {
global.LOG.Errorf("Failed to count recent failed ssh login logs: %v", err)
}
@ -461,7 +459,7 @@ func loadSSHLogin(alert dto.AlertDTO) {
alertType = "sshLogin"
quota = strconv.Itoa(count)
quotaType = "sshLogin"
params = append([]dto.Param{
params := []dto.Param{
{
Index: "1",
Key: "cycle",
@ -472,7 +470,7 @@ func loadSSHLogin(alert dto.AlertDTO) {
Key: "project",
Value: "",
},
})
}
sendAlerts(alert, alertType, quota, quotaType, params)
}
whitelist := strings.Split(strings.TrimSpace(alert.AdvancedParams), "\n")
@ -481,16 +479,10 @@ func loadSSHLogin(alert dto.AlertDTO) {
global.LOG.Errorf("Failed to check recent failed ip ssh login logs: %v", err)
}
if len(records) > 0 {
quota = strings.Join(func() []string {
var ips []string
for _, r := range records {
ips = append(ips, r)
}
return ips
}(), "\n")
quota = strings.Join(records, "\n")
alertType = "sshIpLogin"
quotaType = "sshIpLogin"
params = append([]dto.Param{
params := []dto.Param{
{
Index: "1",
Key: "cycle",
@ -501,7 +493,7 @@ func loadSSHLogin(alert dto.AlertDTO) {
Key: "project",
Value: " IP ",
},
})
}
sendAlerts(alert, alertType, quota, quotaType, params)
}
}

View file

@ -3562,7 +3562,7 @@ const message = {
alertRule: 'Alert Rules',
titleSearchHelper: 'Enter alert title for fuzzy search',
taskType: 'Type',
ssl: 'Certificate (SSL) Expiry',
ssl: 'Certificate Expiry',
siteEndTime: 'Website Expiry',
panelPwdEndTime: 'Panel Password Expiry',
panelUpdate: 'New Panel Version Available',
@ -3646,7 +3646,7 @@ const message = {
cleanAlertLogs: 'Clean Alert Logs',
daily: 'Daily Alert Count: {0}',
cumulative: 'Cumulative Alert Count: {0}',
clams: 'Virus scan',
clams: 'Virus scan alert',
taskName: 'Task Name',
cronJobType: 'Task Type',
clamPath: 'Scan Directory',

View file

@ -3444,7 +3444,7 @@ const message = {
alertRule: 'アラートルール',
titleSearchHelper: 'アラートタイトルを入力して検索します',
taskType: 'タイプ',
ssl: '証明書 (SSL) 期限切れ',
ssl: '証明書期限切れ',
siteEndTime: 'ウェブサイト期限切れ',
panelPwdEndTime: 'パネルパスワード期限切れ',
panelUpdate: '新しいパネルバージョンあり',

View file

@ -3522,7 +3522,7 @@ const message = {
alertRule: 'Peraturan Amaran',
titleSearchHelper: 'Masukkan tajuk amaran untuk pencarian kabur',
taskType: 'Jenis',
ssl: 'Sijil (SSL) Tamat Tempoh',
ssl: 'Sijil Tamat Tempoh',
siteEndTime: 'Tamat Tempoh Laman Web',
panelPwdEndTime: 'Kata Laluan Panel Tamat Tempoh',
panelUpdate: 'Versi Panel Baharu Tersedia',

View file

@ -3531,7 +3531,7 @@ const message = {
alertRule: 'Regras de Alerta',
titleSearchHelper: 'Digite o título do alerta para busca aproximada',
taskType: 'Tipo',
ssl: 'Expiração do Certificado (SSL)',
ssl: 'Expiração do Certificado',
siteEndTime: 'Expiração do Site',
panelPwdEndTime: 'Expiração da Senha do Painel',
panelUpdate: 'Nova Versão do Painel Disponível',

View file

@ -3518,7 +3518,7 @@ const message = {
alertRule: 'Правила Уведомлений',
titleSearchHelper: 'Введите название уведомления для нечеткого поиска',
taskType: 'Тип',
ssl: 'Срок действия сертификата (SSL)',
ssl: 'Срок действия сертификата',
siteEndTime: 'Истечение срока действия сайта',
panelPwdEndTime: 'Истечение срока действия пароля панели',
panelUpdate: 'Доступна новая версия панели',

View file

@ -3599,7 +3599,7 @@ const message = {
alertRule: 'Uyarı Kuralları',
titleSearchHelper: 'Bulanık arama için uyarı başlığını girin',
taskType: 'Tür',
ssl: 'Sertifika (SSL) Sona Ermesi',
ssl: 'Sertifika Sona Ermesi',
siteEndTime: 'Web Sitesi Sona Ermesi',
panelPwdEndTime: 'Panel Şifresi Sona Ermesi',
panelUpdate: 'Yeni Panel Sürümü Mevcut',

View file

@ -3315,7 +3315,7 @@ const message = {
alertRule: '告警規則',
titleSearchHelper: '請輸入告警標題支援模糊搜尋',
taskType: '告警類型',
ssl: '網站證書SSL到期',
ssl: '網站證書到期',
siteEndTime: '網站到期',
panelPwdEndTime: '面板密碼到期',
panelUpdate: '面板新版本提醒',
@ -3360,8 +3360,8 @@ const message = {
specifiedTime: '指定時間',
deleteTitle: '删除告警',
deleteMsg: '是否確認删除告警任務',
allSslTitle: '所有網站證書SSL到期告警',
sslTitle: '網站{0}證書SSL到期告警',
allSslTitle: '所有網站證書到期告警',
sslTitle: '網站{0}證書到期告警',
allSiteEndTimeTitle: '所有網站到期告警',
siteEndTimeTitle: '網站{0}到期告警',
panelPwdEndTimeTitle: '面板密碼到期告警',
@ -3392,7 +3392,7 @@ const message = {
cleanAlertLogs: '清空告警日誌',
daily: '當日第 {0} 次告警',
cumulative: '累計第 {0} 次告警',
clams: '病毒掃描',
clams: '病毒掃描告警',
taskName: '任務名稱',
cronJobType: '任務類型',
clamPath: '掃描目錄',

View file

@ -3285,7 +3285,7 @@ const message = {
alertRule: '告警规则',
titleSearchHelper: '请输入告警标题支持模糊搜索',
taskType: '告警类型',
ssl: '网站证书(SSL)到期',
ssl: '网站证书到期',
siteEndTime: '网站到期',
panelPwdEndTime: '面板密码到期',
panelUpdate: '面板新版本提醒',
@ -3330,8 +3330,8 @@ const message = {
deleteTitle: '删除告警',
deleteMsg: '是否确认删除告警任务',
allSslTitle: '所有网站证书(SSL)到期告警',
sslTitle: '网站 {0} 证书(SSL)到期告警',
allSslTitle: '所有网站证书到期告警',
sslTitle: '网站 {0} 证书到期告警',
allSiteEndTimeTitle: '所有网站到期告警',
siteEndTimeTitle: '网站 {0} 到期告警',
panelPwdEndTimeTitle: '面板密码到期告警',
@ -3365,11 +3365,11 @@ const message = {
cleanAlertLogs: '清空告警日志',
daily: '当日第 {0} 次告警',
cumulative: '累计第 {0} 次告警',
clams: '病毒扫描',
clams: '病毒扫描告警',
taskName: '任务名称',
cronJobType: '任务类型',
clamPath: '扫描目录',
cronjob: '计划任务',
cronjob: '计划任务执行{0}异常',
app: '备份应用',
web: '备份网站',
database: '备份数据库',

View file

@ -15,38 +15,35 @@
<div class="dropdowns">
<el-select filterable clearable v-model="req.type" @change="search()" class="!w-52 dropdown">
<template #prefix>{{ $t('commons.table.type') }}</template>
<el-option value="ssl" :label="$t('xpack.alert.ssl')" />
<el-option value="siteEndTime" :label="$t('xpack.alert.siteEndTime')" />
<template v-if="isMaster">
<el-option value="panelPwdEndTime" :label="$t('xpack.alert.panelPwdEndTime')" />
<el-option value="panelUpdate" :label="$t('xpack.alert.panelUpdate')" />
<el-option value="nodeException" :label="$t('xpack.alert.nodeException')" />
<el-option value="licenseException" :label="$t('xpack.alert.licenseException')" />
<el-option value="panelLogin" :label="$t('xpack.alert.panelLogin')" />
<el-option value="licenseException" :label="$t('xpack.alert.licenseException')" />
<el-option value="nodeException" :label="$t('xpack.alert.nodeException')" />
<el-option value="panelUpdate" :label="$t('xpack.alert.panelUpdate')" />
</template>
<el-option value="sshLogin" :label="$t('xpack.alert.sshLogin')" />
<el-option value="clams" :label="$t('xpack.alert.clams')" />
<el-option value="shell" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.shell')" />
<el-option value="app" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.app')" />
<el-option value="website" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.website')" />
<el-option value="database" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.database')" />
<el-option
value="directory"
:label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.directory')"
/>
<el-option value="log" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.log')" />
<el-option value="snapshot" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.snapshot')" />
<el-option value="curl" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.curl')" />
<el-option
value="cutWebsiteLog"
:label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.cutWebsiteLog')"
/>
<el-option value="clean" :label="$t('xpack.alert.cronjob') + '-' + $t('setting.diskClean')" />
<el-option value="ntp" :label="$t('xpack.alert.cronjob') + '-' + $t('cronjob.ntp')" />
<el-option value="ssl" :label="$t('xpack.alert.ssl')" />
<el-option value="siteEndTime" :label="$t('xpack.alert.siteEndTime')" />
<el-option value="cpu" :label="$t('xpack.alert.cpu')" />
<el-option value="memory" :label="$t('xpack.alert.memory')" />
<el-option value="load" :label="$t('xpack.alert.load')" />
<el-option value="disk" :label="$t('xpack.alert.disk')" />
<el-option value="load" :label="$t('xpack.alert.load')" />
<el-option value="clams" :label="$t('xpack.alert.clams')" />
<el-option value="shell" :label="$t('xpack.alert.cronjob', [$t('cronjob.shell')])" />
<el-option value="app" :label="$t('xpack.alert.cronjob', [$t('cronjob.app')])" />
<el-option value="website" :label="$t('xpack.alert.cronjob', [$t('cronjob.website')])" />
<el-option value="database" :label="$t('xpack.alert.cronjob', [$t('cronjob.database')])" />
<el-option value="directory" :label="$t('xpack.alert.cronjob', [$t('cronjob.directory')])" />
<el-option value="log" :label="$t('xpack.alert.cronjob', [$t('cronjob.log')])" />
<el-option value="snapshot" :label="$t('xpack.alert.cronjob', [$t('cronjob.snapshot')])" />
<el-option value="curl" :label="$t('xpack.alert.cronjob', [$t('cronjob.curl')])" />
<el-option
value="cutWebsiteLog"
:label="$t('xpack.alert.cronjob', [$t('cronjob.cutWebsiteLog')])"
/>
<el-option value="clean" :label="$t('xpack.alert.cronjob', [$t('cronjob.clean')])" />
<el-option value="ntp" :label="$t('xpack.alert.cronjob', [$t('cronjob.ntp')])" />
</el-select>
<el-select
clearable
@ -191,12 +188,12 @@ const buttons = [
const openView = async (
title: string,
rowData: Partial<Alert.AlertInfo> = {
type: 'ssl',
type: 'panelPwdEndTime',
cycle: 15,
count: 0,
sendCount: 3,
method: '',
project: 'all',
project: '',
status: 'Enable',
title: '',
},

View file

@ -436,20 +436,20 @@ const rules = reactive({
});
const allTaskOptions = [
{ value: 'ssl', label: 'xpack.alert.ssl', show: true },
{ value: 'siteEndTime', label: 'xpack.alert.siteEndTime', show: true },
{ value: 'panelPwdEndTime', label: 'xpack.alert.panelPwdEndTime', show: isMaster.value },
{ value: 'panelUpdate', label: 'xpack.alert.panelUpdate', show: isMaster.value },
{ value: 'nodeException', label: 'xpack.alert.nodeException', show: isMaster.value },
{ value: 'licenseException', label: 'xpack.alert.licenseException', show: isMaster.value },
{ value: 'panelLogin', label: 'xpack.alert.panelLogin', show: isMaster.value },
{ value: 'sshLogin', label: 'xpack.alert.sshLogin', show: true },
{ value: 'clams', label: 'xpack.alert.clams', show: true },
{ value: 'cronJob', label: 'xpack.alert.cronjob', show: true },
{ value: 'licenseException', label: 'xpack.alert.licenseException', show: isMaster.value },
{ value: 'ssl', label: 'xpack.alert.ssl', show: true },
{ value: 'siteEndTime', label: 'xpack.alert.siteEndTime', show: true },
{ value: 'nodeException', label: 'xpack.alert.nodeException', show: isMaster.value },
{ value: 'cpu', label: 'xpack.alert.cpu', show: true },
{ value: 'memory', label: 'xpack.alert.memory', show: true },
{ value: 'load', label: 'xpack.alert.load', show: true },
{ value: 'disk', label: 'xpack.alert.disk', show: true },
{ value: 'load', label: 'xpack.alert.load', show: true },
{ value: 'cronJob', label: 'xpack.alert.cronjob', show: true },
{ value: 'clams', label: 'xpack.alert.clams', show: true },
{ value: 'panelUpdate', label: 'xpack.alert.panelUpdate', show: isMaster.value },
];
function checkCycle(rule: any, value: any, callback: any) {

View file

@ -141,20 +141,20 @@ const noticeTimeRange = ref(noticeDefaultTime);
const resourceTimeRange = ref(resourceDefaultTime);
const generateData = (): Option[] => {
const data: Option[] = [];
data.push({ key: 'ssl', label: i18n.global.t('xpack.alert.ssl'), disabled: false });
data.push({ key: 'siteEndTime', label: i18n.global.t('xpack.alert.siteEndTime'), disabled: false });
data.push({ key: 'panelPwdEndTime', label: i18n.global.t('xpack.alert.panelPwdEndTime'), disabled: false });
data.push({ key: 'panelUpdate', label: i18n.global.t('xpack.alert.panelUpdate'), disabled: false });
data.push({ key: 'clams', label: i18n.global.t('xpack.alert.clams'), disabled: false });
data.push({ key: 'cronJob', label: i18n.global.t('xpack.alert.cronjob'), disabled: false });
data.push({ key: 'cpu', label: i18n.global.t('xpack.alert.cpu'), disabled: false });
data.push({ key: 'memory', label: i18n.global.t('xpack.alert.memory'), disabled: false });
data.push({ key: 'load', label: i18n.global.t('xpack.alert.load'), disabled: false });
data.push({ key: 'disk', label: i18n.global.t('xpack.alert.disk'), disabled: false });
data.push({ key: 'nodeException', label: i18n.global.t('xpack.alert.nodeException'), disabled: false });
data.push({ key: 'licenseException', label: i18n.global.t('xpack.alert.licenseException'), disabled: false });
data.push({ key: 'panelLogin', label: i18n.global.t('xpack.alert.panelLogin'), disabled: false });
data.push({ key: 'sshLogin', label: i18n.global.t('xpack.alert.sshLogin'), disabled: false });
data.push({ key: 'licenseException', label: i18n.global.t('xpack.alert.licenseException'), disabled: false });
data.push({ key: 'nodeException', label: i18n.global.t('xpack.alert.nodeException'), disabled: false });
data.push({ key: 'ssl', label: i18n.global.t('xpack.alert.ssl'), disabled: false });
data.push({ key: 'siteEndTime', label: i18n.global.t('xpack.alert.siteEndTime'), disabled: false });
data.push({ key: 'cpu', label: i18n.global.t('xpack.alert.cpu'), disabled: false });
data.push({ key: 'memory', label: i18n.global.t('xpack.alert.memory'), disabled: false });
data.push({ key: 'disk', label: i18n.global.t('xpack.alert.disk'), disabled: false });
data.push({ key: 'load', label: i18n.global.t('xpack.alert.load'), disabled: false });
data.push({ key: 'clams', label: i18n.global.t('xpack.alert.clams'), disabled: false });
data.push({ key: 'cronJob', label: i18n.global.t('xpack.alert.cronjob'), disabled: false });
data.push({ key: 'panelUpdate', label: i18n.global.t('xpack.alert.panelUpdate'), disabled: false });
return data;
};