When your command runs, it will show up in the UI as something like 
"command-123.json". You'll match this up to the "output" file on the agent:
/var/lib/ambari-agent/data/output-123.txt

You're not printing the value of dummy_master_pid_file in your example below; 
you'll want to print that as well to make sure it's rendering properly. Are you 
sure you have the directories correct? You're trying to use zoo/dataDir as the 
placeholder which renders to "/usr/share/zookeeper/tmp". You'll need to make 
sure that your "zoo" config has dataDir set to /usr/share/zookeeper/tmp

On Apr 18, 2016, at 9:44 AM, Souvik Sarkhel 
<souvik.sark...@gmail.com<mailto:souvik.sark...@gmail.com>> wrote:

Hi Jonathan,
Earlier I was using
from resource_management import *
now I have added this import statement also
from resource_management.libraries.functions.format import format
and also given 777 permission till the intended pid file. Still its not working.

Can you please tell me from where can I see the print statements which I 
provide in status function so that I can debug the function.

On Mon, Apr 18, 2016, 18:35 Jonathan Hurley 
<jhur...@hortonworks.com<mailto:jhur...@hortonworks.com>> wrote:
What are your import statements? The "format" function provided by Ambari's 
common library has a naming conflict with a default python function named 
"format". If you don't import the right one, your format("...") command will 
fail silently. Make sure you are importing:

from resource_management.libraries.functions.format import format

On Apr 18, 2016, at 4:27 AM, Souvik Sarkhel 
<souvik.sark...@gmail.com<mailto:souvik.sark...@gmail.com>> wrote:

Hi All,

I have created a custom service for Zookeeper and using Ambari 2.1.0 .In status 
function of master.py if its defined in this way:
def status(self, env):
        config = Script.get_config()
        zkDataDir = config['configurations']['zoo']['dataDir']
        print 'Status of the Zookeeper Master'
        print *****************************************
        print zkDataDir
        dummy_master_pid_file = format("{zkDataDir}/zookeeper_server.pid")
        check_process_status(dummy_master_pid_file)

Ambari is always showing status of application stopped but when I provide the 
constant path of the pid file for example:

dummy_master_pid_file = "/usr/share/zookeeper/tmp/zookeeper_server.pid")

it starts working perfectly and Ambari is able to correctly show the status of 
the application. I need a variable pid file instead of a constant one. I would 
to thankful if someone suggest me a way out.

Thanking you in advance

--
Souvik Sarkhel


Reply via email to