D=/var/log; [ -d "$D" ] || D=/tmp F="$D/cim-wedge-$(date +%Y%m%d-%H%M%S).txt" { echo "== date/uptime =="; date; uptime; cat /proc/uptime 2>/dev/null || true echo "== cim process =="; (ps w 2>/dev/null || ps) | grep -iE '[c]im|[d]otnet'; cat /var/run/gd-client.pid 2>/dev/null || true echo "== launch scripts =="; ls -l /opt/gd/gd-client.sh /etc/init.d/*cim* 2>/dev/null || true echo "== ip/route/dns =="; ip addr; ip route; cat /etc/resolv.conf 2>/dev/null || true echo "== arp/neigh =="; ip neigh 2>/dev/null || arp -n 2>/dev/null || true echo "== dns resolve CP3 =="; nslookup cp3-service-spot.hca.corpad.net echo "== ping CP3 =="; ping -c 3 -W 2 10.104.64.175 echo "== TCP 443 to CP3 IP =="; nc -w 4 10.104.64.175 443 &1 || true echo "== HTTPS CP3 no cert check =="; wget -T 8 -S --no-check-certificate -O /dev/null https://cp3-service-spot.hca.corpad.net/ 2>&1 || true echo "== sockets to CP3 =="; (netstat -tn 2>/dev/null || netstat -an 2>/dev/null) | grep 10.104.64.175 || true echo "== mem/disk =="; free; df -h 2>/dev/null || df 2>/dev/null || true echo "== watchdog =="; (ps w 2>/dev/null || ps) | grep -i '[w]atchdog'; tail -20 /var/log/watchdog/* 2>/dev/null || true echo "== dmesg tail =="; dmesg 2>/dev/null | tail -40 || true echo "== syslogs =="; tail -60 /var/log/syslog 2>/dev/null; tail -60 /var/log/messages 2>/dev/null; tail -60 /var/log/kern.log 2>/dev/null echo "== cim errors/reconnects =="; grep -iE 'ssl|cert|timeout|Failed to get CIM Config|SignalR|Starting CIM Client|Connected to SignalR' /var/log/general-devices/artemis/cim-client/cim.log 2>/dev/null | tail -120 echo "== cim.log tail =="; tail -80 /var/log/general-devices/artemis/cim-client/cim.log 2>/dev/null echo "== cim-stderr tail =="; tail -40 /var/log/general-devices/artemis/cim-client/cim-stderr.log 2>/dev/null } > "$F" 2>&1 sync echo "saved $F" # then grab that file after service is restored