This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Execute external program via Alert?

I was hoping this was fixed in version 9 but I still can't seem to make the Execute External program to work via alerts.

What I am trying to accomplish is to play a sound on a remote system when the alert is tripped. I can get the following command to work from the command line:

f:\psexec -d \\1xx.1xx.1xx.1xx -i c:\progra~1\window~2\mplayer2.exe /play /close c:\tada.wav

and it plays a sound on the remote system.

I then put the exact same string in the Execute External program in the advanced alert and it sends out the email but doesn't kick off the sound.

So I then put the contents into a batch file and pointed the alert to run the batch file. Same thing, no sound.

The alert test "says" it worked ok but didn't. I then thought it might be related to the fact that I was "testing" it so I simulated a device outage - email but no sound.

So in short - has anyone got the execute external program to work? Especially playing a sound on a remote workstation?

  • FormerMember
    0 FormerMember

    Executing external programs is actually working.  It's running the program you requested it to.  It's just that it no longer has the permissions requires to connect to the remote machine and execute that command.

    The alert engine runs under the Local System account.  When an action runs, in runs as this user.  I've never seen a case where Local System was able to access a remote machine like you're wanting it to do.

    There are two options for you.  The first is to modify the SolarWinds Alerting Engine to run under a user that has those permissions.  The other is to use the -p and -u command line options for PSExec to pass the credentials that should be used for running the remote command.

  • THANK YOU! THANK YOU! THANK YOU! THANK YOU!

    Casey, I went the modify the service login to use a service account and it worked! Finally!

    Thanks again!

  • Can someone post some directions for this?  This would be very helpful.

     

    Thanks

  • FormerMember
    0 FormerMember in reply to KFulks

    www.solarwinds.com/.../wwhelp.htm

     

    1. If you are configuring a basic alert to execute an external program, complete the following steps:
    a. Specify a program to execute when the alert is triggered either by typing the complete path and name of the target file into the Program to execute when Alert is Triggered field or by clicking Browse () to browse your folder structure and select the target file.
    b. Specify a program to execute when the alert is reset either by typing the complete path and name of the target file into the Program to execute when Alert is Reset field or by clicking Browse () to browse your folder structure and select the target file.
    2. If you are configuring an advanced alert to execute an external program, complete the following steps:
    a. Click the Execute Program tab.
    b. Specify a program to execute, either by typing the complete path and name of the target file into the Program to execute field or by clicking Browse (), to browse your folder structure and select the target file.
    c. Click the Time of Day tab, and then enter the time period over which you want to execute the external program.
    d. Select the days on which you want to execute the external program.
    e. Click the Alert Escalation tab, and then check any of the following options, as appropriate for your alert:
    To disable the action when the alert has been acknowledged, check Do not execute this Action if the Alert has been Acknowledged.
    To execute the action repeatedly, while the trigger condition exists, check Execute this Action repeatedly while the Alert is Triggered, and then provide an action execution interval.
    To delay alert action execution, check Delay the execution of this Action, and then provide the interval the alert engine should wait.
    3. If you are finished configuring your external program execution action, click OK.
  • Hello

    I'm trying to do the exact thing but I was using the -u -p option and I cant get it to work. 

    The same line is working when I type the string right into a command line but it fails when using the alert.  I even try using a .bat file to no good.

    this is what I use:
    psexec \\computername -u computername\username -p password sndrec32 /play /close c:\orion\notify.wav

    any idee ? should I go with the service account instead or my problem reside somewhere else ?

    thanks

  • The key is to make sure that the 'Solarwinds Alerting Service is using a domain service account. By default it installs as a Local Service login which doesn't work.

    Try to change it then cycle the service. Should work for you.

  • Hi, can I ask for the procedure how to make the Solarwinds Alerting Engine to be a domain service account? Thanks

  • I know this is an old thread, but just in case it helps, I have just spent a day & a half trying to get a PowerShell  script to run from a Solarwinds alert trigger action. Eventually I succeeded. I’m using NPM 10.5.

    I tried calling my script from within a batch file, I tried using the full path to the Powershell exe file. Nothing seemed to work. The alert log in the database annoyingly showed that the program had "executed successfully" – NO IT HADN’T I screamed several  times!

    I did notice that if I entered the path to a non-existent executable, the alert log showed failure. So it was finding the executable (or batch file). It just never ran it.

    Then I saw some successful entries in the DB for Solarwinds APM executables. They all showed a path to the executable relative to the ORION folder and all were .EXE files. So I thought that perhaps there was a limitation on where the executables could be held and/or what types were allowed.

    So how to make it work? This is what I did:

    1. Change the Solarwinds Alerts service so that is runs as a domain user. This was just because my eventual script is calling another node in the domain and this doesn't work when run from the default "local system" account.
    2. Copy the Powershell.exe executable file into the APM home folder on the main solarwinds server:
      e.g. copy C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe
             to      C:\Program Files (x86)\Solarwinds\Orion\APM\Powershell.exe
      A link won’t work, so don’t bother trying. I know that copying this file is not ideal & means that you need to be careful when the executable is updated, but needs must.
    3. Open “Advanced Alert Manager” and edit the alert that you want to run your program.
      Under trigger actions add an Execute Program action and in the “program to execute” put something like this:

                      APM\Powershell.exe –file “C:\Scripts\myProg.ps1”

      Tip: If you want to test the alert, in the “General” tab set the value for “Check alert every” to the minimum value of 15 seconds (otherwise successive tests  seem to wait for this period to expire-which may be several minutes! Another annoying behaviour).
      Save the alert.

       

    Before you can test the alert, you will need a PS script if you don’t already have one. For the example above:
    Create the folders C:\Scripts and C:\Scripts\Logs

    In C:\scripts create the file myProg.ps1 and edit it to contain the following:

    $LogFile="c:\Scripts\Logs\SW.log"

                 $dt=Get-date -format s

                 $me=whoami

                $ScriptName = $MyInvocation.MyCommand.Name

                $dt + "-> Starting script $ScriptName As " + $me + " node "  + $env:ComputerName | out-file $LogFile -append

    Save the file then test trigger your Alert. The logfile in C:\Scripts\Logs should contain something like:

         2013-10-29T19:01:29-> Starting script myProg.ps1 as user DOM\USER node NODE-NAME

    1. J
  • Hi  ">keithjen

    Can you please explain below line in your reply:

    APM\Powershell.exe –file “C:\Scripts\myProg.ps1”  ${NodeName} ----> How Solarwinds know on which host it need to run the script if we used ${NodeName}.  Or do we need to type host name