Posts Tagged ‘GraphViz’

DFS-R topology

Saturday, May 4th, 2013

Topology of DFS-R can be easily visualized by using GraphViz tool.

Based on Active Directory Topology Visualization part 1 solution I’ve developed next script to have clear picture how DFS replication looks like. Design of solution is very the same: vbs script queries AD regarding to DFS replication groups, folders, servers and connections and formats result into dot language file. Then dot file is used as input for GraphViz package to generate picture of DFS-R topology.

Vbs script can be downloaded here without any limitation of using:

getDFSRTopology.zip

usage:

cscript /nologo getDFSRTopology.vbs

Result:

Generated dot file can look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
DIGRAPH DFSRTopology {
 
fontname=helvetica;
node [fontname=helvetica, image="server.png", labelloc=b,color=white];
 
SUBGRAPH cluster_Bold_and_Beautiful {
label = "Group: Bold_and_Beautiful\nFolder: B&B";
 
FS01_0 [label=FS01];
FS02_0 [label=FS02];
 
}
 
SUBGRAPH cluster_OnlySN_PR {
label = "Group: OnlySN_PR\lFolder: PR-SN"
 
FS03_1 [label=FS03];
FS02_1 [label=FS02];
 
}
 
SUBGRAPH cluster_REPL_Maximo_PROD {
label = "Group: REPL_Maximo_PROD\lFolder: PROD_CfR_Archive\lFolder: PROD_CfR_Current"
 
FS03_2 [label=FS03];
FS02_2 [label=FS02];
FS01_2 [label=FS01];
 
}
 
SUBGRAPH cluster_RG_CORPDATA_DATA {
label = "Group: RG_CORPDATA_DATA\lFolder: DATA"
 
FS02_3 [label=FS02];
FS01_3 [label=FS01];
 
}
 
SUBGRAPH cluster_RG_CORPDATA_USERS {
label = "Group: RG_CORPDATA_USERS\lFolder: USERS"
 
FS01_4 [label=FS01];
FS02_4 [label=FS02];
 
}
 
FS02_0 -> FS01_0;
FS01_0 -> FS02_0;
FS02_1 -> FS03_1;
FS03_1 -> FS02_1;
FS01_2 -> FS03_2;
FS02_2 -> FS03_2;
FS01_2 -> FS02_2;
FS03_2 -> FS02_2;
FS03_2 -> FS01_2;
FS02_2 -> FS01_2;
FS01_3 -> FS02_3;
FS02_3 -> FS01_3;
FS02_4 -> FS01_4;
FS01_4 -> FS02_4;
 
}

and based on it here is the picture (command: fdp *.dot -Tjpg -O):

fdp4

Rectangles represent replication groups with replication partners. Opposite to Active Directory Topology Visualization part 1 or Site links topology solutions, where nodes occur only once, here is needed one trick to have the same server in various groups. In line 88 in vbs script I pin to node names additional counter to have group specific servers, however their labels stay the same. It allows to see the same server name in various groups but nodes are definitely different from dot language viewpoint.

 

Site links topology

Saturday, May 4th, 2013

Based on solution developed for Active Directory Topology Visualization part 1 purpose I’ve made very similar script to have nice picture of defined site links in AD.

I think it’s quite good to know if gap in replication is not caused by lack of site link, etc.

Details:

Nothing special was developed by me. I simply query via vbs script this DN:

CN=IP,CN=Inter-Site Transports,CN=Sites,CN=Configuration,DC=my,DC=domain

and result is presented in dot language formatted file.

Vbs code can be downloaded here and feel free to use it:

getSiteLinks.zip

usage:

cscript /nologo getSiteLinks.vbs

Gallery:

Result of above vbs script can look like as follow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
GRAPH siteLinks {
 
    node [fontname=helvetica, image="site.png", labelloc=b, color=white];
 
    Site1 -- HQ;
    Site2 -- Site3;
    Site2 -- HQ;
    Site3 -- HQ;
    Test -- HQ;
    Site2 -- HQ;
    Site4 -- HQ;
    Site5 -- Site6;
    Site5 -- HQ;
    Site6 -- HQ;
    Site6 -- HQ;
    Site7 -- Site3;
    Site7 -- HQ;
    Site3 -- HQ;
    Site8 -- Site4;
    Site8 -- Site9;
    Site8 -- HQ;
    Site4 -- Site9;
    Site4 -- HQ;
    Site9 -- HQ;
    Backup -- HQ;
    Site7 -- Site10;
    Site7 -- HQ;
    Site10 -- HQ;
    Test -- HQ;
 
}

and based on it GraphViz can generate:

dot diagram layout (command: dot *.dot -Tjpg -odot.jpg):

dot3

fdp diagram layout (command: fdp *.dot -Tjpg -ofdp.jpg):

fdp3

sfdp diagram layout (command: sfdp *.dot -Tjpg -osfdp.jpg):

sfdp3

Example of site node picture:

site

There is possible to use any other picture to present site in diagram than above one. The most important is to put picture file of site (site.png in this case) in the same location where dot file is stored before compilation.

 

Active Directory Topology Visualization part 1

Saturday, May 4th, 2013

Overview:

Except of Microsoft Active Directory Topology Diagrammer, which requires licensed MS Visio installed, there is no easy way to show how physical topology of Active Directory looks like. As the Chinese proverb goes, “A picture is worth a thousand words”, result of 17 repadmin /replsum <DC> commands even prepared in MS Excel will not tell as much as below screen:

circo

Details:

GraphViz is open-source tool based on dot language dedicated for drawing diagrams. It allows to present any graph or network in simple static form with information like direction of flow between nodes or node specific details. It is perfect tool to show how Active Directory Domain Controllers replicate each other and allows to find bottleneck or critical paths in AD physical topology.

Usage is very simple and requires GraphViz package installed locally and own developed script to prepare input for this tool based on dot language.

1. Below code is dot language script topology.dot used as input for GraphViz package to generate nice diagram:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
DIGRAPH replicationTopologyLite {
 
    fontname=helvetica;
    node [fontname=helvetica, image="server.png", labelloc=t,color=white];
 
    SUBGRAPH cluster_AS {
    label = "AS"
 
    ASDC015;
 
    }
 
    SUBGRAPH cluster_US {
    label = "US"
 
    USDC014;
 
    }
 
    SUBGRAPH cluster_EU {
    label = "EU"
 
    EUDC014;
 
    }
 
    EUDC014 -> ASDC015;
    EUDC014 -> USDC014;
    ASDC015 -> EUDC014;
    USDC014 -> EUDC014;
 
}

note:

– AD Sites: EU, US and AS are specified as SUBGRAPH cluster_XX and are presented as rectangles in final diagram

– AD DCs: EUDC014, USDC014 and ASDC015 are simply nodes in diagram

– example of server picture to put into the same folder where topology.dot is located:

server

2. Command to generate picture of dot diagram layout:

dot topology.dot -Tjpg -O

 and result:

dot

3. Examples of commands to generate all kind of diagram layouts:

dot *.dot -Tjpg -odot.jpg
fdp *.dot -Tjpg -ofdp.jpg
sfdp *.dot -Tjpg -osfdp.jpg
circo *.dot -Tjpg -ocirco.jpg
neato *.dot -Tjpg -oneato.jpg
osage *.dot -Tjpg -oosage.jpg
twopi *.dot -Tjpg -otwopi.jpg

Practice:

Dot file can be prepared manually or a bit smarter. Below vbs is my own developed and many time used script which queries AD regarding to sites, domain controllers and connection objects and generates dot launguage file used later in GraphViz package.

Vbs script is available to download here and feel free to use it:

getReplicationTopologyLite.zip

usage:

cscript /nologo getReplicationTopologyLite.vbs DC

Gallery:

Below diagrams are examples of AD replication topology:

dot2

fdp1However more complex environments (>100 DCs) require a few tricks to make pictures more readable. I usually add dotted style for connections for example:

1
2
3
4
5
6
DIGRAPH replicationTopology {
 
    fontname=helvetica;
    node [fontname=helvetica, image="server.png", labelloc=b,color=white];
    edge [style=dotted];    ...

or trying to generate all kind of diagram layouts to choose the most suitable to study. In most cases huge networks need specific approach.

A few useful links:

1. Official GraphViz web site: http://www.graphviz.org

2. Dot guide: http://www.graphviz.org/pdf/dotguide.pdf

3. Wikipedia about GraphViz: http://en.wikipedia.org/wiki/Graphviz

4. Active Directory Topology Visualization part 2

Let the “more readable replication topology” be with you.