cancel
Showing results for 
Search instead for 
Did you mean: 

Application script for a simple command

Zahid_Haseeb
Moderator
Moderator
Partner    VIP    Accredited

ENVIRONMENT

SFHA = InfoScale Enterprise 7.0

OS = RHEL 7.0

HA Nodes = 2

QUERY

I want to write a application script/application resource which can trigger below command.

 ip route add 10.95.8.146 via 192.168.2.1 dev eno33559296 src 192.168.2.210

6 REPLIES 6

bhoms
Level 4
Employee

Need more details of the requirement.  

It looks like that you need to create an application resource which will add the static route while ONLINE however, It is not clear why you want to use application resource.

Assuming above statement,  do you need to remove this static route during application resource offline?

You can definitely use application resource for this but we will have to use some mechanism to monitor the resource.

Alternately, You can think of using postonline trigger as well if you just want to add the route. (Assuming here that you do not need to remove the route)

Hope this helps.

Zahid_Haseeb
Moderator
Moderator
Partner    VIP    Accredited

Assuming above statement,  do you need to remove this static route during application resource offline?

NO. no need the functionality to remove the route when offline

(Assuming here that you do not need to remove the route)

I dont want to remove this route but while switchover/failover the route will be removed auto.

Please share some help on postonline trigger

https://sort.veritas.com/documents/doc_details/via/7.0/Linux/ProductGuides/

 

Please check Administration Guide for event Triggers section. You can execute your custom code using event trigger format.

Zahid_Haseeb
Moderator
Moderator
Partner    VIP    Accredited

Very limited information. I am not expert of perl, cant we have a technote of postonlin triggrer to configure simple oneliner code ? My code is a single line. I appriciate if you share a step by step postonline trigger ?

Zahid_Haseeb
Moderator
Moderator
Partner    VIP    Accredited

CONFIGURATION

1- Copy postonline script from /opt/VRTSvcs/bin/sample-trigger to /opt/VRTSvcs/bin/triggers

(if triggers directory is not created, then create it)

2- Enable TriggerEnable attribute from Service Group and add/write POSTONLINE in attribute.

3- edit the postonline script and add below code under # put your code here...


#group = $ARGV[1];
if ($ARGV[1] eq "SERVICEGROUP NAME") {
system("ip route add x.x.x.x via x.x.x.x dev eno33559296 src virtual-ip");

 

NOTE

The trigger will only run when service group go online. If you offline a single resource and online it, then the trigger will not work. So did the below steps to make sure that postonline trigger is working fine.

tail -f /var/VRTSvcs/log/engine.log

hares -offline VIRTUAL-IP(TOP RESOURCE) -sys NODE-NAME
hagrp -online SERVICE-GROUP -sys NODE_NAME

OR

Right click on top resource of service group from java console and offline it and right click on service group and click on online.

You will see the below output under tail -f /var/VRTSvcs/log/engine.log command window


2017/05/06 09:55:11 VCS INFO V-16-6-15002 (NODE-NAME) hatrigger:hatrigger executed /opt/VRTSvcs/bin/triggers/postonline NODE-NAME SERVICEGROUP-NAME successfully

============================================

If anyone knows how to trigger the postonline trigger when a resource become online, please share it.

Apologies for late response. 

Can you please open a case with tech support to have proper followup on this request?