Using webhooks to Librenms server (and not from)

I just wondered (assuming via a feature request) if it might be feasible to allow incoming webhook to the librenms server. This would be to receive gluster events, see below. I can’t fully visualize how the librenms integration from the webhook would work. Any thoughts would be welcomed or better help/collaboration to do so.

https://docs.gluster.org/en/latest/Administrator-Guide/Events-APIs/

I’m not clear on what do you want to achieve. I’ve recently been playing with webhooks from NetBox to LibreNMS and it just works. It’s the first time I hear of Gluster.

The limitations might come from what you can do when calling LibreNMS API. I mean in terms of available endpoints.

Regards,

Ah sounds interesting can you explain the setup a bit? When the webhook is pushed to how are you putting the data into libre?

Hi @ds-04,

On NetBox (SoT) you can trigger webhooks for different events, let’s say when you change a device.

I have a webhook server running with a set of rules that will receive that hook and go through the rules, if it matches entirely it triggers a “command”.

I got inspired by this link so I’m currently using the same webhook server.

So, when the hooks match, they call a command passing some arguments from the payload which in turns, calls a python script that interacts with libreNMS API.

The way I do that bit is using this python LibreNMS API client I found. But, you could just get away with “requests” library in python.

Most of the job is being done on the python script, where I check whether device exists or not, or if I have all the details I need to call add_device endpoint on LibreNMS API.

I hope that makes more sense now. The article I included above gives a good idea, complexity depends on what you need to achieve.

Cheers,

Hi,
This is helpful thanks.
That python script is the glue between the webhook server and Librenms.

So then to make this work for the glusterfs cluster use case, I think need to figure out:

-where to put the events in the host/Endpoint/device in Librenms. Not sure if event log per host is suitable. Maybe need somewhere new. Also need to be able to alert from certain events.
-how to show the overall cluster health. Multiple hosts for the cluster. Is it correct to say Librenms applications typically only show graphs.
-perhaps a grouping needs defined in some way. Though this is Linux server + gluster installed on top. How to discover that or more likely tell Librenms certain hosts have gluster.

Thanks

Some more background:

Certain health aspects can be determined through client nagios script and snmp extend. Such as is glusterd running on each host, using a simple check.

Where it gets harder is monitoring of volume health without resorting to gluster cli polling, as can’t do that on all hosts for fear of locking. That’s where the events and webhooks can come in. So if a volume’s brick goes down it’s detected via events/webhook. Or least that is my understanding.

Hi @ds-04,

I guess you could do a similar thing there then. Run a webhook server and a python (or something else) script to glue it all together.

I’m thinking on 2 things that might work

1.- Send a ‘syslog’ or ‘snmp trap’ event to LibreNMS receiver?
2.- Check API collection to see whether any of the available endpoints will do you any favour.

For instance the other day I found out that update_fields would let me update ANY database field of a given device. So, when there is NO specific endpoint to do the job, you could look at the database schema and figure if there is anything you could use.

Just some ideas, sorry I can’t help much, I’m pretty new to LibreNMS myself.

Cheers,

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