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/service_check.py' 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?
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 service_check.py file.
Almos all status commands look like as follows:
def status(self, env): import status_params env.set_params(status_params) check_process_status(status_params.zk_pid_file)
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 service_check.py file ? I assume on the host the service itself is located, but I can't find the file.
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.