You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Sean Roberts <sr...@hortonworks.com> on 2018/01/18 14:57:52 UTC

Hit Ambari API from an Ambari Alert?

Ambari folks – Within a service we have an ALERT which uses a SCRIPT. The script talks to the Ambari API (GET and POST). Currently we are providing credentials for the script to talk to the Ambari API.

Is it possible for Alerts, of the WEB or SCRIPT type, to be authenticated automatically since they are being called from Ambari?
--
Sean Roberts

Re: Hit Ambari API from an Ambari Alert?

Posted by Sean Roberts <sr...@hortonworks.com>.
I didn’t find an internal way to do this but am still interested.

Got a tip that Ambari supports SPNEGO. So am using that now :)

--
Sean Roberts
@seano


From: Sean Roberts <sr...@hortonworks.com>
Date: Thursday, January 18, 2018 at 6:56 PM
To: "user@ambari.apache.org" <us...@ambari.apache.org>
Subject: Re: Hit Ambari API from an Ambari Alert?

Gonzalo – Thanks. I’ve seen for grabbing metrics and configs. But in my case I need to submit POSTs to Ambari. Or can we submit to Ambari in other ways.

An example would be hitting /api/v1/ldap_sync_events and the user management APIs.

--
Sean Roberts
@seano


From: Gonzalo Herreros <gh...@gmail.com>
Reply-To: "user@ambari.apache.org" <us...@ambari.apache.org>
Date: Thursday, January 18, 2018 at 6:48 PM
To: "user@ambari.apache.org" <us...@ambari.apache.org>
Subject: Re: Hit Ambari API from an Ambari Alert?

Hi Sean,

You are not meant to do that. The scripts are not really called from Ambari server which is a Java process but from Python scripts invoked by the agent.
If you need config from ambari, you can in your script ask ambari to pass it to you.
If you need some metrics to validate, you can define then in the descriptor including the validations and error messages (or as a last result talk directly to Ambari Metrics which doesn't have user/password)

Have a look at some existing service that has something similar like what you trying to do.

Regards,
Gonzalo

On 18 January 2018 at 14:57, Sean Roberts <sr...@hortonworks.com>> wrote:
Ambari folks – Within a service we have an ALERT which uses a SCRIPT. The script talks to the Ambari API (GET and POST). Currently we are providing credentials for the script to talk to the Ambari API.

Is it possible for Alerts, of the WEB or SCRIPT type, to be authenticated automatically since they are being called from Ambari?
--
Sean Roberts


Re: Hit Ambari API from an Ambari Alert?

Posted by Sean Roberts <sr...@hortonworks.com>.
Gonzalo – Thanks. I’ve seen for grabbing metrics and configs. But in my case I need to submit POSTs to Ambari. Or can we submit to Ambari in other ways.

An example would be hitting /api/v1/ldap_sync_events and the user management APIs.

--
Sean Roberts
@seano


From: Gonzalo Herreros <gh...@gmail.com>
Reply-To: "user@ambari.apache.org" <us...@ambari.apache.org>
Date: Thursday, January 18, 2018 at 6:48 PM
To: "user@ambari.apache.org" <us...@ambari.apache.org>
Subject: Re: Hit Ambari API from an Ambari Alert?

Hi Sean,

You are not meant to do that. The scripts are not really called from Ambari server which is a Java process but from Python scripts invoked by the agent.
If you need config from ambari, you can in your script ask ambari to pass it to you.
If you need some metrics to validate, you can define then in the descriptor including the validations and error messages (or as a last result talk directly to Ambari Metrics which doesn't have user/password)

Have a look at some existing service that has something similar like what you trying to do.

Regards,
Gonzalo

On 18 January 2018 at 14:57, Sean Roberts <sr...@hortonworks.com>> wrote:
Ambari folks – Within a service we have an ALERT which uses a SCRIPT. The script talks to the Ambari API (GET and POST). Currently we are providing credentials for the script to talk to the Ambari API.

Is it possible for Alerts, of the WEB or SCRIPT type, to be authenticated automatically since they are being called from Ambari?
--
Sean Roberts


Re: Hit Ambari API from an Ambari Alert?

Posted by Gonzalo Herreros <gh...@gmail.com>.
Hi Sean,

You are not meant to do that. The scripts are not really called from Ambari
server which is a Java process but from Python scripts invoked by the agent.
If you need config from ambari, you can in your script ask ambari to pass
it to you.
If you need some metrics to validate, you can define then in the descriptor
including the validations and error messages (or as a last result talk
directly to Ambari Metrics which doesn't have user/password)

Have a look at some existing service that has something similar like what
you trying to do.

Regards,
Gonzalo

On 18 January 2018 at 14:57, Sean Roberts <sr...@hortonworks.com> wrote:

> Ambari folks – Within a service we have an ALERT which uses a SCRIPT. The
> script talks to the Ambari API *(GET and POST).* Currently we are
> providing credentials for the script to talk to the Ambari API.
>
>
>
> *Is it possible for Alerts, of the WEB or SCRIPT type, to be authenticated
> automatically since they are being called from Ambari?*
>
> --
>
> Sean Roberts
>