Skip to content

A tool for visualising the dependency graph of Salt states.

License

Notifications You must be signed in to change notification settings

erchn/salt-state-graph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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.

Installation

System requirements:

  • dot

Python requirements:

  • pydot
  • PyYAML

dot

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

pydot

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

Usage

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

About

A tool for visualising the dependency graph of Salt states.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published