What's up, home? part 23
Can you monitor a banana with Zabbix? Of course you can!

What's up, home? part 23

Can you monitor a banana with Zabbix? Of course you can! By day, I am a monitoring tech lead in a global cyber security company. By night, I monitor my home with Zabbix & Grafana and do some weird experiments with them. Welcome to my blog about this project.

All was as usual at the recent Zabbix Summit 2022, until Steve Destivelle kept his speech. He asked the audience to say BA-NA-NA every now and then to, I don't know, to keep them awake or entertain them, or both.

From that moment, the rest of the summit went all bananas. So, what's a better way for me to contribute to this ba-na-na meme than to attempt to monitor a banana, as anyway I am now known for monitoring weird things? Here we go!

Apart from a monkey wrench and a gorilla leg for your camera to get perfectly steady photos or videos of your precious snacks, what do we need to monitor bananas with Zabbix? Not much:

  • Some Python (I guess snakes might like bananas, too)
  • OpenCV image recognition libraries (no, that's not a tool to help you create resumes on LinkedIn, the CV stands for Computer Vision)
  • zabbix_sender command
  • Zabbix itself

Let's get started!

This banana monitoring is just a simulation, so I downloaded a random picture of a vector graphics banana from our dear Internet. See, it's beautiful!

No alt text provided for this image

Feed the snake

OK, I now have a nice picture of banana, but how on earth would I monitor that with Zabbix? With OpenCV, that's not too hard. No, I do not know anything about OpenCV, but with some lucky search engine hits and some copy-pasting, I managed to get my super intelligent image recognition script to work.

It's tailored to check a pixel I know belongs to our banana and then check the hue value of that pixel. With hue, it's easier and more reliable to check the actual color, no matter of it's brightness, or so I was told by the articles I found.

Anyway, here's the script!

No alt text provided for this image

Really, most of this was just copy-paste, so I do not take any credit for this code. But, it seems to do its job, as this is what happens when I run the script from command line.

No alt text provided for this image

Fantastic! Or maybe, to honor Steve, I should say This was I-ZI.

Configuring Zabbix

To send this data to Zabbix, I'm going to use good old zabbix_sender command. For that to work, I needed to setup a new trapper type item to Zabbix.

No alt text provided for this image

And, well... that's it. Now if I run the following from command line, it works:

No alt text provided for this image

Let's check from Latest data, too:

No alt text provided for this image

But it needs a dashboard!

Now that it's working, it definitely needs a dashboard. This is what I created for it with just an Item value and URL widgets.

No alt text provided for this image

Ain't technology fantastic? Now if only Zabbix would have dynamic colors for the item value widget, but I guess they told us at the Summit that it's coming.

Of course, like with most of my blog posts, this kind of monitoring could have some real-world use cases, too: make OpenCV to check pictures, video streams, photos, whatever and if color of something that should be the same all the time is not the same anymore, make Zabbix go bananas about it.

I have been working at Forcepoint since 2014 and writing these posts have never been tastier.

Hernandes Martins

Zabbix Trainer | Zabbix Specialist | at Lunio Zabbix Partner

2 年

great

回复
Stefan Matzek

Information Technology Support Consultant bei IntelliTrend GmbH

2 年

Next up should be the automatic action to order new Bananas. Great Project!

要查看或添加评论,请登录

Janne Pikkarainen的更多文章

  • What's up, home? part 30

    What's up, home? part 30

    Can you monitor Northern Lights with Zabbix? Of course you can! By day, I am a monitoring tech lead in a global cyber…

    3 条评论
  • What's up, home? part 29

    What's up, home? part 29

    Can you detect a crying baby with Zabbix? Of course you can! By day, I am a monitoring tech lead in a global cyber…

    2 条评论
  • What's up, home? part 28

    What's up, home? part 28

    Can you monitor FlightGear flight simulator with Zabbix? Of course you can! By day, I am a monitoring tech lead in a…

    9 条评论
  • What's up, home? part 27

    What's up, home? part 27

    Can you have a Zabbix HA cluster at home? Of course you can! By day, I am a monitoring tech lead in a global cyber…

    4 条评论
  • What's up, home? part 26

    What's up, home? part 26

    Can you create fairy tales with Zabbix? Of course you can! By day, I am a monitoring technical lead in a global cyber…

  • What's up, home? part 25

    What's up, home? part 25

    Can you monitor your backups with Zabbix? Of course you can -- and you should! By day, I am a monitoring tech lead in a…

    1 条评论
  • What's up, home? part 24

    What's up, home? part 24

    Can you monitor Finland's total real-time power consumption with Zabbix? Of course you can! By day, I am a monitoring…

    4 条评论
  • What's up, home? part 22

    What's up, home? part 22

    Can you use Zabbix as a countdown timer? Of course you can! By day, I am a monitoring technical lead in a global cyber…

    9 条评论
  • What's up, home? part 21

    What's up, home? part 21

    Can you make sure your video streams are up with Zabbix? Of course you can! By day, I am a monitoring technical lead in…

  • What's up, home? part 20

    What's up, home? part 20

    Can you monitor your upcoming electricity bill with Zabbix? Of course you can! By day, I am a monitoring technical lead…

社区洞察

其他会员也浏览了