Forum Discussion

Anju's avatar
Anju
Icon for Altostratus rankAltostratus
Feb 05, 2021

Network map to excel

Hi Folks,

 

How can we get network map info - VIPs, Pool, nodes etc. in a spreadsheet? I need to make a spreadsheet for complete configuration of the device, any quicker way to do it?

7 Replies

    • Anju's avatar
      Anju
      Icon for Altostratus rankAltostratus

      Hi Daniel,

       

      Thank you for your response. I did run the script, but it dint work out for me. Please take a look at the below output i got.-

       

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ # tmsh list cli script virtual-details

      01020036:3: The requested shell script (/Common/virtual-details) was not found.

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ # cli script virtual-details {

      bash: cli: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ # proc script::run {} {

      bash: proc: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #  puts "Virtual Server,Destination,Pool-Name,Profiles,Rules"

      bash: puts: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #  foreach { obj } [tmsh::get_config ltm virtual all-properties] {

      bash: foreach: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #    set profiles [tmsh::get_field_value $obj "profiles"]

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #    set remprof [regsub -all {\n} [regsub -all " context" [join $profiles "\n"] "context"] " "]

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #    set profilelist [regsub -all "profiles " $remprof ""]

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #    puts "[tmsh::get_name $obj],[tmsh::get_field_value $obj "destination"],[tmsh::get_field_value $obj "pool"],$profilelist,[tmsh::get_field_value $obj "rules"]"

      bash: puts: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #  }

      bash: syntax error near unexpected token `}'

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ # }

      bash: syntax error near unexpected token `}'

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #  total-signing-status not-all-signed

      bash: total-signing-status: command not found

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ # }

      bash: syntax error near unexpected token `}'

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #

      [XXX@UNIT-01:Peer Time Out of Sync:Changes Pending] ~ #

       

      Looking for an output from a particular partition in bash. Not sure, how can I achieve this. Let me know if you can help on this. Thanks.

    • Anju's avatar
      Anju
      Icon for Altostratus rankAltostratus

      Tried the one in the article - https://support.f5.com/csp/article/K44010967, its giving below output (used 'grep' instead of 'awk' since grep is only supported on these units) its giving the blank csv file. extracted from winscp, nothing was found.

       

  • Hi Anju,

     

    I think you missed part of the instructions. First you run

    tmsh create cli script virtual-details

    in order to create the script. Then you paste from line 52 to the end of the code snippet.

    Next you run

    tmsh list cli script virtual-details

    to verify the script was created successfully.

    And then you run.

    tmsh run cli script virtual-details > /var/tmp/virtual-details.csv

    This will write the results to the CSV.

     

    As for your question regarding K44010967... as far as my memory reaches back, 'grep' and 'awk' are always available. I cannot recall a BIG-IP version that would not have 'awk' in bash. Also you cannot replace them with the another. The 'grep' command searches for lines matching a regex pattern while 'awk' is for string, arithmetic, and time manipulation.

    • Anju's avatar
      Anju
      Icon for Altostratus rankAltostratus

      Hi Daniel,

       

      Tried the script as suggested, its giving the error - command not found. The below was found when tried on common partition -

      01020036:3: The requested shell script (/Common/virtual-details) was not found.

      when tried in bash, found the below error-

      bash: cli: command not found

      virtual-details: script failed to complete:

      script "virtual-details" does not contain a "script::run" procedure

      script did not successfully complete, status:1

       

      Need to know what am i doing wrong here?

      • Apologies, maybe I was not 100% clear. With this snippet you create the script.

         

        tmsh create cli script virtual-details

         

        Next switch to tmsh and run:

         

        root@(awaf)(cfg-sync Standalone)(Active)(/Common)(tmos)# edit cli script virtual-details

         

        Here is a screenshot:

        Now a vi-style editor will open you must paste from line 52 to line 88 the end of the code snippet. Verify that copy&paste worked. In my test, the proc from line 52 was not pasted, I had to type it manually.

        Also exit this editor in vi-style with :wq. You will additionally be prompted whether you want to save the script.

        Now run this command to verify your changes were saved.

         

        tmsh list cli script virtual-details

         

        If everything looks good, run the script. Here is a screenshot from a successful run: