I have been trying to create a custom ambari alert. I have created dedicated alert.json and its correspondent python script.
I have successfully registered the alert function, but my python script is failing here. Is there any specific format which is required in python script. I have created a python script with execute function but still I get the error which says, 'module' object has no attribute 'execute'.
following is the python script,
from subprocess import check_output
def execute(configurations={}, parameters={}, host_name=None):
try:
pid = check_output(["pidof","servicename"])
if pid > 0
return "OK"
except:
return "CRITICAL"
if __name__ == '__main__':
execute()
This is the screenshot of the alert.
Please suggest if you think there is something wrong with this, I have tried making changes in python script, But I keep getting the same error.