Monitor server and create notification

Fellow EOS friends, I’d like to pick you brains, the challenge at hand is a few webcams which load their pictures onto my Arch server whenever they record an alarm.
I right now completed a little script which monitors (inotifywait) the camera folder and puts out a clickable link on the console

$ scripts/monitorCameras.sh
Camera tracker v. 1.0
Stairs 21:14 -> smb://camera@homeserver/Cameras/10_18_126_147/000/093

This works, but, I need to ssh into the server to run the script and see the output.
What I really want is some sort of notification on my laptop. My DE is Plasma so I wonder if I somehow can push these alerts as a KDE notification?

Anyone got an idea on how to approach this?

Simplepush can do it. Think it cost me £3 - £4 (UK).

  • Install ntfy from aur
  • Install simplepush for android
  • Create a config file in ~/.config/ntfy/ntfy.yml
---
backends:
simplepush:
    key: "XXXXX"

Where “XXXX” is the key from the app.

Then all you have to do is:

ntfy -b simplepush send "your message"

Screenshot_2020-11-22-21-02-12-20_9f448078c41c7529b380fd92608095eb

That would push it onto my phone instead of my laptop? Not a bad idea, I’ll check it out…

Just tested:

ntfy -b simplepush send www.bbc.co.uk

Gives a clickable link.

When you said kdeconnect I assumed (wrongly) it was to phone, I need to stop speed reading :smiley:

1 Like

Not an issue of speed reading but rather brain reading :slight_smile:
I was about to add kdeconnect to my opening post but then kept it more generic. Somehow it must have transmitted over…or maybe you read my response in the kdeconnect thread :slight_smile:

1 Like

Yes, I am psychic - it says medium in my underpants :rofl: (I wish!).

3 Likes

Is a good resource, I was using pushbullet, but it is too intrusive, it was winding me up.

But pushbullet would go to your laptop… so may be worth a look.

Indeed, this may do the trick without any 3rd party, I noticed a “host” parameter.

Edit: No, the host parameter is for XMPP only. Maybe I’ll have the server write into a file which I monitor from my laptop, I could use notify-send “test”…but these notifications aren’t clickable…

I am now considering a script local to the laptop which will go over the network and monitor the server file for changes and which will show the link in the KDE panel via the “Command-Output” Plasma applet.

noticed your smb://connection - samba mirrors a utility from windows

net send
1 Like

only as suggestion on using a webcam to monitor and detect motion + serving the output

2 Likes

Thanks guys, good food for thought. I’ll report back once I got something.

Edit: Making progress, I am now running my server script directly via ssh which allows me to securely pull the screen output over to my laptop without the need to copy log files or monitor files across the network:

ssh homeserver ~/scripts/monitorCameras.sh | tee ssh-session.log

From the local ssh-session.log file I can push things as notification:

x=$(tail -1 ssh-session.log); notify-send $x

The only thing I haven’t figured out yet is how to make the notify-send message clickable
image

Edit2: Got a working solution :+1:
I am now using ssh as shown above as Systemd daemon, the output of the script goes into a temporary log file which I monitor with the CommandOutput Applet. When I click on the string I launch the jpg via xdg-open…
image

Boy, I really love Linux for solutions like this…no programing, no bending over backwards, but rather linking together existing tools and capabilities.