7 Replies Latest reply on Feb 18, 2018 2:48 AM by jonr

    Running External Program


      So I made a little script that runs HTTP posts to our Cisco Spark API. I can run it from the command line just fine.


      I just cant seem to get it to run from the alert actions. This is what I put in the path field:


      D:\Scripts\spark.py "Alert"


      Alert is the argument im passing to the python script.


      Any ideas?

        • Re: Running External Program

          are the python env vars configured? Might try doing something like [path to python ]\python d:\scripts\spark.py Alert

          2 of 2 people found this helpful
          • Re: Running External Program

            Maybe check this article for some troubleshooting points...

            Tips for executing external scripts and batch files with alerts - SolarWinds Worldwide, LLC. Help and Support

            One point from the article that stands out to me based on what you have posted is:

            • Run all external batch files and scripts from the C: drive of your Orion server.

            Looks like you are running from "D"... Not sure that is the problem but might be useful to check / try.

            2 of 2 people found this helpful
            • Re: Running External Program

              I am working on the same thing, I will report my progress in the morning.

              • Re: Running External Program

                I will post a thread and put the link in this thread with a how to step by step but this should get you up and running.  The code below I chopped up to give you an idea of how it works, ignore the module and the first uri for rooms.  I use a module and this is old code.  I have a more complex script I use in production which I will share in the thread I post later.  I use markup language and the posts in the spark space look prettier like the screen shots below.  When I get time I will log in to the server and grab an example of the code I use.  Hope this helps.  If anyone has any questions feel free to shoot me a message.


                So first things first.  In order to run the external program you will need the whole path in order to launch the program. This is what I did to get it working:


                I wrote a powershell script that I passed alert variables to in order to post to cisco spark.


                for example:


                In the path you could put:  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\SparkScripts\Node.ps1" "${NodeName}" "${Status}"


                After the path is where I pass the variables.  The variables are arguments for the script.  Each argument is enclosed by quotes.  You can have multiple alert variables in the quotes.


                The script looks something like this.  Again like I said I will post in the forums my actual script and how I did it tomorrow or Monday, but this should help you get started.


                code block


                I use a powershell module, keep in mind that if you load a module, or libraries or if you are going to use powershell to run python that you put everything you need to run your script in the path.


                The output in my spark room for my finalized scripts look like these examples below.






                This one isn't an alert but is a Rest API call using SWQL that posts node health to a spark space.