An Engineer's Tool: Smart Alerts for Zabbix with Gemini AI
- Introduction
- What It Does (Features)
- Before You Start (Prerequisites)
- How to Set It Up
- Fine-Tuning (Customization)
- If Something Goes Wrong (Troubleshooting)
- Want to Help? (Contributing)
- License
- Contact
As engineers, we deal with Zabbix alerts constantly. Sometimes, it's hard to quickly understand what's happening or what to do next. This project, Zabbix-Gemini-AI-Webhook, is a simple but powerful tool I built to make our lives easier.
It connects Zabbix with Google's Gemini AI. When Zabbix sends an alert, this webhook takes the alert details, sends them to Gemini, and Gemini gives us quick suggestions: what might be causing the problem, how to fix it, useful commands to check things, and even ideas to stop it from happening again.
Think of it as having a smart assistant for every alert. It helps us understand and fix issues faster, which means less downtime and less stress.
- Smart Troubleshooting: Get immediate AI-driven ideas for alert causes, solutions, debug commands, and prevention steps.
- Language Choice: Choose between English or Spanish for Gemini’s responses.
- Control Response Length: Get short (~10 lines) or detailed answers.
- Focus the AI: Set focus areas like "root cause," "network issues," or "performance."
- Adjust Gemini's Brain: Customize temperature, maxOutputTokens, topP, and topK from Zabbix.
- Better Error Messages: Clear error messages for easier debugging.
Make sure you have these ready:
- Zabbix Server: Version 5.0 or newer.
- Internet Access: Server must connect to
https://generativelanguage.googleapis.com
. - Google Account: To get your Gemini API key.
- Go to Google AI Studio.
- Create a new API key.
- Important: Save this key. It’s like a password for Gemini.
-
Log into Zabbix as an admin.
-
Go to
Administration -> Media types
. -
Click Create media type.
-
Use these details:
- Name:
Gemini AI Webhook
- Type:
Webhook
- Parameters:
api_key (String) alert_subject (String) temperature (Number, Optional, Default: 0.7) maxOutputTokens (Number, Optional, Default: 200) topP (Number, Optional, Default: 0.9) topK (Number, Optional, Default: 40) prompt_language (String, Optional, Default: English) prompt_length (String, Optional, Default: concise) prompt_focus (String, Optional, Default: causes, solutions, debug commands, mitigation)
- Name:
-
Script: Paste the entire JavaScript code provided here.
- Go to
Administration -> Users
. - Select the user(s) for AI alerts.
- Go to the Media tab → Add.
- Options:
- Type:
Gemini AI Webhook
- Send to: Leave blank or fill in as needed.
- Use if severity: Select desired alert levels.
- Enabled: ✅
- Parameters:
{ "api_key": "YOUR_GEMINI_API_KEY_HERE", "temperature": 0.7, "maxOutputTokens": 250, "prompt_language": "English", "prompt_length": "concise", "prompt_focus": "causes, solutions, debug commands, mitigation" }
- Type:


🔐 Tip: Use Zabbix global macro like
{$GEMINI_API_KEY}
instead of hardcoding your API key.
- Go to
Configuration -> Actions -> Trigger actions
. - Click Create action.
Action Tab:
- Name:
Send Smart Alert (Gemini)
- Conditions: Set based on server/group/severity.
Operations Tab:
- Click Add:
- Operation type:
Send message
- Send to Users: Choose user(s)
- Send only to:
Gemini AI Webhook
- Default message: ❌
- Custom message: ✅
- Operation type:
Subject:
AI Insight for: {EVENT.NAME}
Always show details
Message:
{
"api_key": "{$GEMINI_API_KEY}",
"alert_subject": "{EVENT.NAME}",
"temperature": 0.7,
"maxOutputTokens": 250,
"prompt_language": "English",
"prompt_length": "detailed",
"prompt_focus": "root cause, solution steps, impact, troubleshooting commands"
}