User Tools

Site Tools


zabbix_logs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zabbix_logs [2026/07/20 08:29]
val [Черновик]
zabbix_logs [2026/07/20 13:26] (current)
val [Черновик]
Line 69: Line 69:
   Severity: Warning   Severity: Warning
   Expression: nodata(/​abcd.corpX.un/​log[/​var/​log/​syslog,​ ... ],1m)=0   Expression: nodata(/​abcd.corpX.un/​log[/​var/​log/​syslog,​ ... ],1m)=0
 +  ??? PROBLEM event generation mode: Multiple
 </​code>​ </​code>​
  
-  * [[Сервис Zabbix#​Настройка уведомлений о событиях]]+  * [[Сервис Zabbix#​Настройка уведомлений о событиях]], Оставить только Problem Template и убрать из текста слова Problem и Severity ​
  
 <​code>​ <​code>​
Line 87: Line 88:
 2026-07-17T19:​49:​54.446616+03:​00 gate dhcpd[943]: DHCPDISCOVER from 08:​00:​27:​98:​57:​d0 via eth0 2026-07-17T19:​49:​54.446616+03:​00 gate dhcpd[943]: DHCPDISCOVER from 08:​00:​27:​98:​57:​d0 via eth0
 </​code>​ </​code>​
 +<​code>​
 +(zabbix_venv) server.corp13.un:/​usr/​lib/​zabbix/​alertscripts#​ cat llm_context_enrichment.py
 +#​!/​opt/​zabbix_venv/​bin/​python3
  
 +import sys
 +import smtplib
 +import re
 +from email.header import Header
 +from email.mime.text import MIMEText
 +
 +import request_to_agent
 +
 +SMTP_SERVER = "​localhost"​
 +SENDER_EMAIL = "​zabbix-llm@corp13.un"​
 +
 +SYSTEM_PROMPT = (
 +    "Ты - IT эксперт.\n"​
 +    "​Оцени важность сообщения и уточни,​ почему.\n"​
 +    "​Первое слово в ответе должно быть да или нет.\n"​
 +)
 +
 +alert_sendto = sys.argv[1]
 +alert_subject = sys.argv[2]
 +alert_message = sys.argv[3]
 +
 +#​agent_response = request_to_agent.request_to_agent(alert_message,​ SYSTEM_PROMPT,​ ""​)
 +agent_response = alert_message
 +
 +match = re.search(r'​^\s*([a-zA-Zа-яА-Я1-9]+)',​ agent_response)
 +first_word = match.group(1)
 +remaining_text = agent_response[match.end():​]
 +
 +'''​
 +print(first_word)
 +print(alert_sendto)
 +print(alert_message)
 +#​print(agent_response)
 +print(remaining_text)
 +'''​
 +
 +msg = MIMEText(alert_message + remaining_text,​ "​plain",​ "​utf-8"​)
 +
 +if first_word.lower() == '​да':​
 +   ​msg["​Subject"​] = Header("​ВНИМАНИЕ! " + alert_subject,​ "​utf-8"​)
 +else:
 +   ​msg["​Subject"​] = Header(alert_subject,​ "​utf-8"​)
 +
 +msg["​From"​] = SENDER_EMAIL
 +msg["​To"​] = alert_sendto
 +
 +with smtplib.SMTP(SMTP_SERVER) as server:
 +    server.sendmail(SENDER_EMAIL,​ [alert_sendto],​ msg.as_string())
 +
 +</​code>​
 ===== Разбор от DeepSeek ===== ===== Разбор от DeepSeek =====
  
zabbix_logs.1784525392.txt.gz · Last modified: 2026/07/20 08:29 by val