cancel
Showing results for 
Search instead for 
Did you mean: 

Help me to create agents correctly

vcfko
Level 2

Hi guys
I am a newbie.

I don't understand how to create agent correctly.

I need to manage some application but as example I tried to implement the following exercise: Creating a file like as "FileOnOFF"


I created a new type

type FILE_CREATION (
        static str ArgList[] = { PathName }
        str PathName
)



then with Veritas Operation Manager

I created the resource group related the new type
so that in main.cf I have

 FILE_CREATION create_file01 (
                PathName = "/opt/my_tmp/file1"
                )



then I copy ScriptAgent into /opt/VRTSvcs/bin/FILE_CREATION/FILE_CREATIONAgent

(I have renamed ScripAgent file in FILE_CREATIONAgent and I put it in a /opt/VRTSvcs/bin/FILE_CREATION/ folder)


Then
I have create the following files :  online; offline;  monitor;

and I put them under the following folder:
/opt/VRTSvcs/bin/FILE_CREATION/   
 online

#!/bin/sh
RESNAME=$1
PATHNAME=$2
touch $PATHNAME
touch /opt/my_tmp/file2
exit 0



offline

#!/bin/sh
RESNAME=$1
PATHNAME=$2
/bin/rm -rf $PATHNAME
exit 0


monitor

#!/bin/sh
RESNAME=$1
PATHNAME=$2
if [ -f $PATHNAME ]; then exit 110;
else exit 100;
fi




After that when I try to put online my resource the following error message appears:

 Operation failed

Command(s):
Cluster cluster1:
hares -online create_file01 -sys hostname
VCS WARNING V-16-1-10268 Agent FILE_CREATION for resource create_file01 failed on system hostname.

 

Could you help me to undersatnd what's wrong?

10 REPLIES 10

mikebounds
Level 6
Partner Accredited

Do you need to create an agent - can you use the Application agent for your application.  This is the best option, unless your application is complicated and the Application agent is not appropiate.  See the VCS Bundled Agents guide for details.  If your application is too complex for the Application agent I would then have a look at the Application Agent builder (go to https://sort.symantec.com/agents and choose "Application Agent builder" from "Application:" pull down list).  Writing your own agent is usually the last resort.

Mike

vcfko
Level 2

Thanks mikebounds

The example I posted before is to understand how vcs works


My scope is to start and stop an application

so that
I create a resorce called my_app and type Application

with the following attribute:

attribute                                attribute value

StartProgram                 /home/user1/bin/AppStart
StopProgram                 /home/user1/bin/AppStop
MonitorProgram             /home/user1/bin/AppReport
user                              user1

(where AppStart; AppStop; AppReport are command)

 


but I have the following problem:

"Some resources in this group are in the UNKNOWN state"

mikebounds
Level 6
Partner Accredited

If resources are in UNKNOWN state then this means VCS is not getting exit codes 100 or 110 from monitor program - this could be because it can't find file or it is not executable or the program is not working so is exiting early with other exit codes.

Also note that your online and stop programs MUST exit with exit code 0.

What version of VCS are you using?

Mike

vcfko
Level 2

VCS 5.1 SP1 on REDHAT 5.6

My online and stop programs      under /opt/VRTSvcs/bin/Application   

exit with exit code 0.

 

What can I check ?

 

 

TonyGriffiths
Level 6
Employee Accredited Certified

Hi

For your original issue, it could be due to the agent folder scripts not being on all nodes in the cluster.

 

For the Application specfic issue, it does sound like VCS is not getting the correct return codes from the scripts to indicate that the resource is online. The MonitorProgram will need to return 100 or 0 for offline and 110 or 1 for online. This will be in the bundled agents guide

cheers

tony

TonyGriffiths
Level 6
Employee Accredited Certified

FYI Link to 6.0/Solaris Bundled agent guide

 

https://sort.symantec.com/public/documents/sfha/6.0/solaris/productguides/html/vcs_bundled_agents/ch05s03.htm

mikebounds
Level 6
Partner Accredited

5.1SP1 has an attribute "UseSUDash" which by default is 0.  Probably you need to set this to 1 so that the environment is set for user "user1".  If your script is not been run with the right environment variable being set the script maybe exiting with an error.

Mike

Satish_K__Pagar
Level 5
Employee

Verify that the agent is running on all the cluster nodes. You can do it by executing "ps -ef | grep FILE_CREATION" on all cluster nodes. Did you start the agent using the "haagent -start .... " command. Make sure the agent is running on all cluster nodes.

Eric_Gao
Level 4

Assume you had followed the agent build guide, I cannot see anything wrong with your agent.

 

The symtom is simple, just the online operation failed, but again it might be caused by the monitor operation not being able to return online/offline state to had daemon.

 

I suggested

1. verify the agent is running ok on all nodes,   restart the agent with haagent command to make sure your agent is responding properly

2. delete the tmp file /opt/my_tmp/file1 first,   then online the resource, at this point the same thing might happen again that operation fails.

check if the tmp file has been created,  if it is created already, the online operation most probably has already finished, but monitor fails to determine the online/offline state.

 

Also could you please provide more log info, before and after "VCS WARNING V-16-1-10268 Agent FILE_CREATION for resource create_file01 failed on system hostname"

this might help a bit.

 

Regards,

Eric

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

Have you alreadychecked permission of /opt/VRTSvcs/bin/FILE_CREATION/FILE_CREATIONAgent?
It should be set as 0744.