how to add Authentication token

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
diksharawat
Posts: 6
Joined: Wed Sep 26, 2018 2:25 am

how to add Authentication token

Post by diksharawat »

Hi,
I need to add a authentication token in my nagios to connect it to another monitoring tool.
I am not able to find anything that can work. please help.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to add Authentication token

Post by scottwilkerson »

Nagios Core does not have a concept of authentication tokens, it uses apache basic authentication with users/passwords.

Nagios XI has API tokens and access, in our commercial product
https://www.nagios.com/products/nagios-xi/
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
diksharawat
Posts: 6
Joined: Wed Sep 26, 2018 2:25 am

Re: how to add Authentication token

Post by diksharawat »

Is there any scope to add authorization token while sending an alert?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to add Authentication token

Post by scottwilkerson »

diksharawat wrote:Is there any scope to add authorization token while sending an alert?
No, however in Nagios XI we do have rapid response URLs that can be used without credentials.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
diksharawat
Posts: 6
Joined: Wed Sep 26, 2018 2:25 am

Re: how to add Authentication token

Post by diksharawat »

Thanks for the reply @scottwilkerson.
I am sorry if i am able to make myself clear or if i am not getting what you.
My problem is:
I am integrating Nagios with Alerta, and for that i need to add token in my Nagios configuration, so that with correct token, Nagios will be authorized to send alerts to Alerta.
Our Alerta is using token concept to authorize who all can send alerts to it.
Is there a way i can do this with Nagios core or i need to buy NagiosXI?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to add Authentication token

Post by scottwilkerson »

I am not familiar with Alerta, do you need to ann Alerta's Authentication token?

There isn't an authentication token for Nagios or Nagios XI that can be included in notifications.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: how to add Authentication token

Post by mcapra »

Notification and event handlers have a concept of "arguments", as does any old Nagios command definition:
https://assets.nagios.com/downloads/nag ... tions.html
https://assets.nagios.com/downloads/nag ... dlers.html

Assuming this token is to be provided to some sort of API call, you could include that as an argument in your notification or event handler.

Here's a reference implementation of a Twilio integration I did:
https://support.nagios.com/forum/viewto ... 94#p252294

In which case I'm passing my "token" via -u <credentials> to a simple curl. That curl could be a custom script, some sort of binary, practically whatever you want/need to communicate with Alerta.

It looks like Alerta has an API as well as a Python client. Both of these could be integrated with Nagios Core as I have described above.
Former Nagios employee
https://www.mcapra.com/
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to add Authentication token

Post by scottwilkerson »

Thanks @mcapra!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
diksharawat
Posts: 6
Joined: Wed Sep 26, 2018 2:25 am

Re: how to add Authentication token

Post by diksharawat »

@mcapra
Thanks for the reply.
I am not sending events to ALerta using curl. We are using ALerta's alerta-neb.c file given in https://github.com/alerta/nagios-alerta.
I have given endpoint in nagios.cfg as Alerta's IP and port.
I am not able to find a way to add token.
Is there any way i can do that?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to add Authentication token

Post by scottwilkerson »

On the alerta page you linked I see this example, is this what you are looking for?
To provide the API key if authentication is enabled on the alerta server:

Code: Select all

broker_module=/usr/lib/nagios/alerta-neb.o http://localhost:8080 key=INSERT_API_KEY_HERE
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked