#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin # Keep going even if one of the programs report an error code # set -e mkdir system && cd system if type dmidecode >/dev/null 2>&1; then # Throw away error messages. It will print "/dev/mem: mmap: Bad address" # in Xen machines. dmidecode > dmidecode 2> /dev/null fi if [ -d /proc/bus/pci ] && [ -n "${ENABLE_LSPCI}" ] && type lspci >/dev/null 2>&1; then lspci > lspci lspci -n > lspci-n fi if type lsusb >/dev/null 2>&1; then lsusb > lsusb fi if [ -d /sys/bus/scsi ] && type lsscsi >/dev/null 2>&1; then lsscsi > lsscsi fi if type lsmod >/dev/null 2>&1; then lsmod > lsmod fi uname -smr > uname-smr uname -n > hostname ifconfig -a > ifconfig-a route -n > route-n cat /proc/cpuinfo > cpuinfo cat /proc/meminfo > meminfo # Collect software RAID status if [ -f /proc/mdstat ] ; then cat /proc/mdstat > mdstat fi # Collect hard disk information for diskdev in $(grep 'sd.$' /proc/partitions|awk '{print $4}'|sort); do hdparm -I /dev/$diskdev 2>/dev/null || true done > hdparm-I # Collect zfs hard disk information too if type zpool >/dev/null 2>&1 ; then zpool status > zpool-status fi # Collect mount points, for nagios configuration cp /etc/fstab fstab cat /proc/mounts > procmounts # Document current runlevel, useful to differenciate LTSP # thin clients from diskless workstations. runlevel > runlevel # Throw away error message from laptop-detect using dmidecode in Xen # domUs. See #438693 for more info. if [ -x /usr/sbin/laptop-detect ] && /usr/sbin/laptop-detect 2>/dev/null; then touch laptop fi for f in /etc/ssh/ssh_host*.pub ; do cp $f . done if [ -f /etc/X11/xorg.conf ]; then cp /etc/X11/xorg.conf . fi if [ -f /var/log/Xorg.0.log ]; then cp /var/log/Xorg.0.log . fi if [ -f /etc/X11/fs/config ]; then cp /etc/X11/fs/config x11-fs-config fi # Collect Cisco Discover Protocol information from all interfaces, in # parallell. if type cdpr >/dev/null 2>&1; then childs="" for if in $(ip link show up|awk '/^[0-9]+:/ {print $2}' | cut -d: -f1) ; do if [ lo = "$if" ] ; then continue; fi cdpr -d $if -t 61 > cdpr.$if & childs="$childs $!" done for pid in $childs ; do wait $pid done fi