Support Questions

Find answers, ask questions, and share your expertise

how to check that blueprint installed but not by curl API

avatar

how to check that blueprint installed on ambari-server machine but not by curl API

we need that because we need to identify from bash script that blueprint is installed or not

since ambari-server can be stop then we cant verify BY API

so please suggest if we can validate for sure blueprint installation by search some files or folder on the ambari-server machine

or other approtch ?

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@Michael Bronson

Ambari Blueprints can be registered to Ambari Server only when the Ambari Server is running.

So if there is any error while registering a Blueprint to Ambari Server then we should see the error immediately.

There is no offline way to validate the Blueprint. You will need to make ambari API call to list successfully registered Blueprints

# curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://c6401.ambari.apache.org:8080/api/v1/blueprints

.

You can only enable or disable topology validation and register a blueprint:

POST /api/v1/blueprints/:blueprintName?validate_topology=false

Reference: https://cwiki.apache.org/confluence/display/AMBARI/Blueprints#Blueprints-RegisterblueprintwithAmbari...

View solution in original post

9 REPLIES 9

avatar
Master Mentor

@Michael Bronson

Ambari Blueprints can be registered to Ambari Server only when the Ambari Server is running.

So if there is any error while registering a Blueprint to Ambari Server then we should see the error immediately.

There is no offline way to validate the Blueprint. You will need to make ambari API call to list successfully registered Blueprints

# curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://c6401.ambari.apache.org:8080/api/v1/blueprints

.

You can only enable or disable topology validation and register a blueprint:

POST /api/v1/blueprints/:blueprintName?validate_topology=false

Reference: https://cwiki.apache.org/confluence/display/AMBARI/Blueprints#Blueprints-RegisterblueprintwithAmbari...

avatar

I see an other way to check if BP installed - by hdp-select

what you think? ( if BP not installed then this command will not be exsist )

 hdp-select | grep hadoop-client
hadoop-client - 2.6.0.3-8
Michael-Bronson

avatar
Master Mentor

@Michael Bronson

You can also check the successfully registered Blueprints details inside the Ambari DB

Example:

# psql -U ambari ambari -c "select * from blueprint"
Password for user ambari: bigdata
 blueprint_name | security_type | security_descriptor_reference | stack_id 
----------------+---------------+-------------------------------+----------
 BlueprintTest  | NONE  |  |  6
(1 row)

.

"hdp-select" sets a given version to be the current version, by creating appropriate symlinks to the folder with appropriate version number. This utility "hdp-select" also lists the installed component versions based on the symlink info. So we can not rely on it to validate the blueprint registration. And this command is installed when the HDP components are installed on the host.

So it can not be used for blueprint installation validation as installation might fail on some hosts or might be incomplete installation Or symlinks might be broken ...etc

.

avatar

if you not accept that solution maybe you can suggest some file with hadoop version or other signature file for validation

Michael-Bronson

avatar

please show me the fulll syntax because I get (Password for user ambari:) , can we run this command without enter pass?

or maybe set the password in command ( because I need to set it in the script )

Michael-Bronson

avatar
Master Mentor

@Michael Bronson

You can refer to Standard Postgres Documentation in order to know how to pass the password in Non Interactive mode.

Following doc shows a way: https://www.postgresql.org/docs/8.3/static/libpq-pgpass.html

avatar

I just want to ask - why this approach not works ?


su - postgres -c " psql -tc \"select * from blueprint\" " ERROR: relation "blueprint" does not exist LINE 1: select * from blueprint ^
Michael-Bronson

avatar
Master Mentor

@Michael Bronson

Please try this "-d ambari" to tell the database name as "ambari"

# su - postgres -c "psql -d ambari -tc 'select * from ambari.blueprint' 

.

Example:

# su - postgres -c "psql -d ambari -tc 'select * from ambari.blueprint' "
 BlueprintTest  | NONE          |                               |        6

.

avatar

well done Jay you are the best

Michael-Bronson