DX Application Performance Management

Expand all | Collapse all

Shell command for Introscope alert

  • 1.  Shell command for Introscope alert

    Posted Apr 02, 2013 07:22 PM
    Hello, I am having trouble getting a shell command from Introscope to work properly. I can run the bat file from the command line but it is unsuccessful when invoked by the EM.

    I basically have a bat file setup to run PSEXEC to run a command on another server (windows) and send the output to a file.

    This works from the command line but when invoke it from Introscope it creates the output file with no data so seems to work in part.

    I have specified fully qualified paths etc..

    Any ideas? I have also tried supplying credentials to the PSEXEC command and no luck and also no real error message to give me a clue.

    Thanks in advance.


  • 2.  RE: Shell command for Introscope alert

    Broadcom Employee
    Posted Apr 03, 2013 09:42 AM
    Are you using the fully qualified path to your batch file in your alert action?


  • 3.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 12:08 PM

    hdavis wrote:

    Are you using the fully qualified path to your batch file in your alert action?
    Yes. The shell alert points to d:\PSTools\mycommand.bat

    The bat file contains:

    d:\pstools\PSEXEC \\someserver netstat -an|find "4444" > d:\pstools\myoutput.txt

    The file must be executing because it does generate myoutput.txt (but it is empty)

    Running the same command from the command line generates the desired output.

    Thanks,

    John


  • 4.  RE: Shell command for Introscope alert

    Broadcom Employee
    Posted Apr 03, 2013 12:46 PM
    What is the event message in IntroscopeEnterpriseManager.log when the alert action is called?


  • 5.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 12:50 PM

    hdavis wrote:

    What is the event message in IntroscopeEnterpriseManager.log when the alert action is called?
    4/03/13 12:34:04 PM EDT [ERROR] [Manager.Action] Action "Test Shell" failed to execute shell command "d:\pstools\mytestcmd.bat" with bad process exit value "1"


  • 6.  RE: Shell command for Introscope alert

    Broadcom Employee
    Posted Apr 03, 2013 12:52 PM
    Try escaping the backslash by doubling them "\\" or use the forwardslash "/".


  • 7.  RE: Shell command for Introscope alert

    Broadcom Employee
    Posted Apr 03, 2013 12:57 PM
    You'll probably need to have the action execute cmd.exe before the batch file.
    c:\windows\system32\cmd.exe /C "d:\pstools\mytestcmd.bat"


  • 8.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 01:21 PM

    hdavis wrote:

    You'll probably need to have the action execute cmd.exe before the batch file.
    c:\windows\system32\cmd.exe /C "d:\pstools\mytestcmd.bat"
    Using the cmd first does not work.

    INFO | jvm 1 | 2013/04/03 13:15:51 | 4/03/13 01:15:51 PM EDT [ERROR] [Manager.Action] Action "Test Shell" failed to execute shell command "c:\windows\system32\cmd.exe /C d:\pstools\mytestcmd.bat"

    I also tried with surrounding the bat file command in quotes as you original put.

    Not sure if escaping the backslashes will work since they are specific to the PSEXEC command and this bat file work when run outside of introscope.


  • 9.  RE: Shell command for Introscope alert

    Broadcom Employee
    Posted Apr 03, 2013 01:38 PM
    Sorry I wasn't clear. Try escaping the backslashes in the alert action.

    You can also do the same test from the server by opening a command prompt and running the same alert action command.


  • 10.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 01:55 PM

    hdavis wrote:

    Sorry I wasn't clear. Try escaping the backslashes in the alert action.

    You can also do the same test from the server by opening a command prompt and running the same alert action command.
    Tried escaping with both forward and backward slashes and it does not work. Not sure how to run the shell test from the commandline.

    Just another FYI.

    If I have a bat file that just contains the following..

    echo %1 > output.txt

    This will work and send the alert text to the file.

    So, it is definitely executing the bat file but having some issues with it.


  • 11.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 02:24 PM
    Looks like this may be somee permissions issue on the remote server but not clear what creds are being used. Just show one server connecting to another.

    Would you happen to know which user the Introscope process runs as?

    I tried using my credentials within the bat file (which is an option) but that did not help even though I have rights on both compter and can run the same command outside of Introscope.


  • 12.  RE: Shell command for Introscope alert
    Best Answer

    Broadcom Employee
    Posted Apr 03, 2013 02:42 PM
    You gave me a couple of ideas.

    [list][*]Ensure you provide a user and password for the EM Service in services.msc
    [*]Ensure your EM service account has read and execute permissions on d:\pstools.[list]

    to test the execution:

    [list][*]Open a command prompt
    [*]execute the same alert action
    c:\windows\system32\cmd.exe /C d:\pstools\mybat
    [list]


  • 13.  RE: Shell command for Introscope alert

    Posted Apr 03, 2013 03:05 PM

    hdavis wrote:

    You gave me a couple of ideas.

    [list][*]Ensure you provide a user and password for the EM Service in services.msc
    [*]Ensure your EM service account has read and execute permissions on d:\pstools.[list]

    to test the execution:

    [list][*]Open a command prompt
    [*]execute the same alert action
    c:\windows\system32\cmd.exe /C d:\pstools\mybat
    [list]
    Thanks. Looks like that may be a solutions as I am getting better results. My process seems to be hanging on the remote computer though but will figure it out.

    Also, no need to execute cmd.exe first.

    Thanks again.