Forum Discussion

Glenn_32974's avatar
Glenn_32974
Icon for Nimbostratus rankNimbostratus
Aug 09, 2012

GTM and bash script!

Hello Folks!

 

 

This is my scenario

 

 

1 Data Center acting as Main DC (GTM here)

 

1 Data Center used for DR only (GTM here)

 

 

Global Availability as the LB method

 

 

What I need:

 

 

I need to execute a bash script from my GTM as soon as I fail-over to the DR site so I can tell my linux Box to perform certain action when resolutions start flowing to the DR site

 

 

Im not sure if using an Irule you can tell GTM to execute a bash script ( this script is supposed to call another script in my linux box to start off a process!)

 

 

Would this be possible? I've never done it before

 

 

Thansk for any suggestions guys!!

 

3 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Hmm... I can think of a couple of possibilities... The cleanest would probably to use the alerting mechanism to run a script on going active that ssh's to the linux box and does what you need....

     

     

    H
  • Thansk for your response Hamish!!

     

     

    When you mention the "alerting" mechanism, you are talking about creating a custom entry in the /config/user_alert.conf file?

     

     

    If so... I can only think about creating a Trap for when the system receives a query for DNS resolution! However... What would be the OID for this event ?

     

     

    Im a bit confused on how to set it up!

     

     

    Can you suggest further?

     

     

    Thanks in advanced!
  • Hi Glenn,

     

     

    You could also create a simple a bash script that monitors the F5's log file(s).

     

    You can create a script that does an infinite while loop and sleep every X seconds, or create a script that is called from the crontab on the F5.

     

     

    The script would just need to check the logfile with cat and detect which lines are 'new' since the last time it ran. Then for all of those 'new' lines check if a failover event has occurred and execute the script on your linux box through ssh. (just use a key without a password and setup ~/.ssh/authorized_keys on your linux box.

     

     

    Kind regards,

     

     

    Thomas