Skip to content

Latest commit

 

History

History
118 lines (70 loc) · 2.65 KB

PITCHME.md

File metadata and controls

118 lines (70 loc) · 2.65 KB

PSGraph

PSGraph is a PowerShell module that allows you to script the generation of graphs using the GraphViz engine. It makes it easy to produce data driven visualizations.

basic graph


Install GraphViz from the Chocolatey repo

Register-PackageSource -Name Chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/
Find-Package graphviz | Install-Package -ForceBootstrap

Install PSGraph from the Powershell Gallery

Find-Module PSGraph | Install-Module

Import Module

Import-Module PSGraph

Describe how items are connected

Using a custom DSL, describe how nodes are connected with edges

Graph "myGraph" {
    Edge start -To middle
    Edge middle -To end
}

Export and show the Graph

Then we can render the graph as an image.

Graph "myGraph" {
    Edge -From start -To middle
    Edge -From middle -To end
}  | Export-PSGraph -ShowGraph

firstGraph


Data driven graphs

The real fun starts when they are data driven


Example: Server farm data

Imagine you wanted to diagram a server farm.

I'm generating example servers here:

# Server counts
$WebServerCount = 2
$APIServerCount = 2
$DatabaseServerCount = 2

# Server lists
$WebServer = 1..$WebServerCount | % {"Web_$_"}
$APIServer = 1..$APIServerCount | % {"API_$_"}
$DatabaseServer = 1..$DatabaseServerCount | % {"DB_$_"}

But you could source these from AD or your CMDB


Example: Server farm graph

Then describe how those lists of servers are related

graph servers {
    node -Default @{shape='box'}
    edge LoadBalancer -To $WebServer
    edge $WebServer -To $APIServer
    edge $APIServer -To AvailabilityGroup
    edge AvailabilityGroup -To $DatabaseServer
} | Export-PSGraph -ShowGraph

Example: Server farm graph image

servers


Example: Project structures

files structure


Example: Parent and child processes

related processes


Example: Network connections

network connections


What will you graph?

For more information