CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Russell_Moore_8
Nimbostratus
Nimbostratus

Problem this snippet solves:

This is a script utilizing the Graphviz package that will create graphs of the relationships of configuration objects of a virtual server.

How to use this snippet:

Requirements

  1. Perl
  2. SOAP::Lite
  3. Net::Netmask
  4. Graphviz

Note: There are other required packages, but the remainder are default in Ubuntu 10.10 perl distribution. This may not be the case with your configuration.

  1. Install dependent libraries via apt-get - depending on your distribution you may have all of these as packages:
    • libssl-dev
    • libcrypt-ssleay-perl
    • libio-socket-ssl-perl
    • libgraph-writer-graphviz-perl
    • libsoap-lite-perl
    • libnet-netmask-perl
  2. For any which aren't available, open a CPAN shell (perl -MCPAN -e shell) and install them with commands such as:
    • install SOAP::Lite
    • install Net::Netmask
  3. Grab the archive below, extract the perl script file, and make it executable

Minimal command-line invocation is:

  • ./f5-gl.pl -t bigip-host-name.your.domain -u userid -p password

The output by default goes into a subdirectory img, but you might want to add the option -d output-directory to keep output files separate from successive runs, particularly if you will run the utility against different BIG-IP systems for different operational environments. You can also use these:

  • -c partition -v vs to run for only a particular VS (the partition must also be given)
  • -e to change the output file type - default is JPG, but there are the options of SVG or PNG

Run it!

Put it in /etc/crontab to run every night, perhaps, and output the files to a directory served by Apache? The files are predictably named, so you could link directly to them from other tools.

If you are averse to command-line parameters (perhaps you don't want the password to appear in a process listing) you can instead update these variables in the script:

  • my $ltm_host
  • my $user_id
  • my $user_password
Comments
helpdesk_35922
Nimbostratus
Nimbostratus
Hello, is this working in BIG-IP V11? I've tried to execute the code and get: Uncaught exception from user code: 500 Can't connect to 172.31.20.54:443 (certificate verify failed) at ./f5-gv.pl line 723. SOAP::Lite::__ANON__('SOAP::Lite=HASH(0x1a42180)', '\x{a}not well-formed (invalid token) at line 1, column 3, byte 3 ...') called at /usr/share/perl5/SOAP/Lite.pm line 3796 SOAP::Lite::call('SOAP::Lite=HASH(0x1a42180)', 'get_version') called at /usr/share/perl5/SOAP/Lite.pm line 3761 SOAP::Lite::__ANON__('SOAP::Lite=HASH(0x1a42180)') called at ./f5-gv.pl line 723 main::get_api_version() called at ./f5-gv.pl line 283 Thanks Edoardo
AN
Nimbostratus
Nimbostratus

@ Russell Moore is this work with version 12 ?

 

Shaun_P__Hughe1
Nimbostratus
Nimbostratus

@helpdesk

 

Editing line 62 "use SOAP::Lite;"

 

to read:

 

"use IO::Socket::SSL;

 

IO::Socket::SSL::set_defaults(SSL_verify_mode => 0);

 

use SOAP::Lite;

 

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;"

 

will allow you to connect with a self-signed certificate, not that it is the best of ideas.

 

Unfortunately, As of v11.4.0 the the get_httpclass_profile() function is deprecated immediately. Attempting to perform this function will return a not-implemented exception.

 

As a workaround you can change line 368 "my $vs_httpclass = get_vs_httpclass($vs_name) || 'NO_HTTPCLASS';"

 

to read:

 

"my $vs_httpclass = 'NO_HTTPCLASS';"

 

which let the script run until it errors out while trying to draw the images. By creating the subdirectories under ./img (example ./img/Common) the script ran successfully.

 

Shaun_P__Hughe1
Nimbostratus
Nimbostratus

You can remove your password from your bash history simply by running:

 

$ history $ history -d linenumber

 

Version history
Last update:
‎07-Mar-2015 14:22
Updated by:
Contributors