2 # a script to test the basic setup of a CTDB/Samba install
3 # tridge@samba.org September 2007
5 PATH="$PATH:/sbin:/usr/sbin:/usr/lpp/mmfs/bin"
7 # list of config files that must exist and that we check are the same
9 CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/sysconfig/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/sysconfig/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
11 # list of config files that may exist and should be checked that they
12 # are the same on all nodes
13 CONFIG_FILES_MAY="/etc/ctdb/public_addresses /etc/ctdb/static-routes"
18 --------------------------------------------------------------------
19 ctdb_diagnostics starting. This script will gather information about
20 your ctdb cluster. You should send the output of this script along
21 with any ctdb or clustered Samba bug reports.
22 --------------------------------------------------------------------
30 NUM_ERRORS=`expr $NUM_ERRORS + 1`
31 echo " ERROR[$NUM_ERRORS]: $msg" >> $ERRORS
36 echo " ================================"
38 echo " `ls -l $fname 2>&1`"
39 cat "$fname" 2>&1 | sed 's/^/ /'
40 echo " ================================"
44 echo "running $1 on all nodes"
45 onnode all "hostname; date; $1 2>&1 | sed 's/^/ /'"
48 ERRORS="/tmp/diag_err.$$"
49 NUM_NODES=`wc -l < /etc/ctdb/nodes`
50 MAX_NODE=`expr $NUM_NODES - 1`
53 Diagnosis started on a $NUM_NODES node cluster. The following node list will be used:
55 show_file /etc/ctdb/nodes
59 --------------------------------------------------------------------
60 Comping critical config files on all nodes
63 for f in $CONFIG_FILES_MUST; do
65 error "$f is missing on this node"
69 for i in `seq 0 $MAX_NODE`; do
70 echo "Testing for same config file $f on node $i"
71 tmpf=/tmp/`basename $f`.node$i
72 onnode $i cat $f > $tmpf 2>&1
73 cmp $f $tmpf 2>&1 || {
74 error "File $f is different on node $i"
81 for f in $CONFIG_FILES_MAY; do
83 echo "Optional file $f is not present on local node"
87 for i in `seq 0 $MAX_NODE`; do
88 echo "Testing for same config file $f on node $i"
89 tmpf=/tmp/`basename $f`.node$i
90 onnode $i cat $f > $tmpf 2>&1
91 cmp $f $tmpf 2>&1 || {
92 error "File $f is different on node $i"
100 --------------------------------------------------------------------
101 Checking for clock drift
104 for i in `seq 0 $MAX_NODE`; do
105 t2=`onnode $i date +%s`
107 if [ $d -gt 30 -o $d -lt -30 ]; then
108 error "time on node $i differs by $d seconds"
113 --------------------------------------------------------------------
114 Showing software versions
118 show_all "rpm -qa | egrep 'samba|ctdb|gpfs'"
120 [ -x /usr/bin/dpkg-query ] && {
121 show_all "/usr/bin/dpkg-query --show 'ctdb'"
122 show_all "/usr/bin/dpkg-query --show 'samba'"
123 #show_all "/usr/bin/dpkg-query --show 'gpfs'"
128 --------------------------------------------------------------------
129 Showing ctdb status and recent log entries
131 show_all "ctdb status; ctdb ip"
132 show_all "ctdb statistics"
133 show_all "ctdb uptime"
135 echo "Showing log.ctdb"
136 show_all "test -f /var/log/log.ctdb && tail -100 /var/log/log.ctdb"
138 echo "Showing log.ctdb"
139 show_all "test -f /var/log/log.ctdb && tail -100 /var/log/log.ctdb"
141 show_all "tail -200 /var/log/messages"
142 show_all "tail -200 /etc/ctdb/state/vacuum.log"
143 show_all "ls -lRs /var/ctdb"
144 show_all "ls -lRs /etc/ctdb"
148 --------------------------------------------------------------------
149 Showing system and process status
157 show_all "/sbin/lspci"
159 show_all "cat /proc/partitions"
160 show_all "cat /proc/cpuinfo"
161 show_all "cat /proc/scsi/scsi"
162 show_all "/sbin/ifconfig -a"
163 show_all "/sbin/ifconfig -a"
164 show_all "/sbin/ip addr list"
165 show_all "/sbin/route -n"
166 show_all "netstat -s"
168 show_all "crontab -l"
170 show_all "iptables -L -n"
171 show_all "iptables -L -n -t nat"
172 show_all "/usr/sbin/rpcinfo -p"
173 show_all "/usr/sbin/showmount -a"
174 show_all "/usr/sbin/showmount -e"
175 show_all "/usr/sbin/nfsstat -v"
176 [ -x /sbin/multipath ] && {
177 show_all "/sbin/multipath -ll"
179 [ -x /sbin/chkconfig ] && {
180 show_all "/sbin/chkconfig --list"
182 [ -x /usr/sbin/getenforce ] && {
183 show_all "/usr/sbin/getenforce"
185 [ -d /proc/net/bonding ] && {
186 for f in /proc/net/bonding/*; do
191 [ -d /usr/lpp/mmfs ] && {
193 --------------------------------------------------------------------
194 Showing GPFS status and recent log entries
196 show_all "tail -100 /var/adm/ras/mmfs.log.latest"
197 show_all "/usr/lpp/mmfs/bin/mmlsconfig"
198 show_all "/usr/lpp/mmfs/bin/mmlsfs all"
199 show_all "/usr/lpp/mmfs/bin/mmlsnsd"
200 show_all "/usr/lpp/mmfs/bin/mmlsnsd -X"
201 show_all "/usr/lpp/mmfs/bin/mmfsadm dump version"
202 show_all "/usr/lpp/mmfs/bin/mmfsadm dump waiters"
203 show_all "/usr/lpp/mmfs/bin/mmlsmount all"
204 show_all "/usr/lpp/mmfs/bin/mmlsquota"
205 show_all "/usr/lpp/mmfs/bin/mmlscluster"
206 show_all "/usr/lpp/mmfs/bin/mmlsmgr"
207 devlist=`mmlsfs all|grep ^File.system.attributes | cut -d/ -f3 | cut -d: -f1`
208 for d in $devlist; do
210 show_all "mmlsdisk $d"
211 show_all "mmlsfileset $d"
212 show_all "mmlspolicy $d"
213 show_all "mmlssnapshot $d"
215 fslist=`mount|grep type.gpfs|awk '{print $1}'`
216 for fs in $fslist; do
217 show_all "/usr/lpp/mmfs/bin/mmlssnapshot $fs"
218 show_all "/usr/lpp/mmfs/bin/mmlsdisk $fs"
219 show_all "/usr/lpp/mmfs/bin/mmlsfileset $fs"
224 --------------------------------------------------------------------
227 show_all "smbstatus -n -B"
228 show_all "net ads testjoin"
229 show_all "net conf list"
230 show_all "lsof -n | grep smbd"
231 show_all "lsof -n | grep ctdbd"
232 show_all "netstat -tan"
233 show_all "net ads info"
235 show_all "smbclient -U% -L 127.0.0.1"
236 WORKGROUP=`testparm -s --parameter-name=WORKGROUP 2> /dev/null`
237 show_all id "$WORKGROUP/Administrator"
239 show_all "wbinfo --online-status"
243 echo "Diagnostics finished with $NUM_ERRORS errors"