3 . ${CIRROS_LIB:=/lib/cirros/shlib_cirros} ||
4 { echo "failed to read ${CIRROS_LIB}" 1>&2; exit 1; }
8 Usage: ${0##*/} [ options ]
10 output status of the system.
11 Normally this would be used for debugging, or to console
12 to show user information.
15 -v | --verbose : be more verbose
20 [ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
25 local long_opts="help,verbose"
27 getopt_out=$(getopt --name "${0##*/}" \
28 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
29 eval set -- "${getopt_out}" ||
30 { bad_Usage; return; }
32 local cur="" next="" mode="" VERBOSITY
34 while [ $# -ne 0 ]; do
37 -h|--help) Usage ; exit 0;;
38 -v|--verbose) VERBOSITY=$((${VERBOSITY}+1));;
44 [ $# -eq 0 ] || { bad_Usage "no arguments expected"; return; }
46 TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
47 { error "failed to make tempdir"; return 1; }
51 container=$(lxc-is-container -v) || container="none"
52 echo "=== system information ==="
53 # Example: Red Hat Inc. OpenStack Nova
55 dmesg | grep DMI: | sed -n 's/.*[ ]\+DMI:[ ]*\(.\+\), BIOS.*/\1/p'
56 echo "Container: ${container}"
58 lscpu | awk '$1 == "Architecture:" { arch=$2 };
59 $1 == "Socket(s):" { sockets=$2 };
60 $0 ~ /^Core.*per socket:/ { cores=$4 };
61 $0 ~ /^Thread.*core:/ { threads=$4 };
62 $1 == "CPU(s):" { cpus=$2; } ;
63 $1" "$2 == "CPU MHz:" { mhz=$3 };
64 $1 == "Virtualization:" { virt=$2 };
66 printf("Arch: %s\nCPU(s): %s @ %s MHz\nCores/Sockets/Threads: %s/%s/%s\n",
67 arch, cpus, mhz, cores, sockets, threads);
68 printf("Virt-type: %s\n", virt);
70 arch="na" cpus="na" mhz="na" cores="na" sockets="na" threads="na"
72 awk '$1 == "MemTotal:" { printf("RAM Size: %dMB\n", $2/1024)}' /proc/meminfo
74 if [ "$container" = "none" ]; then
76 asroot lsblk --ascii --list --bytes --output NAME,MAJ:MIN,SIZE,LABEL,MOUNTPOINT
79 echo "=== sshd host keys ==="
80 echo "-----BEGIN SSH HOST KEY KEYS-----"
81 asroot dropbearkey -f /etc/dropbear/dropbear_rsa_host_key -y | grep ^ssh-rsa
82 asroot dropbearkey -f /etc/dropbear/dropbear_dss_host_key -y | grep ^ssh-dss
83 echo "-----END SSH HOST KEY KEYS-----"
85 local oifs="$IFS" x="" val=""
86 echo "=== network info ==="
87 ip addr show > "$TEMP_D/ip-addr-show"
88 ipinfo < "$TEMP_D/ip-addr-show"
89 IFS="|"; set -- $_RET; IFS="$oifs"
93 ip route | sed 's,^,ip-route:,'
95 if assert_datasource; then
96 echo "=== datasource: $_DATASOURCE_NAME $_DATASOURCE_MODE ==="
97 for x in instance-id name availability-zone local-hostname \
99 ds_get_item "$x" && val="$_RET" || val="N/A"
103 echo "=== datasource: None None ==="
106 local cur="" avail="" msg=""
107 cirros_version_available && avail="$_RET"
108 cirros_version && cur="$_RET"
110 [ "$avail" != "0.0" ] && msg="$msg latest=$avail"
112 read_uptime && [ -n "$_RET" ] && msg="$msg uptime=$_RET"
113 echo "=== cirros: $msg ==="
115 if ! check_ping_gateway; then
116 echo "=== pinging gateway failed, debugging connection ==="
125 # vi: ts=4 noexpandtab