Forum Discussion

Gabe_31218's avatar
Gabe_31218
Icon for Nimbostratus rankNimbostratus
Sep 09, 2014

Effective ways to compare Virtual Servers config in the same LTM

Howdy all,

 

My client's got a LTM built with a dev/stage/prod virtual servers covering an application in their respective dev/stage/prod environment. I wish to find a way to find out config deltas between dev and stage virtual servers.

 

Currently we do a visual comparison by going over the screens of both virtual servers. I'm hoping to find out much smarter way..

 

Cheers, Gabe

 

2 Replies

  • Hello Gabe,

     

    You can perform a TMSH lookup for each item and just compare the raw configurations.

     

    Example: tmsh list ltm pool pool.name tmsh list ltm profile client-ssl profile.name tmsh list ltm virtual virtual.server.name

     

    Other alternatives could involve creating something with iControl that pulls the items you wish to compare and looking for differences.

     

    Hope this helps.

     

  • Hi Gabe,

    I am working on something similar to diff VS configs across a pair of LTMs for a migration I'm working on, and I found this post so I thought I'd share - this small bash script lives directly on the LTM, but since it will work with remote hosts, it can live anywhere that can execute bash scripts.

    vsdiff.sh requires two arguments, vs1 and vs2 to compare. If the script finds a colon in either of the arguments, it will parse the left hand side out as a host, and pass the whole thing through ssh. So if I call it like this: "./vsdiff.sh vs_yayf5 vs_doubleyay" it will assume both are local and just run them through tmsh, but I can also call it this way: "./vsdiff.sh vs_yayf5 ltm02:vs_someremotevs" (it passes the host part directly to ssh, so you can do user@host:vsname as well).

    Of course, standard disclaimer applies here (ymmv, "no warranty or guarantee of fit for any purpose is expressed or implied", don't run this in production without testing it in your environment first!! yadda yadda yadda ... ) - hope this is helpful!

    -Josh

    !/bin/bash
    
     Make sure we have inputs and let 'er rip
    [[ $1 && $2 ]] || { echo Usage: vsdiff.sh [host:]vs1 [host:]vs2; exit; }
    echo Comparing [$1] and [$2] ...
    
     do this for both VSs
    for i in 1 2; do
             figure out if we're local or remote
            if [[ ${!i} =~ .*:.* ]]; then
                    h=$(echo ${!i} | cut -f1 -d':')
                    v=$(echo ${!i} | cut -f2 -d':')
            else
                    h=LOCAL
                    v=${!i}
            fi
    
             grab the configs into a couple temp files
            t=$(mktemp)
            declare tmp$i=$t
            cmd="tmsh -q list ltm virtual $v"
            [[ $h != LOCAL ]] && cmd="ssh $h $cmd 2>&1"
            $cmd 2>&1 > $t
    done
    
     diff the configs side by side and clean up
    diff -y $tmp1 $tmp2
    rm $tmp1 $tmp2