A tool for visualising the dependency graph of a Salt highstate.
The utility ingests the YAML representing the Salt highstate (or sls state) for a single minion and produces a program written in DOT.
An example: http://i.imgur.com/wETR0WG.png
Each node is a state. Edges are dependency relationships:
require
require_in
watch
watch_in
requires are blue; watches are red.
System requirements:
- dot
Python requirements:
- pydot
- PyYAML
Most operating systems have a package for it, usually as part of GraphViz.
Debian:
apt-get install graphviz
Arch:
pacman -S graphviz
OSX with homebrew:
brew install graphviz
The maintainer's version doesn't work in Python2.7+; we're working on getting PyPi access, in the meantime use this fork:
i.e.:
$ git clone https://github.com/nlhepler/pydot.git
$ cd pydot
$ python setup.py install
Example:
# Run a show_highstate for a single minion and get the output as YAML
$ salt-call state.show_highstate --out yaml > ~/highstate
# Run salt-state-graph with the recorded highstate as stdin
$ python salt-state-graph.py < ~/highstate > ~/highstate.dot
Now you can use the dot
utility to compile this into a graph:
$ dot -Tpng < ~/highstate.dot -o highstate.png
$ dot -Tsvg < ~/highstate.dot -o highstate.svg