unable to run a python script in alert actions

Hi All,

URGENT...!!!!!

I am trying to run the python script in trigger actions but unable to do so and getting the error execute program failed.

steps i have performed to run the script.

while adding the action i have selected the below highlighted option

then added the path from orion server 

then i tried to execute the script on the target machine and getting below error.

please let me know the solution for the same.

Thanks in Advance

Regards,

Purushottam Rathi

  • So, this could be a number of things.  And I'm not using Python on my server at this time, so these are generalized guesses that could be relevant for ANY programming language, besides maybe PowerShell which has support built in to Windows.

    First, and I hope you have this one right.    Do you have Python installed on your server, and not just your workstation?   Guessing you do, but have to check!!!  And if you have an HA environment please do it on both servers.

    Then, lets assume you do have Python on your server and you're developing your program there.   Remember that your user on the server, even if the Administrator, doesn't usually have the same executable PATH as the user under which these programs will execute.   So, you either have to track down that user and try and modify their path, or be more explicit.   Probably the easiest way is to be very explicit on the command line.  ie: instead of simply giving the path to the script, put both the python executable in and the path to the script.  So, in your case something like this:

        "D:\Program Files\Python\python.exe d:\Maintainance Scripts\Creating Maintenance Window\AUROW_Creation.py"

    Now, lets say you took the approach of making sure the user has Python in its path and you don't want to do that part?   Some OS's prefer to have the first line of the script be something like this

    #! python3

    or maybe

    #! D:\Program Files\Python\python.exe

    You might also have an issue with file permissions.   ie: if the file permissions aren't set so the user that executes the script can see it or execute it, that would be an issue.   I think its something like "chmod +x <filename>" to make it executable?

    HTH!

  • I have python installed on my orion server and while executing the script from server itself i am getting the output as expected but while executing the script from solarwinds i am getting the error as shown. 

    also i have provided all the permissions to file for executing.

  • This is how I execute an external powershell script successfully. The same should work for Python if you get the path correct and you have the correct rights set. I run mine using an AD service account that has the correct user rights. The "'${N=SwisEntity;M=Caption}'" at the end is simply sending in a variable from SolarWinds to Powershell and can be skipped in your case. 

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\deletefromalertaction.ps1 '${N=SwisEntity;M=Caption}'"

  • This is how I execute an external powershell script successfully. The same should work for Python if you get the path correct and you have the correct rights set. I run mine using an AD service account that has the correct user rights. The "'${N=SwisEntity;M=Caption}'" at the end is simply sending in a variable from SolarWinds to Powershell and can be skipped in your case. 

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "C:\scripts\deletefromalertaction.ps1 '${N=SwisEntity;M=Caption}'"