You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2024-01-31 22:39:07

nickkecooper
Member
Registered: 2024-01-30
Posts: 11

LibreNMS API

Hey all! I created a LibreNMS to GLPI integration using the API call. If an alert happens within Libre it will call the api to create a ticket. All works well however I statically put the session_token into the query since I don't know of another way. Will the session token expire?

Offline

#2 2024-02-10 17:09:24

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,806
Website

Re: LibreNMS API

Session tokens will expire and shouldn't be used over a long period of time. You should instead call the /initSession endpoint to get a session token using a user token + app token whenever it needs to use the API.
Also, how are you connecting LibreNMS to GLPI? Does it just run a script when certain thresholds are met, or is there something inside LibreNMS itself like webhooks or API integration?


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2024-02-29 20:34:11

nickkecooper
Member
Registered: 2024-01-30
Posts: 11

Re: LibreNMS API

Thanks for the reply! So I am using the LibreNMS API integration but that doesn't seem to be working. I don't think I can call the initSession during the same API call to create a ticket. My config in LibreNMS can be found at this image link https:// ibb.co/ctPGtc4 If I put a static session token into the session-token variable it will work until the token expires of course.

Last edited by nickkecooper (2024-02-29 20:35:02)

Offline

#4 2024-03-01 12:21:06

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,806
Website

Re: LibreNMS API

I don't think you can use the API transport at all. It seems annoying that it only supports basic authentication and doesn't let you specify another URL for authentication. Unfortunately, that means it also won't work at all with the new API (the current one will still exist) coming in the next main version of GLPI which uses OAuth exclusively and doesn't use sessions between requests. At this point, the only solution seems to be to create a custom transport (which requires PHP coding as far as I can tell).

https://docs.librenms.org/Alerting/Creating-Transport/


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2024-03-01 15:44:56

nickkecooper
Member
Registered: 2024-01-30
Posts: 11

Re: LibreNMS API

Thanks for the information. I know PHP pretty well I may take a stab at making my own transport. I guess I could also do email and have GLPI look at an inbox for ticket creation.

Offline

#6 2024-03-01 17:25:15

nickkecooper
Member
Registered: 2024-01-30
Posts: 11

Re: LibreNMS API

I created a Transport in LibreNMS and it looks to be working! If anyone wants it I'd be glad to share the LibreNMS code.

Offline

#7 2024-04-03 09:11:01

zekaleka
Member
Registered: 2023-09-14
Posts: 29

Re: LibreNMS API

nickkecooper wrote:

I created a Transport in LibreNMS and it looks to be working! If anyone wants it I'd be glad to share the LibreNMS code.

Can you please show here or send me script? It would be cool if ticket were created smile

Offline

#8 2024-06-10 11:24:39

nifasyo
Member
Registered: 2024-06-10
Posts: 1

Re: LibreNMS API

nickkecooper wrote:

I created a Transport in LibreNMS and it looks to be working! If anyone wants it I'd be glad to share the LibreNMS code.

good evening could you send the code to me too? id like to test it!
Thank you in advance!

Offline

#9 2024-09-06 17:12:19

mmendozaf
Member
Registered: 2024-09-06
Posts: 2

Re: LibreNMS API

nifasyo wrote:
nickkecooper wrote:

I created a Transport in LibreNMS and it looks to be working! If anyone wants it I'd be glad to share the LibreNMS code.

good evening could you send the code to me too? id like to test it!
Thank you in advance!


Could you share the code or point to the correct repositori to contribute ?

Offline

#10 2024-10-03 14:56:09

Shaguu
Member
Registered: 2021-06-27
Posts: 7

Re: LibreNMS API

nickkecooper wrote:

I created a Transport in LibreNMS and it looks to be working! If anyone wants it I'd be glad to share the LibreNMS code.

Same here smile

Thanks

Offline

Board footer

Powered by FluxBB