Please help me configuring a custom health action.
When a particular health policy is violated, i want a single java class file to get executed.
It is a simple program containing its own 'main' method that prints some 'sysout' in the logs.
Expectation is that the java program should be executed and I should be able to view these sysouts in my cluster member logs when health policy is violated .
Please tell me what other settings are needed, apart from those done in the attached screenshot, and whether the mentioned settings are proper.
This topic has been locked.
14 replies Latest Post - 2012-10-04T20:37:59Z by SystemAdmin
Pinned topic Executing a simple java program when health policy is violated
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-10-04T20:37:59Z at 2012-10-04T20:37:59Z by SystemAdmin
vadrian 110000ERNQ2 PostsACCEPTED ANSWER
Re: Executing a simple java program when health policy is violated2011-12-29T14:25:33Z in response to SystemAdminHi Paresh,
What is the problem? Do you see the health policy being triggered?
Is an FFDC generated in the logs/ffdc directory?
Are any messages in the server's "logs" directory on the target machine?
Re: Executing a simple java program when health policy is violated2011-12-30T09:01:14Z in response to vadrianHi Adrian,
What i want to know, is that how do we configure a custom health action.
How do i make a standalone java program or a script get executed when a health policy is violated.
I am sure that health policy is getting violated because they get displayed to me in my "Runtime Tasks" section within "Task Management" panel.
But how do we configure a custom health action using admin console.
What value should i provide for these fields specific to custom health action in WAS admin console
Name of a variable for referencing a user name in executable arguments
The user name to be substituted for the user name variable at invocation time
Name of a variable for referencing a password in executable arguments
The password to be substituted for the password variable at invocation time
I have earlier attached the screenshot of the admin console screen specific to custom health actions, with the above mentioned fields in it.
vadrian 110000ERNQ2 PostsACCEPTED ANSWER
Re: Executing a simple java program when health policy is violated2011-12-30T13:47:18Z in response to SystemAdminHi,
This documentation should be of assistance: http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.ops.doc%2Finfo%2Fodoe_task%2Ftodhealthpolicy.html
One way to use custom actions is to define a simple script which will execute whatever you want; for example, on linux, define a bash script which establishes some context (e.g. switches users), and invokes a wsadmin / jython script, supplying it with the parameters you want. The script's environment will contain variable definitions for the sick server ($server) and node ($node). Additionally, on my linux-based system, I have $USER, which is the user the server is running under, and $WAS_CELL_NAME. If the script needs to run as a different user, then that has to be accomplished from the script -- the custom health definition doesn't provide a way to do that.
The server does not expose any passwords to the script's environment, so authentication/authorization has to be established some other way, e.g. using su from the server's user ID.
Re: Executing a simple java program when health policy is violated2012-05-29T05:36:34Z in response to vadrianHi All,
I have never been able to make use of custom health actions.Although Adrian did try to assist me, but i have not been able to figure it out yet.
Please assist me in executing a script as part of a custom health action.
Whenever i try to get a script invoked as part of custom health action when a health policy is violated, it fails.
I have set the 'Reaction mode' as 'Supervise', and every time it gets triggered, i submit the custom Health action to get executed, but my script never gets executed.
I keep getting Status message as "Failed: WXDH1024E: The attempt to start and complete custom task AlertScript failed.".
Here 'AlertScript' is a dummy script that contains only plain echo statements and should get invoked at the time of policy violation.
The command that it tries to execute (as seen in Runtime Tasks , task specific panel ) is
When i try to manually execute this command manually also, it fails.
The Custom Action 'AlertScript' was created with the following details :
Executable /...../Alert.sh Full path till the script location
Executable arguments None
Name of a variable for referencing a user name in executable arguments FIELD LEFT BLANK
The user name to be substituted for the user name variable at invocation time FIELD LEFT BLANK
Name of a variable for referencing a password in executable arguments FIELD LEFT BLANK
The password to be substituted for the password variable at invocation time FIELD LEFT BLANK
Supported on Operating Systems of type: UNIX
Working directory Path pointing till the parent folder containing the script to be executed
Re: Executing a simple java program when health policy is violated2012-05-29T13:12:54Z in response to SystemAdminParesh, what version of VE are you using? There was an issue with custom tasks that was fixed in VE 7.0. Also, pls make sure that the script is executable and is accessible to the ID used to start the nodeagent/middleware agent. Is this script located on a nodeagent or middleware agent?
Re: Executing a simple java program when health policy is violated2012-05-29T13:28:18Z in response to ambatiHi Ambati,
Thank you for your reply.Please find my response below,
what version of VE are you using
I am using WVE 18.104.22.168 on WAS 22.214.171.124 .
make sure that the script is executable and is accessible to the ID used to start the nodeagent/middleware agent
Yes, the script is executable and is also accessible to the user who is starting the node agent.
In fact, script was created using the same ID which is used to run node agent .Also ,have deliberately provided full permission to the script file.
Is this script located on a nodeagent or middleware agent?
The script is located in the same server machine in which i have the installed WVE environment.
Its path i have provided, while creating the Custom Action while specifying '*Executable*' and '*Working directory*' .
Do i have to place it at a specific location on node agent.
Re: Executing a simple java program when health policy is violated2012-05-29T14:12:16Z in response to SystemAdminSo, if you have a node agent (as opposed to middleware agent...if you installed VE over ND on this machine, it must be a node agent) on the machine where custom task is being executed, then there is a known problem. I am not entirely sure if the problem you are seeing is same as this known problem until I look at the traces from the node agent (com.ibm.ws.xd.agent.*=all:com.ibm.wsspi.xd.agent.*=all).
Re: Executing a simple java program when health policy is violated2012-05-29T14:54:06Z in response to ambatiOh..ok .So something beyond my control could possibly be happening here.Fine Ambati, i will collect the node agent specific trace and share it tomorrow.Please do take a look.
If traces indicate ,a known issue, then probably i will have to apply fix packs to make it work.
Thanks & Regards,
Re: Executing a simple java program when health policy is violated2012-08-03T15:48:52Z in response to SystemAdminHi,
I get the same problem with a dummy program on WAS 8.5 ND this time. Please tell me the bug from VE 7.0 has not been replicated into v8.5....
Did you find a workaround?
Anyone has an idea?
btw I doing tests on RHEL ....
Re: Executing a simple java program when health policy is violated2012-08-06T11:57:39Z in response to SystemAdminI had a look on the nodeagent log file, and I found that:
So it seems WAS is looking for a Environment variable... Anyone has any idea?
8/6/12 7:18:54:359 EDT00000127 CustomActionT I WXDH1022I: Starting the custom task Write 3 on target thinkNode01.
8/6/12 7:18:54:573 EDT00000127 CustomTaskRun E CWXDA0200E: Method CustomTaskRuntimeProcessLauncher.invokeTask: caught exception: java.lang.NullPointerException
8/6/12 7:18:54:575 EDT00000127 ReactionManag E WXDH1024E: The attempt to start and complete custom task Write 3 failed.
Re: Executing a simple java program when health policy is violated2012-08-06T13:46:56Z in response to ambatiThat a great news, thanks. Where did you got this information?
I downloaded all fix for the central fix web page and installed all recommended fixes but the problem is still here... Do you think the fix will be released before the end of October (expected date for the first Fix pack) ?
Re: Executing a simple java program when health policy is violated2012-10-04T20:37:59Z in response to SystemAdminHave you checked out this link?
Looks like for Java actions you have to create a PID environment variable. Not sure this is going to solve all the problems....