I have an issue regarding validation on Alert action Configuration Page.
I have created app from Splunk AOB with a single alert action. AOB generates all files we required. TA_testing_add_on_rh_settings.py is one of them.
Here, we can validate single input value but I want to validate all values together. below is my code.
and we can add custom validation using UserDefined class.
My questions are:
1) How can we use UserDefined validator?
2) How can we access field values, like(url/username/password), to do custom validations which verify the username/password by login with url?
You can try following 2 options
1. Hack TA_testing_add_on_rh_settings.py. You can update it manually, but it's not recommended unless you dont want to reload it in AoB, otherwise there might be some errors due to inconsistent status.
2. Validate inputs in your Python code. AoB provides a UI to edit your Python codes.
# get some fields
url = helper.settings["server_uri"]
# add your validate code here
if not success:
# write events
helper.addevent("error msg", sourcetype="sample_sourcetype")
helper.writeevents(index="summary", host="localhost", source="localhost")
# if success
helper.log_info("Alert action sdfsdfsd started.")