iprutils: implementing "dump" command

This patch implements 'iprconfig -c dump' command which creates an sos-report
like file with log information about the adapters and the environment. It also
introduces a bash script "iprsos" that triggers the new command and creates
the log file at /var/log/iprsos.log

Signed-off-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
This commit is contained in:
Daniel Kreling 2015-03-05 10:57:59 -06:00 committed by Brian King
commit 2f183e53f3
5 changed files with 182 additions and 1 deletions

View file

@ -72,8 +72,10 @@ install: all
install --mode=755 iprdump $(INSTALL_MOD_PATH)/sbin/iprdump
install --mode=755 iprinit $(INSTALL_MOD_PATH)/sbin/iprinit
install --mode=700 iprdbg $(INSTALL_MOD_PATH)/sbin/iprdbg
install --mode=755 iprsos $(INSTALL_MOD_PATH)/sbin/iprsos
install -d $(INSTALL_MOD_PATH)/usr/share/man/man8
install iprconfig.8.gz $(INSTALL_MOD_PATH)/usr/share/man/man8/iprconfig.8.gz
install iprsos.8.gz $(INSTALL_MOD_PATH)/usr/share/man/man8/iprsos.8.gz
install iprupdate.8.gz $(INSTALL_MOD_PATH)/usr/share/man/man8/iprupdate.8.gz
install iprdump.8.gz $(INSTALL_MOD_PATH)/usr/share/man/man8/iprdump.8.gz
install iprinit.8.gz $(INSTALL_MOD_PATH)/usr/share/man/man8/iprinit.8.gz

View file

@ -730,6 +730,17 @@ ipr-CCIN-PCI_ADDRESS-dump-TIMESTAMP.
Example:
.br
.B iprconfig -c get-live-dump sg5
.br
.TP
.B dump
Display detailed hardware and system information on standard output.
In case a report file is needed, the iprsos command will create one at
/var/log/iprsos.log.
.br
Example:
.br
.B iprconfig -c dump
.br
.RE
.TP
.B \-\-version

View file

@ -13336,7 +13336,7 @@ static int format_for_raid(char **args, int num_args)
}
/**
* raid_create -
* raid_create
* @args: argument vector
* @num_args: number of arguments
*
@ -17790,6 +17790,85 @@ static int show_perf (char **args, int num_args)
return 0;
}
static int dump (char **args, int num_args)
{
struct ipr_ioa *ioa;
struct ipr_dev *dev;
if (!ipr_ioa_head)
return 0;
printf("\n === Running 'show-config' ===\n");
show_config(NULL,0);
printf("\n === Running 'show-alt-config' ===\n");
show_alt_config(NULL,0);
printf("\n === Running 'show-ioas' ===\n");
show_ioas(NULL, 0);
printf("\n === Running 'show-arrays' ===\n");
show_arrays(NULL,0);
printf("\n === Running 'show-hot-spares' ===\n");
show_hot_spares(NULL, 0);
printf("\n === Running 'show-af-disks' ===\n");
show_af_disks(NULL, 0);
printf("\n === Running 'show-all-af-disks' ===\n");
show_all_af_disks(NULL, 0);
printf("\n === Running 'show-jbod-disks' ===\n");
show_jbod_disks(NULL, 0);
printf("\n === Running show-details ===\n");
for_each_ioa(ioa){
for_each_dev(ioa, dev){
printf("Device %s:\n", dev->gen_name);
show_dev_details(dev);
}
}
printf("\n === Running show-battery-info ===\n");
for_each_ioa(ioa){
char *array[] = { ioa->ioa.gen_name };
printf("Device %s:\n", ioa->ioa.gen_name);
battery_info(array, 1);
}
printf("\n === Running 'query-path-status' ===\n");
for_each_primary_ioa(ioa){
for_each_dev(ioa, dev){
char *array[] = { dev->gen_name };
printf("\nDevice %s:\n", dev->gen_name);
query_path_status(array, 1);
}
}
printf("\n\n === Running 'query-path-details' ===\n");
for_each_primary_ioa(ioa){
for_each_dev(ioa, dev){
char *array[] = { dev->gen_name };
printf("\nDevice: %s\n", dev->gen_name);
query_path_details(array, 1);
}
}
printf("\n === Running 'show-perf' ===\n");
for_each_ioa(ioa){
for_each_dev(ioa, dev){
if (ipr_is_af_dasd_device(dev)) {
char *array[] = { dev->gen_name };
printf("\nDevice: %s\n", dev->gen_name);
show_perf(array, 1);
}
}
}
return 0;
}
static const struct {
char *cmd;
int min_args;
@ -17900,6 +17979,7 @@ static const struct {
{ "suspend-disk-enclosure", 1, 0, 1, suspend_disk_enclosure, "sg8"},
{ "resume-disk-enclosure", 1, 0, 1, resume_disk_enclosure, "sg8 "},
{ "show-perf", 1, 0, 1, show_perf, "sg8"},
{ "dump", 0, 0, 0, dump, "" },
};
/**

60
iprsos Normal file
View file

@ -0,0 +1,60 @@
#!/bin/bash
# This script creates an sos report with iprutils information at $dir
dir="/var/log/iprsos.log"
echo Creating a new file `echo $dir` ...
if [ -f $dir ]; then
rm -f $dir
fi
echo === Running 'iprconfig -c dump' === >> $dir
/sbin/iprconfig -c dump >> $dir
echo >> $dir
echo "=== Running 'lspci' ===" >> $dir
/sbin/lspci >> $dir
echo >> $dir
echo "=== Running 'lsscsi' ===" >> $dir
/usr/bin/lsscsi >> $dir
echo >> $dir
echo "=== Running 'lsscsi -H' ===" >> $dir
/usr/bin/lsscsi -H >> $dir
if [ -d "/usr/lib/systemd/system" ]; then
echo >> $dir
echo === IPR daemons: Running 'systemctl status ipr{init,dump,update}.service' === >> $dir
/usr/bin/systemctl status iprdump.service >> $dir
/usr/bin/systemctl status iprinit.service >> $dir
/usr/bin/systemctl status iprupdate.service >> $dir
else
echo >> $dir
echo === IPR daemons: Running 'service ipr* status' === >> $dir
/sbin/service iprinit status >> $dir
/sbin/service iprdump status >> $dir
/sbin/service iprupdate status >> $dir
fi
echo >> $dir
echo "=== Contents of '/etc/ipr/ ' ===" >> $dir
if [ -d /etc/ipr ]; then
/bin/ls /etc/ipr/ >> $dir
else
echo "No files at /etc/ipr/" >> $dir
fi
echo >> $dir
echo "=== Contents of '/var/log/iprdump*' ===" >> $dir
if [ -f /var/log/iprdump.? ]; then
/bin/ls -lh /var/log/iprdump* >> $dir
else
echo "No iprdump files found at /var/log." >> $dir
fi
echo >> $dir
echo "=== Contents of '/var/log/messages' ===" >> $dir
/bin/cat /var/log/messages >> $dir

28
iprsos.8 Normal file
View file

@ -0,0 +1,28 @@
.\" (C) Copyright 2015
.\" International Business Machines Corporation and others.
.\" All Rights Reserved. This program and the accompanying
.\" materials are made available under the terms of the
.\" Common Public License v1.0 which accompanies this distribution.
.TH IPRSOS 8 "December 2014"
.SH NAME
iprsos \- IBM Power RAID report generator
.SH SYNOPSIS
.BI "iprsos"
.sp
.SH DESCRIPTION
.B iprsos
is used to generate an sosreport-like report by collecting hardware
information from the system, along with other system calls such
as lspci, lscsi, and others. The information is collected from 'iprconfig'
commands and appended to the /var/log/iprsos.log file
.br
.SH FILES
.br
A detailed report file is created at /var/log/iprsos.log with the
information collected from the hardware and system information.
.br
.SH AUTHORS
Daniel B. Kreling <kreling@linux.vnet.ibm.com>
.br
Brian King <brking@us.ibm.com>