Support Questions

Find answers, ask questions, and share your expertise

how to print all config type by API

avatar

is it possible to print all config type from ambari cluster by API or by other aprotch

what is the config type - example:

mapred-site

hdfs-site

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Master Mentor

@uri ben-ari

One approach will be to use a Shell Script and make an Ambari API call as following and then grep the config types:

Example: ("/tmp/get_all_config_types.sh" create a file like following)

for CONFIG_TYPE in `curl -s -u admin:admin http://amb25101.example.com:8080/api/v1/clusters/plain_ambari?fields=Clusters/desired_configs | grep '" : {' | grep -v Clusters | grep -v desired_configs | cut -d'"' -f2`; do
   echo "Config_type:  $CONFIG_TYPE"
done

.

Replace the following values in the above script based on your environment:

"amb25101.example.com" with your Ambari Server Hostname
"plain_ambari" with your ambari cluster name
8080 with the port of your ambari server.

Output:

# chmod 755 /tmp/config_types.sh 
# /tmp/config_types.sh 
Config_type:  admin-log4j
Config_type:  admin-properties
Config_type:  ams-env
Config_type:  ams-grafana-env
Config_type:  ams-grafana-ini
Config_type:  ams-hbase-env
Config_type:  ams-hbase-log4j
Config_type:  ams-hbase-policy
Config_type:  ams-hbase-security-site
Config_type:  ams-hbase-site
Config_type:  ams-log4j
Config_type:  ams-logsearch-conf
Config_type:  ams-site
Config_type:  ams-ssl-client
Config_type:  ams-ssl-server
Config_type:  atlas-tagsync-ssl
Config_type:  beeline-log4j2
Config_type:  capacity-scheduler
Config_type:  cluster-env
Config_type:  core-site
Config_type:  hadoop-env
Config_type:  hadoop-metrics2.properties
Config_type:  hadoop-policy
Config_type:  hbase-env
Config_type:  hbase-log4j
Config_type:  hbase-logsearch-conf
Config_type:  hbase-policy
Config_type:  hbase-site
Config_type:  hcat-env
Config_type:  hdfs-log4j
Config_type:  hdfs-logsearch-conf
Config_type:  hdfs-site
Config_type:  hive-atlas-application.properties
Config_type:  hive-env
Config_type:  hive-exec-log4j
Config_type:  hive-exec-log4j2
Config_type:  hive-interactive-env
Config_type:  hive-interactive-site
Config_type:  hive-log4j
Config_type:  hive-log4j2
Config_type:  hive-logsearch-conf
Config_type:  hive-site
Config_type:  hivemetastore-site
Config_type:  hiveserver2-interactive-site
Config_type:  hiveserver2-site
Config_type:  kafka-broker
Config_type:  kafka-env
Config_type:  kafka-log4j
Config_type:  kafka-logsearch-conf
Config_type:  kafka_client_jaas_conf
Config_type:  kafka_jaas_conf
Config_type:  livy2-conf
Config_type:  livy2-env
Config_type:  livy2-log4j-properties
Config_type:  livy2-spark-blacklist
Config_type:  llap-cli-log4j2
Config_type:  llap-daemon-log4j
Config_type:  mapred-env
Config_type:  mapred-logsearch-conf
Config_type:  mapred-site
Config_type:  pig-env
Config_type:  pig-log4j
Config_type:  pig-properties
Config_type:  ranger-admin-site
Config_type:  ranger-env
Config_type:  ranger-hbase-audit
Config_type:  ranger-hbase-plugin-properties
Config_type:  ranger-hbase-policymgr-ssl
Config_type:  ranger-hbase-security
Config_type:  ranger-hdfs-audit
Config_type:  ranger-hdfs-plugin-properties
Config_type:  ranger-hdfs-policymgr-ssl
Config_type:  ranger-hdfs-security
Config_type:  ranger-hive-audit
Config_type:  ranger-hive-plugin-properties
Config_type:  ranger-hive-policymgr-ssl
Config_type:  ranger-hive-security
Config_type:  ranger-kafka-audit
Config_type:  ranger-kafka-plugin-properties
Config_type:  ranger-kafka-policymgr-ssl
Config_type:  ranger-kafka-security
Config_type:  ranger-logsearch-conf
Config_type:  ranger-site
Config_type:  ranger-solr-configuration
Config_type:  ranger-storm-audit
Config_type:  ranger-storm-plugin-properties
Config_type:  ranger-storm-policymgr-ssl
Config_type:  ranger-storm-security
Config_type:  ranger-tagsync-policymgr-ssl
Config_type:  ranger-tagsync-site
Config_type:  ranger-ugsync-site
Config_type:  ranger-yarn-audit
Config_type:  ranger-yarn-plugin-properties
Config_type:  ranger-yarn-policymgr-ssl
Config_type:  ranger-yarn-security
Config_type:  slider-client
Config_type:  slider-env
Config_type:  slider-log4j
Config_type:  spark2-defaults
Config_type:  spark2-env
Config_type:  spark2-hive-site-override
Config_type:  spark2-log4j-properties
Config_type:  spark2-logsearch-conf
Config_type:  spark2-metrics-properties
Config_type:  spark2-thrift-fairscheduler
Config_type:  spark2-thrift-sparkconf
Config_type:  sqoop-atlas-application.properties
Config_type:  sqoop-env
Config_type:  sqoop-site
Config_type:  ssl-client
Config_type:  ssl-server
Config_type:  storm-atlas-application.properties
Config_type:  storm-cluster-log4j
Config_type:  storm-env
Config_type:  storm-logsearch-conf
Config_type:  storm-site
Config_type:  storm-worker-log4j
Config_type:  tagsync-application-properties
Config_type:  tagsync-log4j
Config_type:  tez-env
Config_type:  tez-interactive-site
Config_type:  tez-site
Config_type:  usersync-log4j
Config_type:  usersync-properties
Config_type:  webhcat-env
Config_type:  webhcat-log4j
Config_type:  webhcat-site
Config_type:  yarn-env
Config_type:  yarn-log4j
Config_type:  yarn-logsearch-conf
Config_type:  yarn-site
Config_type:  zeppelin-config
Config_type:  zeppelin-env
Config_type:  zeppelin-log4j-properties
Config_type:  zeppelin-logsearch-conf
Config_type:  zeppelin-shiro-ini
Config_type:  zoo.cfg
Config_type:  zookeeper-env
Config_type:  zookeeper-log4j
Config_type:  zookeeper-logsearch-conf

.

View solution in original post

1 REPLY 1

avatar
Master Mentor

@uri ben-ari

One approach will be to use a Shell Script and make an Ambari API call as following and then grep the config types:

Example: ("/tmp/get_all_config_types.sh" create a file like following)

for CONFIG_TYPE in `curl -s -u admin:admin http://amb25101.example.com:8080/api/v1/clusters/plain_ambari?fields=Clusters/desired_configs | grep '" : {' | grep -v Clusters | grep -v desired_configs | cut -d'"' -f2`; do
   echo "Config_type:  $CONFIG_TYPE"
done

.

Replace the following values in the above script based on your environment:

"amb25101.example.com" with your Ambari Server Hostname
"plain_ambari" with your ambari cluster name
8080 with the port of your ambari server.

Output:

# chmod 755 /tmp/config_types.sh 
# /tmp/config_types.sh 
Config_type:  admin-log4j
Config_type:  admin-properties
Config_type:  ams-env
Config_type:  ams-grafana-env
Config_type:  ams-grafana-ini
Config_type:  ams-hbase-env
Config_type:  ams-hbase-log4j
Config_type:  ams-hbase-policy
Config_type:  ams-hbase-security-site
Config_type:  ams-hbase-site
Config_type:  ams-log4j
Config_type:  ams-logsearch-conf
Config_type:  ams-site
Config_type:  ams-ssl-client
Config_type:  ams-ssl-server
Config_type:  atlas-tagsync-ssl
Config_type:  beeline-log4j2
Config_type:  capacity-scheduler
Config_type:  cluster-env
Config_type:  core-site
Config_type:  hadoop-env
Config_type:  hadoop-metrics2.properties
Config_type:  hadoop-policy
Config_type:  hbase-env
Config_type:  hbase-log4j
Config_type:  hbase-logsearch-conf
Config_type:  hbase-policy
Config_type:  hbase-site
Config_type:  hcat-env
Config_type:  hdfs-log4j
Config_type:  hdfs-logsearch-conf
Config_type:  hdfs-site
Config_type:  hive-atlas-application.properties
Config_type:  hive-env
Config_type:  hive-exec-log4j
Config_type:  hive-exec-log4j2
Config_type:  hive-interactive-env
Config_type:  hive-interactive-site
Config_type:  hive-log4j
Config_type:  hive-log4j2
Config_type:  hive-logsearch-conf
Config_type:  hive-site
Config_type:  hivemetastore-site
Config_type:  hiveserver2-interactive-site
Config_type:  hiveserver2-site
Config_type:  kafka-broker
Config_type:  kafka-env
Config_type:  kafka-log4j
Config_type:  kafka-logsearch-conf
Config_type:  kafka_client_jaas_conf
Config_type:  kafka_jaas_conf
Config_type:  livy2-conf
Config_type:  livy2-env
Config_type:  livy2-log4j-properties
Config_type:  livy2-spark-blacklist
Config_type:  llap-cli-log4j2
Config_type:  llap-daemon-log4j
Config_type:  mapred-env
Config_type:  mapred-logsearch-conf
Config_type:  mapred-site
Config_type:  pig-env
Config_type:  pig-log4j
Config_type:  pig-properties
Config_type:  ranger-admin-site
Config_type:  ranger-env
Config_type:  ranger-hbase-audit
Config_type:  ranger-hbase-plugin-properties
Config_type:  ranger-hbase-policymgr-ssl
Config_type:  ranger-hbase-security
Config_type:  ranger-hdfs-audit
Config_type:  ranger-hdfs-plugin-properties
Config_type:  ranger-hdfs-policymgr-ssl
Config_type:  ranger-hdfs-security
Config_type:  ranger-hive-audit
Config_type:  ranger-hive-plugin-properties
Config_type:  ranger-hive-policymgr-ssl
Config_type:  ranger-hive-security
Config_type:  ranger-kafka-audit
Config_type:  ranger-kafka-plugin-properties
Config_type:  ranger-kafka-policymgr-ssl
Config_type:  ranger-kafka-security
Config_type:  ranger-logsearch-conf
Config_type:  ranger-site
Config_type:  ranger-solr-configuration
Config_type:  ranger-storm-audit
Config_type:  ranger-storm-plugin-properties
Config_type:  ranger-storm-policymgr-ssl
Config_type:  ranger-storm-security
Config_type:  ranger-tagsync-policymgr-ssl
Config_type:  ranger-tagsync-site
Config_type:  ranger-ugsync-site
Config_type:  ranger-yarn-audit
Config_type:  ranger-yarn-plugin-properties
Config_type:  ranger-yarn-policymgr-ssl
Config_type:  ranger-yarn-security
Config_type:  slider-client
Config_type:  slider-env
Config_type:  slider-log4j
Config_type:  spark2-defaults
Config_type:  spark2-env
Config_type:  spark2-hive-site-override
Config_type:  spark2-log4j-properties
Config_type:  spark2-logsearch-conf
Config_type:  spark2-metrics-properties
Config_type:  spark2-thrift-fairscheduler
Config_type:  spark2-thrift-sparkconf
Config_type:  sqoop-atlas-application.properties
Config_type:  sqoop-env
Config_type:  sqoop-site
Config_type:  ssl-client
Config_type:  ssl-server
Config_type:  storm-atlas-application.properties
Config_type:  storm-cluster-log4j
Config_type:  storm-env
Config_type:  storm-logsearch-conf
Config_type:  storm-site
Config_type:  storm-worker-log4j
Config_type:  tagsync-application-properties
Config_type:  tagsync-log4j
Config_type:  tez-env
Config_type:  tez-interactive-site
Config_type:  tez-site
Config_type:  usersync-log4j
Config_type:  usersync-properties
Config_type:  webhcat-env
Config_type:  webhcat-log4j
Config_type:  webhcat-site
Config_type:  yarn-env
Config_type:  yarn-log4j
Config_type:  yarn-logsearch-conf
Config_type:  yarn-site
Config_type:  zeppelin-config
Config_type:  zeppelin-env
Config_type:  zeppelin-log4j-properties
Config_type:  zeppelin-logsearch-conf
Config_type:  zeppelin-shiro-ini
Config_type:  zoo.cfg
Config_type:  zookeeper-env
Config_type:  zookeeper-log4j
Config_type:  zookeeper-logsearch-conf

.