Zabbix is dedicated to monitoring IT infrastructures based on predetermined thresholds, such as servers, networks, and applications. Incorporating artificial intelligence (AI) into Zabbix as a complement allows a user to mitigate alerts based on these predetermined thresholds, offering possible causes and solutions to problems. This can help a user resolve incidents more efficiently.
In this article, we will explain how to integrate Zabbix and Google’s AI tool Gemini by using the API provided as well as a custom widget alternative.
First steps towards integration
You can find the repository in GitHub based on the Google Gemini model. You’ll need to create an account in Google AI Studio to obtain the required API.
Script configuration in Zabbix
From Zabbix version 7.0, access:
“Alerts” > “Scripts” > “Create Script.”
For this functionality, we designated the name as “Possible cause and solution.” Next, we can configure the parameters with the trigger event and the API generated in AI Studio. We then copy and get the script from the repository mentioned in the «Script» field, as in the following image:
Application in the problem panel
After configuration, we access the alerts panel and select a specific alert. We click on “AI Assistant” and access the functionality that was previously named as “Possible cause and solution.”
The following images present an example of an agent installed on a notebook.
Possible cause:
Possible solution:
The AI will be able to provide a precise solution for each problem presented, allowing us to progressively optimize the predetermined thresholds.
Using the custom widget “What are you working on?”
Creating accurate personalized dashboards for the user is essential. With this in mind, we propose the creation of an AI-based widget called “What are you working on?” (¿Qué harías tu? in Spanish), which analyzes the current state of the problem presented in Zabbix.
This concept integrates all the functionalities present in the widget (including Summary, Perspectives, Diagnosis, Comparison, and Forecast), since the used prompt can indicate whether it is necessary to make adjustments to the strategic plan or predict future trends based on the panel data built.
To exemplify how the “What are you working?” widget works, let’s consider the analysis of disk usage on our Zabbix Server.

Once we have knowledge for the project, on the backend of our Zabbix Server we locate the route:
/usr/share/zabbix/widgets/
Then, we create a folder called “insights” and copy the following repository. It is necessary to place the Gemini API in the file «assets/js/class.widget.php.js» in the field “YOUR_API_KEY.”
On the frontend, we go to “Administration” > “General” > “Modules.”
In the upper right corner, we click on “Scan Directory.” We have our widget to use:
After performing the scan, it is necessary to enable the widget, as it is disabled by default.
The importance of using AI in Zabbix
Let’s imagine a scenario with 100 monitored servers. Performance thresholds, Windows services, or other specific services can generate up to 50 weekly alerts. With the help of AI, it’s possible to reduce this number to a bare minimum, thanks to the weekly collection of possible causes and solutions.
This ground-level approach allows users to solve problems faster, but also improves overall health by minimizing necessary adjustments to the Zabbix server.
Implementing AI locally
Using a dedicated server with open source AI models like HuggingFace, it’s possible to implement the AI locally and create a database collecting the possible causes and solutions of the events.
The AI will learn from repetitive events, offering more accurate answers in the future. The analysis of possible trends can be based on the generated alerts. In this way, we can optimize our alerts and put artificial intelligence to work understanding and solving our problems.
Conclusion
The model we use is project-oriented. We are constantly evolving artificial intelligence, and we must use the model we know best. language is distinct due to the orientation of the prompts used for the answers and the learning we can provide, either by making requests to specific artificial intelligence platforms or by using it locally.
I have some questions…
Hi, for your first question, yes, you need to replace APIGEMINI with the API of GEMINI.
For your second question, execute a curl command from the Zabbix server to see if it brings a response:
curl “https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=GEMINI_API_KEY” \
-H ‘Content-Type: application/json’ \
-X POST \
-d ‘{
“contents”: [{
“parts”:[{“text”: “Explain how AI works”}]
}]
}’
Ensure that it has permission to make outbound connections to port 443 on the host “generativelanguage.googleapis.com”
With the example of using a custom widget to analyze the current state of the problem presented in zabbix, I followed your instructions but when creating a new Insights Dashbroard, it doesn’t seem to work.
In the class.widget.php.js file, you must put the Google API key in “YOUR_API_KEY.” This was tested with version 7.0.
Is it compatible with zabbix ver 6.4? I changed the API key in the class.widget.php.js file. And saved the html2canvas.min.js file in the /usr/share/zabbix folder and changed the path to that file in the class.widget.php.js file.
This test was conducted specifically on Zabbix 7.0. Compatibility with version 6.4 was not tested, so it may not work as expected on that version.
I try with zabbix ver 7.0. But when I add widget show error code “Failed to update widget properties”
Problem solved. thank you
Great job, It was a pleasure.
Hi, I am trying to configure the Script following your guidelines, but no scripts is generated. Can you assist me?
Verify from the server by making a curl request to the Gemini API for connection permissions. Replace APIGEMINI with the real API key; for example, all Gemini API keys start with AIzaSyxxxxxxxx.
Sorry, may be I was not clear. When I inspect an alarm, among the scripts available there is no the AI assistant created by following your instructions.
Problem solved. It works as excpted! Thank you
That’s good, I’m happy for you. It was a pleasure.
To the best of your knowledge, is there a way to include AI agent assistant text into a zabbix-based notification system?
An AI agent and an AI assistant are two different things. You could configure an AI so that when it receives a notification about a problem, it automatically provides a potential solution based on that problem, either directly to your WhatsApp or through a specific notification method. In this blog post, I mention @maria (an AI assistant) who makes this possible: https://blog.zabbix.com/monitoring-my-home-network-with-zabbix/28921/
In the case of an AI agent, it could also be done, but it would be a matter of working on it. This is because it would involve taking an action based on a problem, which would need supervision for the time being.