Hi,
There are two scenarios.
1.
Adding a new service which is already in stack like NAGIOS,ZOOKEEPER,...etc.
2.
adding a new service which is not defined before into stack.
===========================================
For scenario 1 , I try to add NAGIOS into cluster by api , and the
following is the commands:
curl -u admin:admin -i -X POST -d '{"ServiceInfo":
{"service_name":"NAGIOS"}}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services
curl -u admin:admin -i -X POST
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/NAGIOS/components/NAGIOS_SERVER
curl -u admin:admin -i -X POST -d '{"type": "nagios", "tag": "v1",
"properties" : { "nagios_web_password" : "admin","nagios_contact" :
"[email protected]","nagios_group" : "nagios","nagios_web_login" :
"nagiosadmin","nagios_user" : "nagios"}}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/configurations
curl -u admin:admin -i -X PUT -d '{"config": {"nagios": "v1" }}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/NAGIOS
curl -u admin:admin -i -X POST -d '{"host_components" :
[{"HostRoles":{"component_name":"NAGIOS_SERVER"}}]}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/hosts?Hosts/host_name=ambariserver.ambari
curl -u admin:admin -i -X PUT -d '{"ServiceInfo": {"state" : "INSTALLED"}}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/NAGIOS
curl -u admin:admin -i -X PUT -d '{"ServiceInfo": {"state" : "STARTED"}}'
http://10.1.191.20:8080/api/v1/clusters/ambari5f/services/NAGIOS
After these steps , NAGIOS service is installed and started , but the web
page Services -> Nagios -> Configs is empty.
If I install NAGIOS by install wizard , this page will contain some
information like "Nagios Admin password".
I also try to install other services like ZOOKEEPER , the config page may
have some information but not complete.
==============================================
For Scenario 2 , I think I found the root cause.
After creating the new service directory with its metainfo.xml , you have
to restart the ambari-server service by execute "ambari-server restart".
After I restart the service , I can add the service into Cluster.
Best Regards