Server Management - Systems Insight Manager
1846576 Members
2128 Online
110256 Solutions
New Discussion

Custom Command Configuration

 
SOLVED
Go to solution
Tim McGue
Regular Advisor

Custom Command Configuration

I am trying to create some custom commands and I am a little confused at the parameters vs. environment variables. I want to pass in the environment variables from the event (i.e. NOTICERAWDATA) but when I am creating the custom command it prompts me to put a value in for that variable. It just isn't making sense to me. Can someone shed some light on this?

Thanks,
Tim McGue
9 REPLIES 9
Jadrice Toussaint
Honored Contributor

Re: Custom Command Configuration

NOTICERAWDATA is already known to SIM and you do not need to include that. For example,

I need to setup a Variable name for my attention server to allow SIM to known about it. so my Variable name would be ATTNSVR and the Value would be SERVERNAME <-- this is tghe real name of the server.

Parameters are use for the program that you are trying to execute. For example: the parameters for cmd.exe is /C

Hope that shed some light for you.
Tim McGue
Regular Advisor

Re: Custom Command Configuration

I'm starting to get it a little more, but I am still confused. Let me give an example. The custom command that I want to run is one to use a paging system that is not available through e-mail or a modem in the system. I have an .exe that I can run that can take parementers. I want to pass to that .exe the parameter of NOTICERAWDATA. How would I perform that? Would I put NOTICERAWDATA on the parameters line or somehow use it in the environment variables lines?

Thanks Again,
Tim
Jadrice Toussaint
Honored Contributor
Solution

Re: Custom Command Configuration

OK.It's really simple. Create a batch file that contains your program with parameters and the SIM NOTICERAWDATA variable. then enter that batch file name in the Commands (Executable path and fike name) field. Once you do that, you do not need to specify any parameters since that is included in your batch file or script nor will you need to specify the Variable name since that is also included in the batch file. below is an example of my batch file that I'm running as a custom command.

c:\winnt\system32\attn.exe -a "communications" " %DEVICENAME% is in a %NOTICESEVERITYSTR% state. %NOTICELABEL%."

notice the SIm Builtin Variables I included them in %% do the same for you batch file.
Tim McGue
Regular Advisor

Re: Custom Command Configuration

Aha,

The light is shining through now. I get it. I'm testing it out now.

Thanks,
Tim McGue
Tim McGue
Regular Advisor

Re: Custom Command Configuration

Jadrice,

I setup the command. I associated it with all events for all systems. I have the batch file placing results to a txt file. I can run the batch file itself.

The problem now is that it never runs from SIM. The task results shows that it runs and is complete each time it should be called, but my batch file is never called.

Are there any other logs I can look at that would point to why this command is not being called?

Tim

Jadrice Toussaint
Honored Contributor

Re: Custom Command Configuration

Tim -

You will need to do some troubleshooting from your batch file perspective. First make sure that you can actually run that batch file from the command line and that it executes corretly. Second, Do some research on the problem that you are using and make sure that an environment variable for that program is necessary for it to work. you can check that by typing pathi n the command prompt. If an environment variable is necessary, you will need to include that in you batch file as well


se my earlier response to you. I had a similar issue and I found out that I was missing the ENV Variable ATTNSERV for the attn.exe program to work look below I pasted the content of one of my batch file that I use for notification through the attention software:

@echo off
SET ATTNSRV=SERVERNAME
REM run attn passing the file as a param
c:\winnt\system32\attn.exe -a "communications" " %DEVICENAME% is in a %NOTICESEVERITYSTR% state. %NOTICELABEL%."

Notice the line that says SET ATTNSRV=SERVERNAME ?
That's the variable I had to pass for the batch file to work properly in IM.

Tim McGue
Regular Advisor

Re: Custom Command Configuration

Thanks again for the information.

Yes, I can run the batch file by itself. It works correctly and produces the results I expect.

I do not need a system variable for the .exe I am running.

The command says it is completed within IM, but I have no proof or evidence of it actually running.

Are there any other logs or anything going on? What does it use for security to run the file on the system level? Do I need to grant specific permissions?

Thanks Again,
Tim
Tim McGue
Regular Advisor

Re: Custom Command Configuration

OK, I tried to eliminate the need for variables all together. I created a new custom task for c:\winnt\notepad.exe. I tried to run it. This time I received a failure (all other said success). Here is what it says:

EXCEPTION CLASS: com.hp.mx.exceptions.MxFailedAuthenticationException
EXCEPTION: Authentication failed.

If I remember right from another post these commands are launched with security through OpenSSH. I only have OpenSSH on the server system, not on any other system.

Do you have any ideas based upon this error?

Tim
Jadrice Toussaint
Honored Contributor

Re: Custom Command Configuration

Tim -

To run custom commands you will need to install openssh on the client or server that's being monitored.