[SOLVED] Hook custom script into notifications system

Nov 27, 2023
264
67
33
Netherlands
daniel-doggy.com
Hello everyone,

I have my Proxmox VE host running for a couple of months now and I am really happy with my setup so far.
Now that everything is working as I want, I finally have the time for some fine tuning of some of my processes, scripts and things.

One thing that I would like to do (and like to know if this is possible) is to "plug" my cloud-image update script into the notifications system.
So that after the update script runs it sends out a info notification when it did not need to update (and thus can be filtered out and send a webhook to my monitor) and a warning when it updated the cloud image (to send a "Hey, the cloud-images are updated" to my admin email).

And info on if this is possible and if so, how will be appreciated.
 
Thanks for the info.

Using sendmail would be a possibility for my script.
The only downside (for my use case) is that I cannot filter on severity as it is always unkown.

Ideally I would also be able to filter on severity since I also cannot filter on email subject if it is a system-mail notification trigger.
Since when it exits with anything except 0 it needs to notify my admin email and not notify my monitor (webhook)
And when it is 0 it only needs to notify my monitor (webhook) and only email the admin when it also updated the cloud-images.

But I guess something like this is not possible?
 
But I guess something like this is not possible?
Not really at this time, no. In theory you could write a small Perl script which calls into the notification system's API, but this is not really a supported use case and potentially prone to breakage with future updates. If you're interested I could still give you some hints for that.
 
Thanks for the info.

I am planning to add the notification system to my script without any hacky workarounds as stablity is the most important thing for me.

If this was supported natively then that would be the most ideal but given that is it not, it is just something I have to work around.
Since the script also run on my production servers, it is also important that it does not break whenever it feels like it.
And given that the API is not natively supported and thus may change whenever, it is not suitable for my usecase.
 
Last edited: