mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 02:21:34 +00:00
Allow diagnostics to be downloaded on port 62374
A client like `pinata diagnose` can do the equivalent of: nc 192.168.64.2 62374 > foo.tar and find `foo.tar` contains - the output of `/usr/bin/diagnostics` - `iptables -L` - `netstat -an` - `ps uax` - `docker ps` - `dig docker.com` - `wget http://docker.com` This will allow us to diagnose various in-VM faults, without having to ask the user to access the console and run commands. Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
parent
38aef85f6a
commit
af9b3ad7a2
@ -34,6 +34,8 @@ COPY packages/docker/docker /usr/bin/
|
||||
COPY packages/docker/etc /etc/
|
||||
COPY packages/docker-x/docker-x /usr/bin/
|
||||
COPY packages/diagnostics/diagnostics /usr/bin/
|
||||
COPY packages/diagnostics/diagnostics-server /usr/bin/
|
||||
COPY packages/diagnostics/diagnostics-download /usr/bin/
|
||||
COPY packages/diagnostics/etc /etc/
|
||||
COPY packages/automount/etc /etc/
|
||||
COPY packages/9pinit/etc /etc/
|
||||
|
20
alpine/packages/diagnostics/diagnostics-download
Executable file
20
alpine/packages/diagnostics/diagnostics-download
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Gather diagnostic data and write a .tar file to stdout
|
||||
|
||||
TEMP=$(mktemp -d diagnoseXXXXXXX)
|
||||
trap 'rm -rf "$TEMP"' EXIT
|
||||
cd $TEMP
|
||||
|
||||
# gather diagnostic data
|
||||
ps uax > "ps -aux"
|
||||
netstat -an > "netstat -an"
|
||||
iptables -L > "iptables -L"
|
||||
dmesg > dmesg
|
||||
timeout -t 2 docker ps > "docker ps"
|
||||
/usr/bin/diagnostics > "diagnostics"
|
||||
dig docker.com > "dig docker.com"
|
||||
wget -O - http://www.docker.com/ &> "wget docker.com"
|
||||
|
||||
# send everything to the client
|
||||
tar -c .
|
7
alpine/packages/diagnostics/diagnostics-server
Executable file
7
alpine/packages/diagnostics/diagnostics-server
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Allow clients (e.g. pinata diagnose) to download diagnostic data
|
||||
|
||||
while /bin/true; do
|
||||
nc -l -p 62374 -e /usr/bin/diagnostics-download 2>> /var/log/diagnostics-server.log
|
||||
done
|
@ -10,4 +10,5 @@ start()
|
||||
ebegin "Checking system state"
|
||||
|
||||
/usr/bin/diagnostics
|
||||
/usr/bin/diagnostics-server &
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user