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.
- Zabbix Server 6.0
- Zabbix Agent 6.0
- httpd
- python 3.11
- openai
Refer to the following URL and build zabbix enviroment.
Once zabbix is finished building, You have to regist host,script,action,item,and trigger on zabbix server.
[Configuraton]->[Hosts]
[Configuraton]->[Hosts]->["target hots"]->[Create Items]
■ setting of collecting http error log
■ setting of collecting zabbix trapper
■ setting of http error log trigger
[Configuraton]->[Hosts]->["target hots"]->[Create Triggers]
■ setting of zabbix trapper trigger
[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".
[Configuraton]->[Actions]->[Trigger actions]->[Create Action]
To set execution conditions,set the following item.
Onece set execution conditions, click "Operatoins" tab.
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.
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"
After raising http error, check error message on zabbix web console.
If you can check http error,click below item.
[last data]-[zabbix trapper item]-[History]
The below image is before value and after value.