Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
Created May 23, 2013 18:51
Show Gist options
  • Save jeffgeiger/5638492 to your computer and use it in GitHub Desktop.
Save jeffgeiger/5638492 to your computer and use it in GitHub Desktop.
Modified version of the stock gatherlogs.samples.sh GPFS script. Switched from RSH to SSH.
#!/bin/ksh
#
# Sample script to gather, merge and sort mmfs.log files
# from nodes listed in file /tmp/gpfs.allnodes
#
# /tmp/gpfs.allnodes has been created by the user of this script
# and contains the host names of the nodes that the
# mmfs.log files are required from. No blank lines.
#
# Output file is called: /tmp/logs.sorted on node script is executes from
#
# Assumes proper rsh execution environment (.rhosts files configured)
#
# -----------------------------------------------------------------------
#
rm /tmp/logs.merged 2>/dev/null # remove the intermediate file
#
for node in $(cat /tmp/gpfs.allnodes) # loop through all nodes in file
do
echo Gathering mmfs logs on node $node
#
# Change the date below for the date of interest for problem determination
# Ensure date pattern matches date of interest in logs
#
# rsh $node "grep -h \"Nov 3\" /var/adm/ras/mmfs.log*" > /tmp/${node}.output
ssh $node "grep -h \"May 23\" /var/adm/ras/mmfs.log*" > /tmp/${node}.output
if [[ -s /tmp/${node}.output ]] then
cat /tmp/${node}.output | \
while read line
do
echo $node $line >> /tmp/logs.merged # add hostname to beginning of line
done
fi
done
#
# sort the merged logs by the date field
#
if [[ -s /tmp/logs.merged ]] then
sort -k 4,5 /tmp/logs.merged > /tmp/logs.sorted
echo sort return code $?
fi
#
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment