Skip to header Skip to main navigation Skip to main content Skip to footer

Search form

Site branding

Home
What's up, home?

Main navigation

  • Home
  • Story mode
  • About
  • Features
  • Hardware list
  • Videos
  • GitHub (opens in new tab)
  • Daily AI generated stories (opens in new tab)

Part 61: My Zabbix goes Generative AI

Breadcrumbs

Breadcrumb

  • Home
  • Part 61: My Zabbix goes Generative AI

Main page content

By whatsuphome | 10:15 PM EET, Tue February 13, 2024

TL;DR

I connected my Zabbix to a locally running GPT4All language model using a simple Python script. By adding the script to Zabbix context menus, I can ask AI questions about my monitoring setup directly from the Zabbix interface. Everything runs locally
Zabbix goes Generative AI

I just integrated my Zabbix with locally running generative AI in five minutes. You could do it, too. Here's how.

Install GPT4All

For my test, I'm using GPT4All, or its Python libraries. Install it with 

pip install gpt4all

Next, I took one of their example scripts and added very primitive command line argument handling. Here's the full Python script.

from gpt4all import GPT4All
import argparse
parser = argparse.ArgumentParser(description='Pass question to GPT4All')
parser.add_argument('-q', '--question')
args=parser.parse_args()
model = GPT4All('wizardlm-13b-v1.2.Q4_0.gguf')
system_template = 'A chat between a curious user and an artificial intelligence assistant.'
prompt_template = 'USER: {0}\nASSISTANT: '
with model.chat_session(system_template, prompt_template):
   response1 = model.generate(args.question)
   print(response1)

With this, you can run the script like python3 your_script_name.py --question "Tell me about Zabbix"

python3 ./zabbix_response_generator.py --question "Tell me about Zabbix"
1. Introduction to Zabbix:
Zabbix is an open-source monitoring software that allows you to monitor network devices, servers, applications, and cloud services in real time. It provides a comprehensive view of your IT infrastructure's health status, enabling you to detect issues before they become critical problems.
2. Key features of Zabbix:
* Real-time monitoring: Zabbix offers real-time monitoring capabilities that allow you to track the performance and availability of your systems continuously. It provides detailed insights into system resource usage, network traffic, application performance, and more.
* Customizable dashboards: You can create customized dashboards in Zabbix to visualize data from multiple sources in a single view. This feature helps you quickly identify issues across different parts of your infrastructure.
* Alerting and notifications: Zabbix allows you to set up alerts based on predefined conditions, such as high CPU usage

Add scripts to Zabbix context menus

Great, it worked, so we are almost done! The only remaining thing is to do now is to bond a loving marriage between Zabbix and the script. For that, you need to first decide, how to summon the script from Zabbix. 

I decided to run it over ssh, as it's running on a laptop, not on my Raspberry Pi 4. To do that, I did go to Zabbix Alerts -> Scripts, added a new script and clicked the buttons to look like this. Note that as parameters to my script --question you can (and should) pass Zabbix macros, such as {EVENT.NAME}, {EVENT.AGE} and whatever you might need to get your reply.

Tell me about this alert question configuration

And it's all done! Or would be. I went a bit crazy and added few more questions. 

What does it look like?

It's gorgeous! Now if I click on any alert on Zabbix alerts list, I get this.

Custom action menu for Generative AI

 

... and if I choose any of the items, after a bit of waiting (MacBook Pro M1 generates the answers in 10-15 seconds) I get this..

Bash commands for fixing the alert

 

... or this ...

Tell me a joke about this alert

... or this ...

Describe the alert like a pirate

You get the idea.

What's next?

Even though I have Zabbix 7.0beta1, this test was made in a more traditional way. Whenever I continue with the GenAI track, I'll move the functionality to a custom widget. Another cool idea would be to make the Python script to query the latest developments in my What's up, home? environment over the Zabbix API, and generate a morning newspaper or whatever in that way. 

We'll see what I'll come up with next. Maybe I ask for more ideas from GPT4All itself...

whatsuphome
zabbix
generativeai
gpt4all
  • Add new comment

Comments (4)

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Zabbix Gen AI

Jules (not verified)

2 years 3 months ago
Permalink
New

I am trying to do this but there are so many configurations issues

  • Reply

Tell me more

whatsuphome

2 years 3 months ago
Permalink
New

What kind of config issues? :)

  • Reply

In reply to Zabbix Gen AI by Jules (not verified)

Error during script launch.

Dylan (not verified)

2 years 2 months ago
Permalink
New

Hello,

I have installed GPT4 All, on a fixed PC on which I have installed Debian 12.
This PC has a Nvidia GTX 3050 graphics card.
When I run the script, I get this error:

Failed to load libllamamodel-mainline-cuda.so: dlopen: libcudart.so.12: cannot open shared object file: No such file or directory
Failed to load libllamamodel-mainline-cuda-avxonly.so: dlopen: libcudart.so.12: cannot open shared object file: No such file or directory

python3 -m venv gpt4all-cli

  • Reply

I don't have Nvidia GPU ..

whatsuphome

2 years 2 months ago
Permalink
New

... but to me that error looks like that you don't have Nvidia CUDA packages installed. Would that be the cause in reality, or would libllama be looking for different version of that, I don't know. But I hope this helps you to find the actual reason :)

  • Reply

In reply to Error during script launch. by Dylan (not verified)

I connected my Zabbix to a locally running GPT4All language model using a simple Python script. By adding the script to Zabbix context menus, I can ask AI questions about my monitoring setup directly from the Zabbix interface. Everything runs locally

Search

Who am I?

  • Janne Pikkarainen from Finland 🇫🇮
  • Began with computers in 1986 with C64
  • Doing IT for living since 1999
  • Principal Site Reliability Engineer at Forcepoint
  • A Zabbix Summit speaker every year since 2022
  • Walking, talking Zabbix commercial

Support my project

Buy me a coffee 

Footer menu

  • Contact

What's up, home? | Janne Pikkarainen | contact(at)whatsuphome.fi | 2022 - 2026

Developed and Designed by Janne Pikkarainen