In NIC switching mode and GS linkage mode, a command pre-defined by a user can be executed at specific timing. For information on execution timing, see "2.7.2 User command execution function". In NIC switching mode, this function can be used to flush an ARP table, change the interface status, and change the MTU length, etc. The following settings must be made to execute a user command. See the sample files for information on creating a script file appropriate for a user's environment.
/etc/opt/FJSVhanet/script/interface/sha. interface.sam (When activating or deactivating an IP address)
/etc/opt/FJSVhanet/script/failover/sha.failover.sam (When detected an error in a transfer route)
/etc/opt/FJSVhanet/script/patrol/sha.patrol.sam (When detected a standby patrol error or recovery)
/etc/opt/FJSVhanet/script/host/node_event.sam
/etc/opt/FJSVhanet/script/system/monitor.sam
The storage destination and file name of a setup file varies depending on the type and name of a virtual interface.
/etc/opt/FJSVhanet/script/interface/shaX (When activating or deactivating an IP address)
/etc/opt/FJSVhanet/script/failover/shaX (When detected an error in a transfer route)
/etc/opt/FJSVhanet/script/patrol/shaX (When detected a standby patrol error or recovery)
* shaX is the created virtual interface name for NIC switching mode.
/etc/opt/FJSVhanet/script/node_event
/etc/opt/FJSVhanet/script/system/monitor
Note
Do not call the operational command for redundancy line control function in the script file.
The commands executed in the script file does not output message to the standard output. When checking for the contents of the outputted message, set the redirect path /dev/console/ and output the message to the console display. For detail, refer to the sample script file.
In a clustered system, the script for NIC switching mode of activating or deactivating IP addresses is executed only by active node. It will not run for standby node.
Create a script file for each virtual interface. If both of IPv4 address and IPv6 address is set to a single virtual interface (or dual stack configuration), define the script file for each address family.
You cannot use the script for the self-checking function to automatically reboot the control daemon of GLS. Reboot the system to recover the control daemon.
The following shows the script file call format and the definition file sample for the operation in NIC switching mode.
(1) When activated or deactivated an IP address
/bin/sh shaX param1 param2 param3 param4
activate: Activated
inactivate: Inactivated
before: Before activation or deactivation
after: After activation or deactivation
ifname: Physical interface name
inet6: Address family (IPv6 only)
* No param4 for IPv4.
[Definition file sample]
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2004 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Params # # $1 activate or inactivate # $2 before or after # $3 physical interface name # $4 address family (IPv6 only) # # # Set Params # #INTERFACE=$3 #IP_ADDR1="xx.xx.xx.xx" #IP_ADDR2="yy.yy.yy.yy" #MAC_ADDR1="xx:xx:xx:xx:xx:xx" #MAC_ADDR2="yy:yy:yy:yy:yy:yy" cace $# in 3) ADDRESS_FAMILY="inet" ;; 4) if [ $4 = "inet6" ] then ADDRESS_FAMILY="inet6" else ADDRESS_FAMILY="unknown" fi ;; *) ADDRESS_FAMILY="unknown" ;; esac if [ $ADDRESS_FAMILY = "inet" ] then case "$1" in 'activate') # # Activate interface # case "$2" in 'before') # # script before activate interface # # echo "execute script before activate interface on" $INTERFACE > /dev/console #if [ ! $INTERFACE = "ethX" ] #then # ifconfig $INTERFACE #else # ifconfig $INTERFACE #fi ;; 'after') # # script after activate interface # # echo "execute script after activate interface on" $INTERFACE > /dev/console #if [ ! $INTERFACE = "ethX" ] #then # arp -d $IP_ADDR1 # ping $IP_ADDR2 2 #else # arp -d $IP_ADDR2 # ping $IP_ADDR1 2 #fi ;; *) ;; esac ;; 'inactivate') # # inactivate interface # case "$2" in 'before') # # script before inactivate interface # # echo "execute script before inactivate interface on" $INTERFACE > /dev/console ;; 'after') # # script after inactivate interface # # echo "execute script after inactivate interface on" $INTERFACE > /dev/console ;; *) ;; esac ;; *) ;; esac fi if [ $ADDRESS_FAMILY = "inet6" ] then case "$1" in 'activate') # # Activate interface # case "$2" in 'before') # # script before activate interface # # echo "execute script before activate interface on" $INTERFACE > /dev/console ;; 'after') # # script after activate interface # # echo "execute script after activate interface on" $INTERFACE > /dev/console ;; *) ;; esac ;; 'inactivate') # # inactivate interface # case "$2" in 'before') # # script before inactivate interface # # echo "execute script before inactivate interface on" $INTERFACE > /dev/console ;; 'after') # # script after inactivate interface # # echo "execute script after inactivate interface on" $INTERFACE > /dev/console ;; *) ;; esac ;; *) ;; esac fi exit 0 |
(2) When detected an error in a transfer route
/bin/sh shaX param1
Primary: Error in a Primary interface
Secondary: Error in a Secondary interface
all: Error in both Primary/Secondary interfaces
retryout: Retry out of the ping command
linkdown: Link-down on an interface
pinghang: Hang-up of the ping command
[Definition file sample]
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2015 # #ident "%W% %G% %U% - FUJITSU" # # Control interface for HA-Net # # # Params # # $1 communication line state primary/secondary/all # $2 event exit code retryout/linkdown/pinghang # # # Set Params # #STATE=$1 #EXIT_CODE=$2 #PROC="process_name" #kill -15 `/bin/ps -e | /bin/sed -n \ # -e'/'$PROC'$/s/[^0-9 \t].*//p' \ # ` > /dev/null 2>/dev/null #if [ $STATE = "primary" ] #then # if [ $EXIT_CODE = "retryout" ] # then # echo "execute script Polling failover : primary retryout" > /dev/console # elif [ $EXIT_CODE = "linkdown" ] # then # echo "execute script Polling failover : primary linkdown" > /dev/console # elif [ $EXIT_CODE = "pinghang" ] # then # echo "execute script Polling failover : primary pinghang" > /dev/console # fi #fi #if [ $STATE = "secondary" ] #then # if [ $EXIT_CODE = "retryout" ] # then # echo "execute script Polling failover : secondary retryout" > /dev/console # elif [ $EXIT_CODE = "linkdown" ] # then # echo "execute script Polling failover : secondary linkdown" > /dev/console # elif [ $EXIT_CODE = "pinghang" ] # then # echo "execute script Polling failover : secondary pinghang" > /dev/console # fi #fi #if [ $STATE = "all" ] #then # if [ $EXIT_CODE = "retryout" ] # then # echo "execute script Polling failover : all retryout" > /dev/console # elif [ $EXIT_CODE = "linkdown" ] # then # echo "execute script Polling failover : all linkdown" > /dev/console # elif [ $EXIT_CODE = "pinghang" ] # then # echo "execute script Polling failover : all pinghang" > /dev/console # fi #fi |
Note
param2 is only enabled when the patch T002839LP-07 or later is applied in RHEL5(Intel64) environment.
(3) When detected a standby patrol error or recovery
/bin/sh shaX param1 param2
establish: Standby patrol established
recover: Standby NIC monitoring recovered
fail: Standby NIC error
Physical interface name of standby NIC: Physical interface name such as ethX
unknown: Standby NIC undecided
[Definition file sample]
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2004 # #ident "%W% %G% %U% - FUJITSU" # # Control interface for HA-Net # # # Params # # $1 standby NIC state establish/recovery/fail # $2 standby NIC name ethX # # # Set Params # #STATE=$1 #NIC=$2 #if [ $STATE = "fail" ] #then # echo "execute script Patrol fail ($NIC)" > /dev/console #fi #if [ $STATE = "establish" ] #then # echo "execute script Patrol establish ($NIC)" > /dev/console #fi #if [ $STATE = "recover" ] #then # echo "execute script Patrol recover ($NIC)" > /dev/console #fi |
The following shows the script file call format and the definition file sample for the operation in GS linkage mode.
/bin/sh node_event
[Definition file sample]
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2005 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Params # # $1 local ip address # $2 remote ip address # $3 event(NODE_DOWN, POLLING_TIMEOUT, or RESOURCE_OFFLINE) # case $# in 3) LOCAL_ADDR=$1 REMOTE_ADDR=$2 EVENT=$3 ;; *) ;; esac case $EVENT in 'NODE_DOWN') # # NODE_DOWN invokes when failover occurs at remote host. # # execution format) node_event 0.0.0.0 remote ip address NODE_DOWN ;; 'POLLING_TIMEOUT') # # POLLING_TIMEOUT invokes when all routes to a virtual ip address # of remote host failed to hold communication for 3 minutes. # # execution format) node_event 0.0.0.0 remote ip address POLLING_TIMEOUT ;; 'RESOURCE_OFFLINE') # # RESOURCE_OFFLINE invokes when a virtual interface changes # its state to inactive over a cluster system. # # execution format) node_event local ip address 0.0.0.0 RESOURCE_OFFLINE ;; *) ;; esac exit 0 |
The following shows the script file call format and the definition file sample for the self-checking function.
/bin/sh monitor param1 param2
driver: GLS driver
daemon: GLS daemon
hungup: A driver or daemon hang detected.
error: A driver or daemon error detected.
process: The abnormal end of the daemon detected.
[Definition file sample]
#!/bin/sh # # All Rights Reserved, Copyright (c) FUJITSU LIMITED 2007 # #ident "%W% %G% %U% - FUJITSU" # # # Control interface for HA-Net # # # Params # # $1 driver ... sha driver # daemon ... hanetctld # $2 hungup ... hanetctld or driver hungup has been detected. # error ... hanetctld or driver i/o error has been detected. # process ... hanetctld process does not exist. # COMPO=$1 ERRKIND=$2 case $COMPO in driver) # # script when a driver error is detected. # ;; daemon) # # script when a daemon error is detected. # ;; esac exit 0 |