Hah, 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.
systemd-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
I 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!
[+] [-] itaddict|8 years ago|reply
[+] [-] bpchaps|8 years ago|reply
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.)
[+] [-] aidos|8 years ago|reply
[+] [-] zwischenzug|8 years ago|reply
https://zwischenzugs.com/2017/12/18/project-management-as-co...
[+] [-] loeg|8 years ago|reply
[+] [-] TimWolla|8 years ago|reply
Quoting from the man page:
[+] [-] fsniper|8 years ago|reply
[+] [-] MayeulC|8 years ago|reply
It otherwise is a very neat graphical overview of the state of a system!
[+] [-] zevv|8 years ago|reply
[+] [-] sgroppino|8 years ago|reply
[+] [-] xmichael99|8 years ago|reply
[+] [-] jakeogh|8 years ago|reply
[+] [-] zevv|8 years ago|reply