3 ms·
Lsofgraph – Convert lsof output to graph of processes, pipes, fifos and sockets
- MayeulC 9y agoI might be missing something here, but shouldn't the graph be directed (processes opening fifos in read-only mode, or even unidirectional pipes like on Linux)? Or is it something impossible to query with lsof? It otherwise is a very neat graphical overview of the state of a system!
- zevv 9y agoafaik that info is not available from lsof, but I'm open to suggestions if there is more sensible data to extract from the output.
- zokier 9y agoSlide 12 here[1] shows that lsof distinguishes the read and write ends of FIFOs at least. For TCP I suppose I makes sense to check which end uses ephemeral port. [1] https://github.com/nh2/strace-pipes-presentation/blob/master/presentation/Debugging%20across%20pipes%20and%20sockets%20with%20strace.pdf https://github.com/nh2/strace-pipes-presentation/blob/master...
- zevv 9y agoTrue, info for FIFOs can be derived from lsof output, update follows.
- cryptonector 9y agoThat info is available. If a pipe fd is open for reading, then that's the fd for reading...
- aidos 9y agoCool! More interesting, I didn’t know the dot utility for creating the visual representations of the graphs. I can think of a bunch of uses for that.
- loeg 9y agodot (part of graphviz) is super handy.
- xmichael99 9y agoThank you for referencing the package dot is in!
- zwischenzug 9y agoI use it for project management: https://zwischenzugs.com/2017/12/18/project-management-as-code-with-graphviz/ https://zwischenzugs.com/2017/12/18/project-management-as-co...
- TimWolla 9y agosystemd-analyze(1) supports dot(1) output to plot dependencies between units: Quoting from the man page: EXAMPLES FOR DOT Example 1. Plots all dependencies of any unit whose name starts with "avahi-daemon" $ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg $ eog avahi.svg Example 2. Plots the dependencies between all known target units systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' | dot -Tsvg > targets.svg $ eog targets.svg
- fsniper 9y agoI wish I had this when I started my career. I would have well slept more.
- bpchaps 9y agoHah, I wrote something very, very similar to this recently. The problem I eventually had with it was that lsof wasn't always installed on the hosts I was working with. So, it turned into a script to parse through /proc and other nonsense. https://github.com/red-bin/lsofer/blob/master/lsofer.sh https://github.com/red-bin/lsofer/blob/master/lsofer.sh (wish I could paste the graphing code, but it's code I wrote at my company.)
- sgroppino 9y agoNow we just need to combine this with lstopo.
- xmichael99 9y agoWaiting for your github posting (:
- jakeogh 9y agoCool! What's it's license?
- zevv 9y agoJust added the LICENSE file, 2 clause BSD
- itaddict 9y agoI made python version: https://github.com/akme/lsofgraph-python https://github.com/akme/lsofgraph-python