If you want to run a custom script from the PEM alert, go to Management => Manage Alerts => Click on the desired alert => Here you can alter an existing alert or create a new alert you clicking on the plus(+) sign on the right side and that will help you adding a new alert.
You can use the fields in the Script execution box to (optionally) define a script that will be executed if an alert is triggered, and to specify details about the script execution.
1] Set the Executescript slider to Yes to instruct PEM to execute the provided script if an alert is triggered.
2] Set the Execute on alertcleared slider to Yes to instruct PEM to execute the provided script when the situation that triggered the alert has been resolved.
3] Use the radio buttons next to Executescript on to indicate that the script should execute on the PEM Server or the Monitored Server.
4] Provide the script that PEM should execute in the Code field. You can provide a batch/shell script, or SQL code.
For example, If I provide the below in the code section the output will be something as below when the alert is triggered and script will be outputed as :
echo ‘%AlertName%’ >> /tmp/alert.log
For detailed explanation on the parameters the below link can be referred ( Figure 4.41 - The alert editor Notification tab. ) :