Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Server & Application Monitor (SAM) > SAM Custom Template Guide > Linux/Unix scripting in SAM custom templates > Alert Action - Run Linux Script With Putty

Alert Action - Run Linux Script With Putty



Chad Every created this article that 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.

This article is base on Thwack Post



  • NPM 12


  • Change the following Orion services to run as a service account. I just created one called 'orionservice' and then restarted those 3 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.




  • Optional - 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.



  • 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.***


  • You'll replace the <username> and <password> with the actual linux account that you use.
  • 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

  • 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.






Last modified
10:03, 15 Feb 2017


This page has no custom tags.


(not set)