Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Unable to execute custom ambari alert script.

avatar
New Contributor

@jsensharma 

I followed all the steps but I m not seeing the custom alerts.

I tried executing the script but it is throwing below error: 

 

[root@xxxxx host_scripts]# python test_alert_disk_space.py
Traceback (most recent call last):
File "test_alert_disk_space.py", line 8, in <module>
from resource_management.core.logger import Logger
ImportError: No module named resource_management.core.logger

 

 

Ambari Version 2.7.3.0

HDF: 3.4.1

 
1 ACCEPTED SOLUTION

avatar
Master Mentor

@KaviTiwari 

Please make sure to set the "PYTHONPATH" variable to point to ambari agent lib directory as following:

# export PYTHONPATH=/usr/lib/ambari-agent/lib:$PYTHONPATH
# python test_alert_disk_space.py

 

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@KaviTiwari 

Please make sure to set the "PYTHONPATH" variable to point to ambari agent lib directory as following:

# export PYTHONPATH=/usr/lib/ambari-agent/lib:$PYTHONPATH
# python test_alert_disk_space.py

 

.

avatar
New Contributor

So I have to use export statement while running from console only, correct me if I am wrong.

avatar
Master Mentor

@KaviTiwari 

Correct when we manually want to run such scripts which are dependent on ambari agent python modules then Yes, we will have to manually export PYTHONPATH.
Ambari agent automatically sets the necessary module paths in the python path when it tries to executed such scripts.  

avatar
New Contributor

Thank you very much!

avatar
Contributor

@jsensharma 

 

I have same issue as above, i exported path and script ran fine. I can see alert "

[Custom] Host Mount Point Usage" added in Ambari alerts page but i'm not seeing alerts .I followed all the steps.

 

Screen Shot 2020-04-01 at 7.07.36 PM.png