We all have to create topology diagrams, high level visual representations of our thoughts or environments (or software solutions etc) from time to time, for as they say – “A picture is worth a thousand words”.
The Graphviz software (http://www.graphviz.org/) provides us a simple and elegant way to do so, which with a little bit of practice can make a huge difference in time saved. It also lets us take safe shortcuts, where in we bypass the entire cumbersome process of creating visio diagrams ( or some other tool). And do this instead:
Input Configuration file:
# START_TOPO#cluster:tier:node:dccluster01:web:web1:Chicagocluster02:middleware:mid1:Chicagocluster03:db:db1:Chicagocluster11:web:web2:New Yorkcluster12:middleware:mid2:New Yorkcluster13:db:db2:New York# END_TOPO# START_EDGE#nodes:dir:style:labelweb1:web2:both:invis:UNDEFmid1:mid2:both:invis:UNDEFdb1:db2:both:invis:UNDEFweb1,web2:mid1,mid2:::p9099db1,db2:DBSID:both::Databasemid1,mid2:db1,db2:::p1514# END_EDGE
Having prepared this type of configuration file (which should take a few minutes), run the script given below to generate the “dot” code needed to generate the diagrams. If you use a wiki (which should be all but ubiquitous in IT by now), most modern wikis (eg: mediawiki, dokuwiki) come with plugins for graphviz. The “dot” code generated by the script can then be pasted into your wiki page and an associated graphviz image will be displayed.
Run the script as follows:
$ ./graph.pl –cfg=”./graphit.cfg” –output=/tmp/foo.dot
This will generate the necessary framework for your diagram. You do still need to know the “Dot” language in order to edit/modify/improve on the code, but this script will do the bulk of your work for you. However, that is provided you are drawing topology diagrams (as shown here, in a similar format).
Feel free to pull the script from the git repo here and use/modify it as you deem fit:
The Dot code:
And the diagram looks like this (needs to tweaked further), provided my graphviz plugin works :