Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Ambari: check status of a component and a service



I'm curious on the status functions implemented for the service ('service_check') and it's component(s).

As seen with HBase service, there's a 'commandScript' defined within 'metainfo.xml' which is referencing to 'scripts/' and is on the same level as '<components>'

On the other hand, on a components' class (subclass of 'Script') you have the

def status(self, env):

I see the 'service_check' is executed upon installation, and I can see the log entries within the Ambari UI, but I haven't seen the log entries anywhere else yet.

So my questions are:

1. When is which function called?

2. Each function uses the 'Logger', where can I find the log lines for both the service_check and the component's status?



Cloudera Employee

hi @David Pocivalnik

Status commands and service checks are 2 different things. A status command is implemented in the status method of the component's class, while a service check is implemented in the file.

Almos all status commands look like as follows:

def status(self, env):
  import status_params

This code checks whether the process is running by simply checking its pid file. Ambari server periodically sends status commands to each (non client) components in order to determine which one of those are currently running and which one is stopped. This is a fairly quick operation. On the other hand a service check is kind of a smoke test, that checks is the component is working properly (for example a HDFS service check tries to create some temp directories under HDFS). You can manually trigger a service check by clicking on Service Actions/Run Service Check.


Hi @amagyar , thanks for your explanations!

My remaining question is, where can I find the log lines that I added to my 'status' method, and the ones within the file ? I assume on the host the service itself is located, but I can't find the file.


Cloudera Employee
@David Pocivalnik

I think those are not visible for some reason. If you add some erroneous code like 1 / 0 to the status method then an exception will show up in the /var/log/ambari-agent/ambari-agent.log but normal log messages are not.


ok, thanks for the info.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.