I want to be able to run a shell script when an alert is fired

Hi all,

I am fairly new to LibreNMS (just got it installed yesterday), however I have been messing around with Observium for a while now. One thing I use in Observium is the ability to run a script has an alert transport. This is very usefull for me, since I use it to integrate with our monitoring and automation enviroment. I am looking for that option here, but I am struggling to find it.
So, my question is, is this an available functionality in LibreNMS? If it is, can someone point me out in the right direction?

Best Regards to you all,
Nelson

By the way, great job with this app.

Sounds like you may want the API Transport - LibreNMS Docs if you are integrating systems, but I’ve done it a few other ways too …

In a previous life I used to read the alert entries from the server logs and do things with them - having a quick look on my current install I can’t see if they are hitting the logs, but I know this used to work and I did both:

  1. From syslog data using Syslog - External Hooks - LibreNMS Docs - In my case more for the purposes of INSTANT alerts from things that hit syslog, which I then webhook in the script to Slack etc.

  2. Have all the syslogs of the LibreNMS server itself going to Graylog which is pretty common, and used that to do the alerting and custom script calling.

If the nothing about the alerts hits syslog (does anyone know if this is a settings / possible?) then back to the API Transport …

If your systems can’t be made to work directly with it, stand up a small web server or inetd hack to listen and run a script. Though if you’re going to go that far, it’s probably quicker to just write a small transport: Creating Transports - LibreNMS Docs there are plenty of examples to work from.

1 Like

Hi rhinoau,
thanks for the reply. I will try to look into what you said… but anyway, would not be easier to just add an executable/script option, like in Observium?
Has it been proposed as a feature for development for a next release?

As we’re a community project, if it’s something of value to you, it’s up to you to contribute it or find likeminded people to help.

Put something in feature requests and see if anyone bites to help.

I suspect anything related has sat idle because it needs several critical security design choices which are above and beyond what most people would consider a simple script call.

You’ve got to deal with scripts in the webserver context breaking out, chroot jails, local versus remote, containerisation etc. which starts to lend itself to a bigger framework of controlled API style calls between compenents to handle that.

I might be overthinking it but that’s the other point, everyone will have a different requirement and security expectation so discussing it is the first step.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.