Version 6


    This article shows how you can execute scripts against a linux server as an alert action. The scripts can be customized however you'd prefer them to function. This example will show how to do a simple service/daemon restart for Apache. There are some prerequisites that need to happen first beforehand. If you've already done those then skip down to the Orion Configuration part.




    • Change the following Orion service (SolarWinds Orion Module Engine) to run as a service account. I just created an AD account called 'orionservice' and then restarted that services once that change was made. The service account needs to be a local admin to the Orion server.



    • Install putty on your Orion server. Make sure you download the Windows Installer version. Once installed, log into your Orion server with the service account that you created. Open putty and connect to the linux server in question. You have to manually accept the SSH key to the host since those accepted keys are stored on a per user basis (In this case, the service account). Putty does not allow a SSH key to be automatically accepted via the command line. You only have to do this once per linux server. There are other ssh utilities that do allow SSH keys to be accepted automagically via the CLI, but this article will focus on Putty.




    • Add the install location for Putty into your environment variables. This help when creating the alert action since it can call just putty.exe instead of using the full Windows path to it.





    Orion Configuration

    1. In the Alert Trigger Condition you'll add the action: Execute an External Program.


               Here is the full line in the 'Network path to external program'. I'm using an Orion variable, ${N=SwisEntity;M=Application.Node.IP_Address}, which allows the action to be dynamic.

         putty.exe -l <username> -pw <password> -m C:\SolarWindsScripts\Linux\ ${N=SwisEntity;M=Application.Node.IP_Address}


              ***Security Note: Putty also allows you to specify a key file with -i instead of using a password which is more secure.***


    2. You'll replace the <username> and <password> with the actual linux account that you use.


    3. On your Orion server create a folder in a location that your service account has access too. I created mine at C:\SolarWindsScripts\Linux\. In that folder you can place your scripts, this example just has a basic sh script called

         Example of file

         /etc/init.d/httpd restart

         exit 0

    4. Save Changes to that action and test. You can also test this by running the full command in step 1 in command prompt or powershell. Just replace the Orion variable at the end of the actual IP of the linux server.


    From here you can write scripts to accomplish just about anything and improve any automation rolls. This gives SAM the ability to 'self heal' an application before anyone has to be involved in troubleshooting.


    If this article was helpful, please feel free to rate it.