Skip to content

doublethink-bps/autoFix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This is script that fix configration file,when zabbix detects http error log.
The script is runed from zabbix,and send error message to OPENAI for analyzing error log.
OPENAI output configration file,parameter and value to fix error.
The script fix configration file and send result of fix file to zabbix.
You can check result of fix.

Alt text

Execution environment

Zabbix Server

  • Zabbix Server 6.0

Monitored Server

  • Zabbix Agent 6.0
  • httpd
  • python 3.11
  • openai

Zabbix environment settings

Refer to the following URL and build zabbix enviroment.

https://www.zabbix.com/download?zabbix=6.0&os_distribution=alma_linux&os_version=9&components=server_frontend_agent&db=mysql&ws=apache

Once zabbix is finished building, You have to regist host,script,action,item,and trigger on zabbix server.

register the host.

[Configuraton]->[Hosts]

Alt text

register item that collecting http error log and zabbix trapper on the host

[Configuraton]->[Hosts]->["target hots"]->[Create Items]

■ setting of collecting http error log

Alt text

■ setting of collecting zabbix trapper

Alt text

register the trigger

■ setting of http error log trigger

[Configuraton]->[Hosts]->["target hots"]->[Create Triggers]

Alt text

■ setting of zabbix trapper trigger

Alt text

register the script

[Administration]->[Scripts]->[Create Script]

When run script, zabbix server must connect to monitored server with ssh.
Therefore, you must sets "ssh" on "type" item.
And, you sets root on Username item. On Commands item,use "items" value detected. And run "zabbixAutofix.sh".

Alt text

register the action

[Configuraton]->[Actions]->[Trigger actions]->[Create Action]

To set execution conditions,set the following item.

Alt text

Alt text

Onece set execution conditions, click "Operatoins" tab.

Alt text

Click "Add" on "Operations" item,set Operation details.
you need to select script that you registed script the previous step.
you set monitored Host on "Target list" item.

Alt text

Monitored Server environment settings

On the monitored server,Move "/root/" directory and run the below command.

dnf install python git
pip install openai
git clone <url>

you need to fix the ip and target hostname in the following commands in zabbixAutofix.sh

zabbix_sender -z <zabbix server ip> -p 10051 -s "<target hostname>" -k zabbixTrapper -o "$result"

Example

After raising http error, check error message on zabbix web console.

Alt text

If you can check http error,click below item.
[last data]-[zabbix trapper item]-[History]

The below image is before value and after value.

Alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published