Forum Discussion

StephanManthey's avatar
Aug 05, 2021
Solved

List LTM virtual server availability states

The following one-liner lists the availability states of all virtual servers on your BIG-IP LTM device.

The recursive show command followed by a grep filters the relevant lines from the virtual server statistics.

The first sed statement joins the lines with containing the virtual server name and its current availability state.

The second sed statement removes unnecessary information.

tmsh -q -c 'cd /;show ltm virtual recursive' | \
grep -iE '(ltm::virtual|availability)' | \
sed ':a;N;s/\n/ /' | \
sed -r 's/ltm::virtual server\s*:?\s*/\//I; s/\s*availability\s*:\s*/ /I'
  • Hello Stephan.

    It's slighty easier to get this info with Awk.

    tmsh -q -c 'cd /; show ltm virtual recursive' | awk '/Ltm::Virtual/ {printf $3" "} /Availability/ {printf $3"\n"}' | column -t

    Regards,

    Dario.

2 Replies

  • Hello Stephan.

    It's slighty easier to get this info with Awk.

    tmsh -q -c 'cd /; show ltm virtual recursive' | awk '/Ltm::Virtual/ {printf $3" "} /Availability/ {printf $3"\n"}' | column -t

    Regards,

    Dario.