Has anyone been able to restart the service if its down?
I created an action to execute an external program that looks something like this
"sc.exe \\${Node.DNS} start ${ApplicationName}" now if it actually type that in a cmd prompt and substitute Node.DNS for the DNS name of the server with the application down, and substitute ApplicationName for the name of the service Im trying to start it works. However it does not seem to be working through Orion.
Is sc.exe in your path? I'm not sure where the script is run from, but you might want to try and use the full path to sc.exe.
I got a reply from support. You currently cannot pass variables to an external program as parameters.
Justin, did support say when the functionality might be added? 8.5 or 8.6?
JustinY: I got a reply from support. You currently cannot pass variables to an external program as parameters.
That's pretty disappointing. I'm also interested in this functionality.
You can pass variables to external programs. This has worked at least since v7. I have done this with sc.exe. Let me know if you need the syntax.
I'm interested in the syntax.
Thanks
I would deffinatly like to know the syntax. If its possible Im supprised that support didnt know about it.
on a similar note...My situation is that I know the application that launches the process and wish to "launch external application" by way of an advanced alert. When I choose, "launch external application", It only seems to like apps located on the polling machine. I can't navigate through the "My Network Places" to find it, and entering a string using the IP doesn't seem to work.
I think I might be having a holiday brain failure, but I welcome any help that might be given.
Any ideas?
I created a folder named AlertActions where I keep my batch files and executables.
Here is the alert action:
"D:\Program Files\SolarWinds\Orion\AlertActions\StartService_YourServiceName.bat" ${NodeName}
The batch file looks like this:
------------------- cut ------------------
sc \\%1 start YourServiceName
--------------- end cut -------------
If you need access to start the service on a remote machine, you need to add the orion server as an admin on the remote server, or create an admin account that you can connect with and add to your batch file like this:
net use \\%1 /user:domain\user password
net use \\%1 /d
Here is an example with an actual service name:
"D:\Program Files\SolarWinds\Orion\AlertActions\StartService_Spooler.bat" ${NodeName}
::Make a connection to the remote Windows computer
net use \\%1 /user:CORP\Orion S0m3W0rd
::Start the Windows print spooler service
sc \\%1 start Spooler
::Clean-up the connection (optional)
If you want to go the net use route, you might want to convert the batch file to VB and then encrypt the file, or use Windows encryption on the batch file.
Hope this helps.
Hey thanks. Thats pretty helpful actually. I tried to use that from the Syslog alert, but it does not support variables like the monitor does. Thats a feature that would be nice.
I was trying to use the Syslog alerts to detect issues on our desktops, and write scripts to automatically correct the problem. The scripts work. If I pass the hostname as a parameter into my script it fixes the problem automatically, but the Syslog alerts just pass ${NodeName} into the script. Bummer
/scratchhead...
Now.. I've created a .bat file on the local machine. Tested it and it works. My problem with SolarWinds persists though. My alarm is set to run the .bat file, but it doesn't seem to trigger. The email comes through, the alarm is 'working'. When I run a test on the alarm, it says it's successful, but the file never actually runs.
Any Ideas as to why SolarWinds might have a problem with running a .bat file?
What is the action you are running? It might have something to do with spaces in the command, or permissions.
In the case the service is determined to be stopped, the actions are to execute a .bat file with the following syntax followed by generating an email.
psservice \\computerip -u logonid -p password start "service name"
When the .bat file is run manually, the service starts.
When the alarm is tested, the test log indicates the file has been run successfully and an email is received, however, the service is not started.
Lastly, if the alarm is tested by way of actual functionality (stopping the service manually while the alarm is set), again, the email is received, yet the service is not started.
I was more interested in the exact text of the Orion action. Does is look something like this?
"D:\Program Files\SolarWinds\Orion\AlertActions\TracertDownNode-ALERT.bat" ${NodeName}
In your case:
"D:\Program Files\SolarWinds\Orion\AlertActions\StartService-ALERT.bat" ${IP_Address}
Are you also passing the service name as a variable or is that hard-coded in your batch file?
Sorry for the delay in getting back to this... holidays plus work always make things interesting. Hope y'all had a safe past few weeks.
As for the problem, it still persists.
In test, I have a .bat file on my local machine that starts a service.When run, it works properly. The batch file is very simple... it just says:net start "service name"
In SolarWinds, I have my alert set up to Email myself and then run the batch file.So far... the email is sent properly, but the batch file doesn't run.This is what the test log says... which indicates success, however, the service still isn't starting.
_____ 1/3/2008 12:36:44 PM: Initiating test for alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Retrieved 2 actions for alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Preparing action type EMail to test alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Email '$(AlertTriggerName}' from '$(AlertTriggerName}' to '"EM19 Process Test" <nobody@nobody.com>' has been successfully handed to the local mail handler for alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Action type EMail for alert EM19 Test Alerts completed successfully.1/3/2008 12:36:44 PM: Completed action type EMail for alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Preparing action type ExecuteProgram to test alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Alert EM19 Test Alerts: Success - "\\computername\availablesharedfolder\Test.bat"1/3/2008 12:36:44 PM: Action type ExecuteProgram for alert EM19 Test Alerts completed successfully.1/3/2008 12:36:44 PM: Completed action type ExecuteProgram for alert EM19 Test Alerts.1/3/2008 12:36:44 PM: Completed test for alert EM19 Test Alerts._____
Per usual, I appreciate any advice
The bat file is being executed in the security context of service. In this case it's the local system account. The local system account does not have sufficient privileges to access the remote computer \\computername. The reason this is working when you run the bat file is because your account has the privileges necessary to access the BAT file on the remote share.
This being the case, any suggestions on how to enter credentials to allow this to work?
I would recommend you look into the "runas" command.
I don't quite follow. The alert action is supposed to execute a batch file located on a remote system that starts a service on the Orion server? The syntax NET START only works on the computer running the command. If you want to start a service on a remote computer you will need SC.exe or PSSERVICE.exe.