Update autosupport script and man page

Added information collection from the output of the utilities: top, free, uptime, ifconfig
Added information collection from the output of the Asterisk command 'dahdi show status'
Added option / flag '-n, --non-interactive'
Updated man page to reflect new option / flag '-n, --non-interactive'

Patch-by: John Bigelow (itzanger)
(closes issue AST-749)
........

Merged revisions 349504 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 349505 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349506 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Kinsey Moore 14 years ago
parent dd3f9b51c8
commit 270a015875

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# #
# Autosupport Version 2.0.15 # Autosupport Version 2.0.18
# Collect support information # Collect support information
# #
# Copyright (C) 2005-2010, Digium, Inc. # Copyright (C) 2005-2011, Digium, Inc.
# #
# Written by John Bigelow (support@digium.com) # Written by John Bigelow (support@digium.com)
# Charles Moye (cmoye@digium.com) # Charles Moye (cmoye@digium.com)
@ -28,6 +28,7 @@ VAR_LIB_LIST_FILE="list-of-varlibasterisk.txt"
FILE_PREFIX= FILE_PREFIX=
FOLDER_PREFIX="${HOME}/" FOLDER_PREFIX="${HOME}/"
files="n"; files="n";
NONINTERACTIVE=0
# If a prefix is specified on command-line, add it. # If a prefix is specified on command-line, add it.
if (set -u; : $1) 2> /dev/null if (set -u; : $1) 2> /dev/null
@ -42,6 +43,7 @@ then
echo "Valid Options:" echo "Valid Options:"
echo " [prefix] Prefix to apply to output files" echo " [prefix] Prefix to apply to output files"
echo " May be your existing Digium Technical Support Ticket ID" echo " May be your existing Digium Technical Support Ticket ID"
echo " -n, --non-interactive Run without requiring user input"
echo " -h, --help Show help about options" echo " -h, --help Show help about options"
echo echo
echo "Example:" echo "Example:"
@ -51,8 +53,12 @@ then
echo " XXXXXXXX_${TARBALL_OUTPUT_FILE}" echo " XXXXXXXX_${TARBALL_OUTPUT_FILE}"
echo echo
exit exit
fi elif [ $1 == "-n" ] || [ $1 == "--non-interactive" ]; then
FILE_PREFIX=
NONINTERACTIVE=1
else
FILE_PREFIX="${FILE_PREFIX}${1}_"; FILE_PREFIX="${FILE_PREFIX}${1}_";
fi
fi fi
MYUID=$(id -u); MYUID=$(id -u);
@ -101,6 +107,22 @@ echo >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
echo -n "Working"; echo -n "Working";
echo "------------------" >> $OUTPUT;
echo "UPTIME : uptime" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
uptime >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;
echo -n "."
echo "------------------" >> $OUTPUT;
echo "MEMORY : free" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
free >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;
echo -n "."
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
echo "KERNEL VERSION : uname -a" >> $OUTPUT; echo "KERNEL VERSION : uname -a" >> $OUTPUT;
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
@ -162,9 +184,10 @@ echo >> $OUTPUT;
# Add check to see if asterisk is running. # Add check to see if asterisk is running.
if [ -e /var/run/asterisk.ctl ] || [ -e /var/run/asterisk/asterisk.ctl ]; then if [ -e /var/run/asterisk.ctl ] || [ -e /var/run/asterisk/asterisk.ctl ]; then
for command in "show version" "core show version" "pri show version" "dahdi show version" "transcoder show" \ for command in "show version" "core show version" "pri show version" "dahdi show version" "transcoder show" \
"core show uptime" "pri show spans" "misdn show stacks" "zap show channels" "dahdi show channels" \ "core show uptime" "pri show spans" "misdn show stacks" "zap show channels" "dahdi show status" "dahdi show channels" \
"dahdi show channel 1" "core show channels" "skype show version" "skype show licenses" "skype show users" \ "dahdi show channel 1" "core show channels" "skype show version" "skype show licenses" "skype show users" \
"show g729" "g729 show version" "g729 show licenses" "fax show version" "fax show licenses" "fax show stats" ; do "skype show hostid" "show g729" "g729 show version" "g729 show licenses" "g729 show hostid" "fax show version" \
"fax show licenses" "fax show hostid" "fax show stats"; do
echo "asterisk -rx \"$command\"" >> $OUTPUT; echo "asterisk -rx \"$command\"" >> $OUTPUT;
asterisk -rx "$command" >> $OUTPUT; asterisk -rx "$command" >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
@ -188,6 +211,14 @@ for file in $(ls /etc/*issue* /etc/*release* /etc/*version* \
done done
echo >> $OUTPUT; echo >> $OUTPUT;
echo "------------------" >> $OUTPUT;
echo "TOP : top -bn1" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
top -bn1 >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;
echo -n "."
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
echo "RUNNING PROCESSES : ps aux" >> $OUTPUT; echo "RUNNING PROCESSES : ps aux" >> $OUTPUT;
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
@ -322,7 +353,7 @@ echo >> $OUTPUT;
echo -n "." echo -n "."
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
echo "NETWORK INFO : route -n; iptables -L; ifconfig" >> $OUTPUT; echo "NETWORK INFO : route -n; iptables -L; ifconfig -a" >> $OUTPUT;
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
route -n 2> /dev/null >> $OUTPUT; route -n 2> /dev/null >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
@ -330,7 +361,7 @@ echo "------------------" >> $OUTPUT;
iptables -L 2> /dev/null >> $OUTPUT; iptables -L 2> /dev/null >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
echo "------------------" >> $OUTPUT; echo "------------------" >> $OUTPUT;
ifconfig 2> /dev/null >> $OUTPUT; ifconfig -a 2> /dev/null >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
echo >> $OUTPUT; echo >> $OUTPUT;
echo -n "." echo -n "."
@ -457,23 +488,8 @@ collect_config_backup()
gzip $TARBALL_OUTPUT gzip $TARBALL_OUTPUT
} }
clear; collect()
{
echo
echo "This script will try to collect the following pieces of"
echo "information from your system."
echo
echo "1. Information about your system such as:"
echo "pci listing, dmesg, running processes, and kernel version"
echo
echo "2. A backup of elements of your configuration such as:"
echo "asterisk config files, license files, loaded dahdi/zaptel module"
echo "parameters, and other asterisk/dahdi/zaptel related files."
echo
echo "Collect this information [y/n] ? "
read files;
if [ "$files" = "y" ] || [ "$files" = "yes" ]; then
echo "This may take up to half a minute to run. Please be patient." echo "This may take up to half a minute to run. Please be patient."
collect_digiuminfo; collect_digiuminfo;
collect_config_backup; collect_config_backup;
@ -496,9 +512,33 @@ if [ "$files" = "y" ] || [ "$files" = "yes" ]; then
echo "Please investigate your system, and send the output" echo "Please investigate your system, and send the output"
echo "above to your Digium Technical Support Ticket." echo "above to your Digium Technical Support Ticket."
fi fi
}
clear;
if [ $NONINTERACTIVE -eq 1 ]; then
collect;
else else
echo
echo "This script will try to collect the following pieces of"
echo "information from your system."
echo
echo "1. Information about your system such as:"
echo "pci listing, dmesg, running processes, and kernel version"
echo
echo "2. A backup of elements of your configuration such as:"
echo "asterisk config files, license files, loaded dahdi/zaptel module"
echo "parameters, and other asterisk/dahdi/zaptel related files."
echo
echo "Collect this information [y/n] ? "
read files;
if [ "$files" = "y" ] || [ "$files" = "yes" ]; then
collect;
else
clear; clear;
echo; echo;
echo "User selected not to continue." echo "User selected not to continue."
fi
fi fi
exit exit

@ -1,10 +1,10 @@
.TH AUTOSUPPORT 8 "Aug 8th, 2010" "Asterisk" "Linux Programmer's Manual" .TH AUTOSUPPORT 8 "Dec 14th, 2011" "autosupport" "Linux Programmer's Manual"
.SH NAME .SH NAME
.B autosupport .B autosupport
\(em interactive script to provide Digium[tm]'s support with information \(em interactive script to provide Digium[tm]'s support with information
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
.B autosupport [-h] [prefix] .B autosupport [OPTION] [prefix]
.SH DESCRIPTION .SH DESCRIPTION
\fBautosupport\fR is a script that is normally run by a user contacting Digium's Technical \fBautosupport\fR is a script that is normally run by a user contacting Digium's Technical
@ -30,7 +30,10 @@ least is expected to be attached to a support ticket with Digium.
\fBprefix\fR \fBprefix\fR
Used to prefix the file names. Typically a Digium Technical Support Ticket ID Used to prefix the file names. Typically a Digium Technical Support Ticket ID
.SS Options: .SS Options:
.TP 15 .TP 25
\fB\-n, \-\-non-interactive\fR
Run without requiring user input
.TP 25
\fB\-h, \-\-help\fR \fB\-h, \-\-help\fR
Show help about options Show help about options
.SH FILES .SH FILES

Loading…
Cancel
Save