Обновить docs/services/lxc208-manage/alert/formatters.py
This commit is contained in:
parent
828c8b2e51
commit
3f77af6967
@ -62,6 +62,102 @@ def backup_failed(info):
|
|||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_ban(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
scope = alert_info.get("scope", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F4CD <b>\u0426\u0435\u043b\u044c:</b> {scope}:{value}")
|
||||||
|
lines.append(f"\u26A1 <b>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435:</b> \u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_alert(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
scope = alert_info.get("scope", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
if scope and value:
|
||||||
|
lines.append(f"\U0001F4CD <b>\u0426\u0435\u043b\u044c:</b> {scope}:{value}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_mass_attack(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F4CA <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u043d\u043e\u0432:</b> {value}")
|
||||||
|
lines.append(f"\u26A1 <b>\u0421\u0442\u0430\u0442\u0443\u0441:</b> \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_service_disabled(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F6E1 <b>\u0421\u0438\u0441\u0442\u0435\u043c\u0430:</b> {value}")
|
||||||
|
lines.append(f"\u26A1 <b>\u0421\u0442\u0430\u0442\u0443\u0441:</b> \u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_sudo(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
reason = alert_info.get("reason", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F464 <b>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:</b> {value}")
|
||||||
|
lines.append(f"\U0001F4DD <b>\u041a\u043e\u043c\u0430\u043d\u0434\u0430:</b> {reason}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
def crowdsec_mass_attack(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F4CA <b>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u043d\u043e\u0432:</b> {value}")
|
||||||
|
lines.append(f"\u26A1 <b>\u0421\u0442\u0430\u0442\u0443\u0441:</b> \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_file_change(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F5C2\uFE0F <b>\u0424\u0430\u0439\u043b:</b> {value}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_package(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F9F0 <b>\u041f\u0430\u043a\u0435\u0442:</b> {value}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_service(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F6E0 <b>\u0421\u0435\u0440\u0432\u0438\u0441:</b> {value}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def crowdsec_connection(alert_info):
|
||||||
|
lines = []
|
||||||
|
host = alert_info.get("host", "unknown")
|
||||||
|
value = alert_info.get("value", "")
|
||||||
|
lines.append(f"\U0001F5A5 <b>Host:</b> {host}")
|
||||||
|
lines.append(f"\U0001F310 <b>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435:</b> {value}")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
FORMATTERS = {
|
FORMATTERS = {
|
||||||
"temperature": temperature,
|
"temperature": temperature,
|
||||||
"bad_blocks": bad_blocks,
|
"bad_blocks": bad_blocks,
|
||||||
@ -71,6 +167,16 @@ FORMATTERS = {
|
|||||||
"backup_outdated": backup_outdated,
|
"backup_outdated": backup_outdated,
|
||||||
"backup_success": backup_success,
|
"backup_success": backup_success,
|
||||||
"backup_failed": backup_failed,
|
"backup_failed": backup_failed,
|
||||||
|
"crowdsec_ban": crowdsec_ban,
|
||||||
|
"crowdsec_alert": crowdsec_alert,
|
||||||
|
"crowdsec_mass_attack": crowdsec_mass_attack,
|
||||||
|
"crowdsec_service_disabled": crowdsec_service_disabled,
|
||||||
|
"crowdsec_sudo": crowdsec_sudo,
|
||||||
|
"crowdsec_mass_attack": crowdsec_mass_attack,
|
||||||
|
"crowdsec_file_change": crowdsec_file_change,
|
||||||
|
"crowdsec_package": crowdsec_package,
|
||||||
|
"crowdsec_service": crowdsec_service,
|
||||||
|
"crowdsec_connection": crowdsec_connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user