Support Questions

Find answers, ask questions, and share your expertise

Custom service check process status failed(show red icon) on ambari 2.2.1 and HDP 2.4

avatar
New Contributor

I refer to Defining a Custom Stack and Services. (https://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Stack+and+Services)

My custom service directory structure is as follows:

SAMPLESRV/
├── configuration
│   └── test-config.xml
├── metainfo.xml
└── package
    ├── archive.zip
    └── scripts
        ├── master.py
        ├── sample_client.py
        └── slave.py

When I add check_process_status method in master.py and restart ambari server, the service status will show red icon. But the service is running. add-check-process-status.png add-check-process-status2.png

  def status(self, env):
    print 'Status of the Sample Srv Master';
    my_test_pid = "/var/run/mytest/mytest_server.pid"
    check_process_status(my_test_pid)

When I comment check_process_status method in master.py and restart ambari server, the service status will show green icon.

Do I miss something?

About my source code of custom service , please refer to attachment file my-custom-service.tar.gz

Thanks.

1 ACCEPTED SOLUTION

avatar
Super Collaborator

Hi @Ian Li,

I was able to get this to stop and start by adding these lines in the master.py and slave.py

I added a dummy PID, Since we have not installed a real service, there is no PID file created by it.Therefore we are going to artificially create the PID,remove the PIDand check the process status of the dummy pid.

screen-shot-2016-07-06-at-20304-pm.png

screen-shot-2016-07-06-at-20322-pm.png

screen-shot-2016-07-06-at-20340-pm.png

Hope this helps. Let me know in case of any other issues.

Thanks,

Sujitha

View solution in original post

5 REPLIES 5

avatar
Super Collaborator

Hi @Ian Li,

I followed the steps from https://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Stack+and+Services,

I was able to launch the service and it shows green . Please find the attached.

My assumption is within the documentation I see the steps for applicable for HDP 2.0.6 -> 2.1.

Can you try the steps in

/var/lib/ambari-server/resources/stacks/HDP/2.4/services

new-sample-service.png

screenshot1.png

Hope that helps. Let me know in case of issues.

Thanks,

Sujitha

avatar
New Contributor

Hi @sujitha sanku,

Thank you for the information.

I use Hortonworks Sandbox HDP 2.4 and try the steps in "/var/lib/ambari-server/resources/stacks/HDP/2.4/services"

The service status shows green. When I stop service, it will show red a while and turn green. It doesn't make sense.

After I add check_process_status(my_test_pid) in status method, the service status show red.

I have already refer to some information. For example: How to deploy Zeppelin(http://hortonworks.com/apache/zeppelin/#section_3) and Jupyter(https://github.com/randerzander/jupyter-service) on ambari

But I still don't know why the check_process_status doesn't work.

Thanks.

avatar
Super Collaborator

Hi @Ian Li,

I was able to get this to stop and start by adding these lines in the master.py and slave.py

I added a dummy PID, Since we have not installed a real service, there is no PID file created by it.Therefore we are going to artificially create the PID,remove the PIDand check the process status of the dummy pid.

screen-shot-2016-07-06-at-20304-pm.png

screen-shot-2016-07-06-at-20322-pm.png

screen-shot-2016-07-06-at-20340-pm.png

Hope this helps. Let me know in case of any other issues.

Thanks,

Sujitha

avatar
Super Collaborator

Hi @Ian Li,

If this issue was resolved can you pick the best answer and we can think this as resolved.

Thanks,

Sujitha

avatar
New Contributor

Hi @sujitha sanku,

It's working.

Thank you again for everything you have done!

Thanks.