The article shows the example of creating own Veritas agent
1. Create agent files
2. Add Veritas types
/opt/VRTSvcs/bin/hatype -add NetracRouting
/opt/VRTSvcs/bin/hatype -modify NetracRouting SourceFile "./NetracTypes.cf"
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentDirectory "/opt/VRTSagents/ha/bin/NetracRouting"
/opt/VRTSvcs/bin/hatype -modify NetracRouting OnlineRetryLimit 1
/opt/VRTSvcs/bin/hatype -modify NetracRouting RestartLimit 3
/opt/VRTSvcs/bin/hatype -modify NetracRouting ArgList RoutingScript RoutingFile RoutingGw RoutingSrc RoutingScriptDelete
/opt/VRTSvcs/bin/haattr -add NetracRouting RoutingScript -string
/opt/VRTSvcs/bin/haattr -add NetracRouting RoutingFile -string
/opt/VRTSvcs/bin/haattr -add NetracRouting RoutingGw -string
/opt/VRTSvcs/bin/haattr -add NetracRouting RoutingSrc -string
/opt/VRTSvcs/bin/haattr -add NetracRouting RoutingScriptDelete -string
/opt/VRTSvcs/bin/hatype -modify NetracRouting AttrChangedTimeout 60cat
/opt/VRTSvcs/bin/hatype -modify NetracRouting CloseTimeout 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting CleanRetryLimit 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting CleanTimeout 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting ConfInterval 600
/opt/VRTSvcs/bin/hatype -modify NetracRouting MonitorInterval 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting MonitorTimeout 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting LevelTwoMonitorFreq 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting NumThreads 10
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentPriority 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentClass TS
/opt/VRTSvcs/bin/hatype -modify NetracRouting ScriptPriority 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting ScriptClass TS
/opt/VRTSvcs/bin/hatype -modify NetracRouting LogFileSize 33554432
/opt/VRTSvcs/bin/hatype -modify NetracRouting OfflineMonitorInterval 300
/opt/VRTSvcs/bin/hatype -modify NetracRouting OfflineTimeout 300
/opt/VRTSvcs/bin/hatype -modify NetracRouting OfflineWaitLimit 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting OnlineTimeout 300
/opt/VRTSvcs/bin/hatype -modify NetracRouting OnlineWaitLimit 2
/opt/VRTSvcs/bin/hatype -modify NetracRouting OpenTimeout 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting ToleranceLimit 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentStartTimeout 60
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentReplyTimeout 130
/opt/VRTSvcs/bin/hatype -modify NetracRouting Operations OnOff
/opt/VRTSvcs/bin/hatype -modify NetracRouting FaultOnMonitorTimeouts 4
/opt/VRTSvcs/bin/hatype -modify NetracRouting AlertOnMonitorTimeouts 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting InfoInterval 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting InfoTimeout 30
/opt/VRTSvcs/bin/hatype -modify NetracRouting SupportedActions -delete -keys
/opt/VRTSvcs/bin/hatype -modify NetracRouting ActionTimeout 30
/opt/VRTSvcs/bin/hatype -modify NetracRouting AgentFile ""
/opt/VRTSvcs/bin/hatype -modify NetracRouting FireDrill 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting FaultPropagation 1
/opt/VRTSvcs/bin/hatype -modify NetracRouting ExternalStateChange -delete -keys
/opt/VRTSvcs/bin/hatype -modify NetracRouting TypeOwner ""
/opt/VRTSvcs/bin/hatype -modify NetracRouting TypeRecipients -delete -keys
/opt/VRTSvcs/bin/haattr -default NetracRouting ResContainerInfo Type "" Name "" Enabled ""
/opt/VRTSvcs/bin/haattr -default NetracRouting AutoStart 1
/opt/VRTSvcs/bin/haattr -default NetracRouting Critical 0
/opt/VRTSvcs/bin/haattr -default NetracRouting TriggerResRestart 0
/opt/VRTSvcs/bin/haattr -default NetracRouting TriggerResStateChange 0
/opt/VRTSvcs/bin/haattr -default NetracRouting TriggerEvent 0
/opt/VRTSvcs/bin/haattr -default NetracRouting ResourceOwner ""
/opt/VRTSvcs/bin/haattr -default NetracRouting TriggerPath ""
/opt/VRTSvcs/bin/haattr -default NetracRouting ResourceRecipients "" ""
/opt/VRTSvcs/bin/hatype -modify NetracRouting MonitorStatsParam Frequency 0 ExpectedValue 100 ValueThreshold 100 AvgThreshold 40
/opt/VRTSvcs/bin/hatype -modify NetracRouting ContainerOpts -delete -keys
/opt/VRTSvcs/bin/hatype -modify NetracRouting LogDbg -delete -keys
/opt/VRTSvcs/bin/hatype -modify NetracRouting AdvDbg -delete -keys
/opt/VRTSvcs/bin/haattr -default NetracRouting ComputeStats 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting AEPTimeout 0
/opt/VRTSvcs/bin/hatype -modify NetracRouting EPPriority "%-1"
/opt/VRTSvcs/bin/hatype -modify NetracRouting EPClass "%-1"
/opt/VRTSvcs/bin/hatype -modify NetracRouting OnlinePriority "%-1"
/opt/VRTSvcs/bin/hatype -modify NetracRouting OnlineClass "%-1"
/opt/VRTSvcs/bin/hatype -modify NetracRouting SupportedOperations -delete -keys
3. Create resource of new type.
#------------------------------------------------------------------------------#
#
# File: online
# Author: Alex Grudev
# Last Update: 08-Jan-2016
#
# Description:
# VCS Netrac Routing Resource Type online Entry Point
# This script adds routing.
#
#------------------------------------------------------------------------------#
VCS_HOME=/opt/VRTSagents/ha/
RoutingScript=$2
RoutingFile=$3
RoutingGw=$4
RoutingSrc=$5
if [ ! -f ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh ]
then
echo "Agent $0: cannot open ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh"
exit 1
fi
# load global definitions
. ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh
${RoutingScript} ${RoutingFile} ${RoutingGw} ${RoutingSrc}
exit $?
#------------------------------------------------------------------------------#
#
# File: offline
# Author: Alex Grudev
# Last Update: 08-Jan-2016
#
# Description:
# VCS Netrac routing Resource Type online Entry Point
# This script offlines routing agent.
#
#------------------------------------------------------------------------------#
VCS_HOME=/opt/VRTSagents/ha/
RoutingScript=$2
RoutingFile=$3
RoutingGw=$4
RoutingSrc=$5
RoutingScriptDelete=$6
if [ ! -f ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh ]
then
echo "Agent $0: cannot open ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh"
exit 1
fi
# load global definitions
. ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh
${RoutingScriptDelete} ${RoutingFile} ${RoutingGw} ${RoutingSrc}
exit $?
#------------------------------------------------------------------------------#
#
# File: clean
# Author: Alex Grudev
# Last Update: 08-Jan-2016
#
# Description:
# VCS Netrac routing Resource Type clean Entry Point
# This script cleans an routing Agent.
#
#------------------------------------------------------------------------------#
VCS_HOME=/opt/VRTSagents/ha/
TMPFILE=/tmp/routingclean
RoutingGw=$4
RoutingSrc=$5
if [ ! -f ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh ]
then
echo "Agent $0: cannot open ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh"
exit 1
fi
# load global definitions
. ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh
\rm -rf ${TMPFILE}
/sbin/ip ro sh | grep ${RoutingGw} | grep src | awk '{print $1}'>${TMPFILE}
for IP in `cat ${TMPFILE}`; do
/sbin/ip route delete ${IP} via ${RoutingGw} src ${RoutingSrc}
done
ROUTING_ENTRIES=`/sbin/ip route show | grep ${RoutingGw} | grep src | wc -l`
if [ ${ROUTING_ENTRIES} -gt 0 ];then
exit $ERROR
else
exit $OK
fi
exit $?
#------------------------------------------------------------------------------#
#
# File: monitor
# Author: Alex Grudev
# Last Update: 08-Jan-2016
#
# Description:
# VCS Netrac routing Resource Type monitor Entry Point
#------------------------------------------------------------------------------#
VCS_HOME=/opt/VRTSagents/ha/
RoutingGw=$4
if [ ! -f ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh ]
then
echo "Agent $0: cannot open ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh"
exit 1
fi
# load global definitions
. ${VCS_HOME}/bin/Netrac/vcs_netrac_include.sh
ROUTING_ENTRIES=`/sbin/ip route show | grep ${RoutingGw} | grep src | wc -l`
if [ ${ROUTING_ENTRIES} -eq 0 ]
then
exit $OFFLINE
fi