Skip to main content

Create a surveillance monitor screen with a raspberry pi

  • Fact : Now that Zabbix is installed, why not have it displayed on a separe screen. I got an old TV so.... let's try.
  • Problem : I don't have a direct ethernet connection.
  • Hypothese : Run the websites needed off a RPi 3+ using a Wifi connection and alternate between them.

Need a good SDcard and Time

  • First problem noted... need a good SDCard. I'm at number 2 already.
  • Also, the 64 bit version of bookworm works but after a few hours, I got the multicolor screen. So down to 32 bit it is.
  • I notice some basic glitches while running htop, not enough memory so I added some extra swap memory :
        sudo dphys-swapfile swapoff
    - Then I edited the configuration (swap) file :
    ```bash
    sudo nano /etc/dphys-swapfile
    - Change this value to something that your SDCard can take and under 2gb if you do not want to mess with other configurations, ex: ```CONF_SWAPSIZE=2048```:
    ![swapsize](/img/Security/swapzire.png)
    - Save and then, reinitialize the swap file :
    ```bash
    sudo dphys-swapfile setup
    sudo dphys-swapfile swapon
    - Reboot to take effect :
    ```bash
    sudo reboot
  • For some reason, the time and date was wrong. I fixed that buy running this :
        sudo date -s "2025-03-28 14:30:00"

Create a script and install some apps

  • Need to double check what the Pi is currently running for display (Wayland or X11) :

        sudo raspi-config

    raspconfig

  • Then go to 6 Advanced Options - A6 Wayland - W1 X11 openbox window manager with X11 backend (Cause it runs better on a Pi 3+)

  • Reboot!!

  • Next, need to install these's apps :

    • First one is to remove the mouse cursor:
          sudo apt-get install unclutter
    • Second one is to be able to do keyboard functions (like pressing F5 or Ctrl+Tab):
          sudo apt-get install xdotool
  • Time to create the script. In a new file, that I keeped in my user folder :

    • I named it run_fullsize.sh and added this to it :
          export DISPLAY=:0
      sleep 15
      /bin/chromium-browser --kiosk --start-maximized --noerrdialogs --disable-infobars --enable-features=OverlayScrollbar https://time.is/ http://yourZabbixserver &
    • Let's break it down :
      • export DISPLAY=:0 (It's to make sure that the variable $DISPLAY is set to the first and, in my case the, only display)
      • sleep 15 (Since the script will start @BOOT, we want everything to load before it starts... so 15 seconds)
      • /bin/chromium-browser (Starts Chromium with the next parameters) --kiosk (no interaction) --start-maximized (full screen) --noerrdialogs (Don't want to see that ;) --disable-infobars (no tabs above) --enable-features=OverlayScrollbar (no scroll bar) https... (websites wanting to see)
    • Saved it and made it executable : sudo chmod +x run_fullsize.sh
  • Now, before going any further, I ran it to see if it works :

        ./run_fullsize.sh
    • And it works!
    • NOTE : I couldn't find a way to automatically signin in Zabbix so I pluged in a keyboard and mouse, logged in and click the remember me option
  • Then, I killed the process pkill -o chromium (-o is for oldest) and proceed to create 2 more scripts run_keystroke_sim.sh and run_through_tab.sh :

        sleep 35
    while true; do
    sleep 90
    xdotool key F5
    done
    • And :
        export DISPLAY=:0
    while true; do
    sleep 60
    xdotool key ctrl+Tab
    done
  • Break it down :

    • Don't want to refresh right away so (sleep 35)
      • Then refresh every 90 seconds (sleep 90)
    • On the same display and making sure that the variable is the same (export DISPLAY=:0)
      • Then change the web page every minute (sleep 60)

Need to start scripts @ BOOT

  • I changed to autostart file and added and removed some stuff :

    Autostart

    • Break it down :
      • Not sure what @xset s off @xset s noblank @xset s noblank but we need them
      • To turn off the screen saver # @xscreensaver -no-splash
      • Remove the mouse cursor @unclutter -idle 3 -root
      • Add the 3 scripts :
        • @/home/user/run_fullsize.sh

        • @/home/user/run_through_tab.sh

        • @/home/user/run_keystoke_sim.sh