- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Unable to execute custom ambari alert script.
- Labels:
-
Apache Ambari
Created on
‎11-20-2019
12:40 PM
- last edited on
‎11-20-2019
10:26 PM
by
VidyaSargur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎11-20-2019 01:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
.
Created ‎11-20-2019 01:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
.
Created ‎11-20-2019 02:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I have to use export statement while running from console only, correct me if I am wrong.
Created ‎11-20-2019 02:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎11-21-2019 07:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much!
Created on ‎04-01-2020 06:43 AM - edited ‎04-01-2020 06:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
