What's up, home? part 108: cover image

Long time ago back in part 21 I blogged on concept level about how to monitor your CCTV streams with Zabbix and some shell scripting. The idea back then was to use mplayer, vlc or similar tool for watching the stream. If the playback stops, then the stream is broken, thus there's something wrong with the camera or the connectivity to it. That method works, but with Zabbix 7.0 and its Selenium tests, it's very much possible to monitor your CCTV natively through Zabbix without any external scripts. In this case, it would be just screenshots instead of video stream.

Originally I started to take these screenshots to kind of stress-test my Zabbix and Raspberry Pi 4. My Zabbix has been taking screenshots of various websites for a long time now, and that has been so worry-free that I wanted to see if taking screenshots more often would cause any harm. Our CCTV is recording a clip whenever movement is detected, but this use case is a bit different even if a bit silly.

Let's get to it.

Find out how to get screenshots from your CCTV

First, check from the excellent iSpy Camera Connect Database how you can communicate with your CCTV. For the longest time I thought that our camera would only provide an RSTP video stream, but then I noticed that another URL in the database shows how to grab JPEG screenshots, which led me to implement this Selenium test.

Setup a new browser test 

Setup new browser test

This step is extremely easy:

  • Add your camera as a new host if you don't have that already
  • Add the Website by Browser template for the host
  • On host Macros tab, fill in the macros for camera URL, path, http/https scheme, and interval how often you want to take your screenshots.
Macros tab

Save your (new) host, and you are done! Now you can go and see your dashboard in all its glory.

Screenshots dashboard

Next, go to your camera host dashboard on Zabbix and you get to something like the following. I don't want to share what our camera output looks like so that part is blurred, but you get the idea.

Camera dashboard

To kind of benchmark Zabbix browser tests, my Zabbix is snapping the screenshots every minute. What does that do for the performance? This has now been running for about a week and with about 10k camera screenshots:

  • My Raspberry Pi and Zabbix remain as fast as before
  • However, disk space usage is growing fast (not so surprising)
Disk space usage

... so I might need to consider slowing down my screenshot rate a little bit. However, this is not all because of screenshots, no no, it's also because of my daily backups which are growing a lot.

pi@raspberrypi /m/u/b/mysql> ls -lah
total 89G
drwxr-xr-x  2 pi users 4.0K Jan 23 05:00 ./
drwxr-xr-x 16 pi users 4.0K Oct 29 07:28 ../
-rw-r--r--  1 pi pi    3.7G Jan 16 02:56 database-2025-01-16.gz
-rw-r--r--  1 pi pi    3.7G Jan 17 03:01 database-2025-01-17.gz
-rw-r--r--  1 pi pi    6.1G Jan 18 03:20 database-2025-01-18.gz
-rw-r--r--  1 pi pi    9.3G Jan 19 03:32 database-2025-01-19.gz
-rw-r--r--  1 pi pi     13G Jan 20 03:31 database-2025-01-20.gz
-rw-r--r--  1 pi pi     16G Jan 21 03:51 database-2025-01-21.gz
-rw-r--r--  1 pi pi     19G Jan 22 04:08 database-2025-01-22.gz
-rw-r--r--  1 pi pi     21G Jan 23 04:30 database-2025-01-23.gz

As you can see, the backups are growing like crazy. which of course contributes to disk space usage a lot, too. After all, I only have a 1 TB external SSD for my Zabbix and other stuff that's on my Raspberry.

The camera itself might be flaky

However, what this small test is revealing that even if the camera itself is online -- it responds to ping and all -- it tends to fail a lot with these screenshots. My other Selenium tests, such as the one testing this blog, are running just fine, so this is something with the camera web server. Maybe I'll try to reboot it to see if it helps, if not, then I'll make Zabbix to reboot the camera, as it is connected to a smart power plug which is connected with my Cozify, so I can cold reboot the camera easily.

Crashing camera TV?

Other ideas: Let AI describe what it sees in the pictures

I have not yet added this functionality to my Selenium test, but it's pretty much the same than the banana experiment on the previous blog post. Even though Ollama Llava gets some parts of the description wrong -- I'm not telling what --, overall it's very good and could very well spot on its own if there's something actually happening in the screenshot.

"The image shows a snowy residential scene. There is a house with a visible solar panel system on the roof, suggesting that the homeowner uses renewable energy. In front of the house, there appears to be a driveway and some steps leading up to the door. The porch railings are also covered in snow, indicating recent heavy snowfall. To the right side of the image, there is a small structure with a sloped roof and what seems to be an air conditioning unit on top. The ground is completely covered in white snow, typical of winter conditions. The sky is overcast, suggesting that the weather might be cold or windy at the time the photo was taken. There are no people visible in the image."

I hope this blog post gave you some new ideas how to further utilize Selenium tests.




Add new comment

Restricted HTML

  • 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.
Submitted by whatsuphome on