anon_uk
Member.
293 views

Rule action to script - Pass rule name

Hi all,

Basically, I have a python script to send notifications showing an example below of how it should be run.

py_script.py h- localhost -p 6666 -m "<esm rulename>" -s

I am not able to see.... on a rule action how I can either -

A) When the script is run to automatically pass the firing rule name in between the  -m "insert here"

or

B) Do I manually need to command to run as the action, instead of just pointing to a script.

 

Thanks

 

Labels (1)
Tags (2)
0 Likes
2 Replies
Highlighted
Honored Contributor.. jorgeoa Honored Contributor..
Honored Contributor..

Re: Rule action to script - Pass rule name

Hello,

In the Execute command action of your rule, use the field "File Name" after -m, it will contain the rule name if you dont aggregate on this field in the rule Aggretation tab.

So, you rule action should be something like this:

  • Command: /full/path/to/py_script.py
  • Argument: -h localhost -p 6666 -m "$fileName" -s

Regards

0 Likes
anon_uk
Member.

Re: Rule action to script - Pass rule name

Brilliant, thank you!

I shall test it

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.