autosupport 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. #!/bin/sh
  2. #
  3. # Autosupport Version 2.1.3
  4. # Collect support information
  5. #
  6. # Copyright (C) 2005-2016, Digium, Inc.
  7. #
  8. # Written by John Bigelow (support@digium.com)
  9. # Charles Moye (cmoye@digium.com)
  10. # Trey Blancher (trey@digium.com)
  11. #
  12. # Distributed under the terms of the GNU General Public
  13. # License
  14. #
  15. # usage:
  16. # autosupport [prefix]
  17. # ARGUMENTS:
  18. # prefix - Prefix to tarball. (Referenced as $1)
  19. # Example: autosupport <Your Digium Technical Support Ticket number>
  20. # Ensure the PATH variable includes '/usr/sbin' and '/sbin'
  21. PATH=/usr/sbin:/sbin:${PATH}
  22. DATE_STAMP=$(date +%F)
  23. OUTPUT_FILE=digiuminfo.txt
  24. TARBALL_OUTPUT_FILE="digium-info_${DATE_STAMP}.tar"
  25. VAR_LIB_LIST_FILE="list-of-varlibasterisk.txt"
  26. FILE_PREFIX=
  27. FOLDER_PREFIX="${HOME}/"
  28. files="n";
  29. NONINTERACTIVE=0
  30. # If a prefix is specified on command-line, add it.
  31. if (set -u; : $1) 2> /dev/null
  32. then
  33. case "$1" in
  34. -h | --help)
  35. echo
  36. echo "Digium autosupport script"
  37. echo "Copyright (C) 2005-2016, Digium, Inc."
  38. echo "Licensed under the terms of the GNU General Public License"
  39. echo
  40. echo "usage: autosupport [prefix]"
  41. echo "Valid Options:"
  42. echo " [prefix] Prefix to apply to output files"
  43. echo " May be your existing Digium Technical Support Ticket ID"
  44. echo " -n, --non-interactive Run without requiring user input"
  45. echo " -h, --help Show help about options"
  46. echo
  47. echo "Example:"
  48. echo " autosupport XXXXXXXX"
  49. echo "Generates:"
  50. echo " XXXXXXXX_${OUTPUT_FILE}"
  51. echo " XXXXXXXX_${TARBALL_OUTPUT_FILE}"
  52. echo
  53. exit
  54. ;;
  55. -n | --non-interactive)
  56. FILE_PREFIX=
  57. NONINTERACTIVE=1
  58. ;;
  59. *)
  60. FILE_PREFIX="${FILE_PREFIX}${1}_";
  61. ;;
  62. esac
  63. fi
  64. MYUID=$(id -u);
  65. if [ $MYUID -ne 0 ]; then
  66. echo "You must be root to run this."
  67. exit 1
  68. fi
  69. SUPPORTED_MODULES="wcb4xxp wct4xxp wctc4xxp wctdm wctdm24xxp wcte11xp wcte12xp"
  70. RELATED_MODULES="$SUPPORTED_MODULES dahdi_dummy dahdi_transcode dahdi_vpmadt032_loader";
  71. OUTPUT_FILE="${FILE_PREFIX}${OUTPUT_FILE}"
  72. TARBALL_OUTPUT_FILE="${FILE_PREFIX}${TARBALL_OUTPUT_FILE}"
  73. VAR_LIB_LIST_FILE="${FILE_PREFIX}${VAR_LIB_LIST_FILE}"
  74. OUTPUT="${FOLDER_PREFIX}${OUTPUT_FILE}"
  75. TARBALL_OUTPUT="${FOLDER_PREFIX}${TARBALL_OUTPUT_FILE}"
  76. VAR_LIB_LIST="${FOLDER_PREFIX}${VAR_LIB_LIST_FILE}"
  77. # Done with setup, now start gathering information.
  78. # function not implemented yet
  79. determine_paths()
  80. {
  81. ASTERISK_PROCESS=$(ps -o cmd -C asterisk | grep asterisk 2> /dev/null)
  82. echo "detected process: $ASTERISK_PROCESS";
  83. # split on whitespace? or use sed/awk to parse
  84. # get first arg which will be path to Asterisk binary - add this to PATH
  85. # look for a '-C' if that is present, get the arg after it, and make the tarball collect that directory
  86. ## in addition to /etc/asterisk/ or instead of it?
  87. }
  88. collect_digiuminfo()
  89. {
  90. # Delete existing OUTPUT
  91. [ -f $OUTPUT ] && rm -rf $OUTPUT
  92. # Sanity Checks
  93. echo "------------------" >> $OUTPUT;
  94. echo "Sanity" >> $OUTPUT;
  95. echo "------------------" >> $OUTPUT;
  96. md5sum $0 >> $OUTPUT;
  97. grep "Autosupport Version" $0 | head -n1 >> $OUTPUT
  98. echo >> $OUTPUT;
  99. echo >> $OUTPUT;
  100. echo -n "Working";
  101. echo "------------------" >> $OUTPUT;
  102. echo "UPTIME : uptime" >> $OUTPUT;
  103. echo "------------------" >> $OUTPUT;
  104. uptime >> $OUTPUT;
  105. echo >> $OUTPUT;
  106. echo >> $OUTPUT;
  107. echo -n "."
  108. echo "------------------" >> $OUTPUT;
  109. echo "MEMORY : free" >> $OUTPUT;
  110. echo "------------------" >> $OUTPUT;
  111. free >> $OUTPUT;
  112. echo >> $OUTPUT;
  113. echo >> $OUTPUT;
  114. echo -n "."
  115. echo "------------------" >> $OUTPUT;
  116. echo "KERNEL VERSION : uname -a" >> $OUTPUT;
  117. echo "------------------" >> $OUTPUT;
  118. uname -a >> $OUTPUT;
  119. echo >> $OUTPUT;
  120. echo >> $OUTPUT;
  121. echo -n "."
  122. echo "------------------" >> $OUTPUT;
  123. echo "VERSION INFO : cat /proc/version" >> $OUTPUT;
  124. echo "------------------" >> $OUTPUT;
  125. cat /proc/version >> $OUTPUT;
  126. echo >> $OUTPUT;
  127. echo >> $OUTPUT;
  128. echo -n "."
  129. echo "------------------" >> $OUTPUT;
  130. echo "CMDLINE INFO : cat /proc/cmdline" >> $OUTPUT;
  131. echo "------------------" >> $OUTPUT;
  132. cat /proc/cmdline >> $OUTPUT;
  133. echo >> $OUTPUT;
  134. echo >> $OUTPUT;
  135. echo -n "."
  136. if [ -d /sys/module/dahdi ]; then
  137. echo "------------------" >> $OUTPUT
  138. echo "dahdi version:" >> $OUTPUT
  139. echo "------------------" >> $OUTPUT
  140. echo "/sys/module/dahdi/version: " >> $OUTPUT
  141. cat /sys/module/dahdi/version 2> /dev/null >> $OUTPUT
  142. echo "" >> $OUTPUT;
  143. echo -n "."
  144. fi
  145. echo "------------------" >> $OUTPUT;
  146. echo "DAHDI TOOLS : dahdi_cfg --help" >> $OUTPUT;
  147. echo "------------------" >> $OUTPUT;
  148. dahdi_cfg --help 2>&1 | grep "Version" >> $OUTPUT;
  149. echo >> $OUTPUT;
  150. echo >> $OUTPUT;
  151. echo -n "."
  152. echo "------------------" >> $OUTPUT;
  153. echo "DAHDI HARDWARE : dahdi_hardware" >> $OUTPUT;
  154. echo "------------------" >> $OUTPUT;
  155. dahdi_hardware >> $OUTPUT;
  156. echo >> $OUTPUT;
  157. echo >> $OUTPUT;
  158. echo "------------------" >> $OUTPUT;
  159. echo "ASTERISK INFO : asterisk -V" >> $OUTPUT;
  160. echo "------------------" >> $OUTPUT;
  161. echo "asterisk -V:" >> $OUTPUT;
  162. asterisk -V >> $OUTPUT;
  163. echo >> $OUTPUT;
  164. # Add check to see if asterisk is running.
  165. if [ -e /var/run/asterisk.ctl ] || [ -e /var/run/asterisk/asterisk.ctl ]; then
  166. for command in "core show version" "pri show version" "dahdi show version" \
  167. "pjsip show version" "pjsip show buildopts" "pjproject show buildopts" \
  168. "core show translation" \
  169. "core show uptime" "core show settings" "core show sysinfo" "core show channels" \
  170. "pri show spans" "dahdi show status" "dahdi show channels" "dahdi show channel 1" \
  171. "pjsip show endpoints" "pjsip show registrations" "pjsip list channels" \
  172. "sip show peers" "sip show registry" "sip show channels" "sip show subscriptions" "sip show settings" \
  173. "show g729" "g729 show version" "g729 show licenses" "g729 show hostid" \
  174. "digium_phones show version" "digium_phones show alerts" "digium_phones show applications" \
  175. "digium_phones show firmwares" "digium_phones show lines" "digium_phones show networks" \
  176. "digium_phones show phones" "digium_phones show sessions" "digium_phones show settings" \
  177. "digium_phones show translations" ;
  178. do
  179. echo "asterisk -rx \"$command\"" >> $OUTPUT;
  180. asterisk -rx "$command" >> $OUTPUT;
  181. echo >> $OUTPUT;
  182. echo -n "."
  183. done
  184. echo >> $OUTPUT;
  185. fi
  186. for type in alerts applications firmwares lines networks phones translations;
  187. do
  188. echo "------------------" >> $OUTPUT;
  189. echo "DIGIUM PHONE: $type " >> $OUTPUT;
  190. echo "------------------" >> $OUTPUT;
  191. TEMP=$(asterisk -rx "digium_phones show $type");
  192. if [ "$type" = "lines" ];
  193. then
  194. NUM=$(echo $TEMP | tail -n 1 | awk -F' ' '{print $(NF-4)}');
  195. if [ $NUM -gt 0 ];
  196. then
  197. for l in $(echo $TEMP | sed 's/^--- [[:alpha:]]\+ --- //;
  198. s/Lines \(Un-\)\?Mapped to Phones --- //g;
  199. s/ Internal//g;
  200. s/---- [a-zA-Z0-9 ]\+ ----$//;
  201. s/--- //g');
  202. do
  203. asterisk -rx "digium_phones show line $l" >> $OUTPUT;
  204. echo "--------" >> $OUTPUT;
  205. echo >> $OUTPUT;
  206. done
  207. else
  208. echo "No configurations of type $type..." >> $OUTPUT;
  209. echo >> $OUTPUT;
  210. fi;
  211. elif [ "$type" = "firmwares" ];
  212. then
  213. for f in $(echo $TEMP | sed 's/--- Configured Firmware Options --- //');
  214. do
  215. asterisk -rx "digium_phones show firmware $f" >> $OUTPUT;
  216. echo "--------" >> $OUTPUT;
  217. echo >> $OUTPUT;
  218. done
  219. elif [ "$type" = "translations" ];
  220. then
  221. for t in $(echo $TEMP | sed 's/--- Translation tables ---//');
  222. do
  223. asterisk -rx "digium_phones show translation $t"
  224. done
  225. else
  226. NUM=$(echo $TEMP | tail -n 1 | awk -F' ' '{print $(NF-3)}');
  227. if [ $NUM -gt 0 ];
  228. then
  229. for t in $(echo $TEMP | sed 's/^--- [[:alpha:]]\+ --- //;
  230. s/---- [a-zA-Z0-9 ]\+ ----$//
  231. s/---- Digium Phones ---- //');
  232. do
  233. asterisk -rx "digium_phones show $(echo $type | sed 's/s\b//') $t" >> $OUTPUT;
  234. echo "--------" >> $OUTPUT;
  235. echo >> $OUTPUT;
  236. done;
  237. else
  238. echo "No configurations of type $type..." >> $OUTPUT;
  239. echo >> $OUTPUT;
  240. fi;
  241. fi;
  242. done;
  243. echo >> $OUTPUT;
  244. echo "------------------" >> $OUTPUT;
  245. echo "OTHER INFO : cat /etc/*{issue,release,version}*" >> $OUTPUT;
  246. echo "------------------" >> $OUTPUT;
  247. for file in $(ls /etc/*issue* /etc/*release* /etc/*version* \
  248. /etc/*motd* /etc/asterisknow-version /dev/zap/ /dev/dahdi/ \
  249. 2> /dev/null); do
  250. if [ -f $file ]; then
  251. echo "$file:" >> $OUTPUT;
  252. cat $file >> $OUTPUT;
  253. echo >> $OUTPUT;
  254. echo -n "."
  255. fi
  256. done
  257. echo >> $OUTPUT;
  258. echo "------------------" >> $OUTPUT;
  259. echo "TOP : top -bn1" >> $OUTPUT;
  260. echo "------------------" >> $OUTPUT;
  261. top -bn1 >> $OUTPUT;
  262. echo >> $OUTPUT;
  263. echo >> $OUTPUT;
  264. echo -n "."
  265. echo "------------------" >> $OUTPUT;
  266. echo "RUNNING PROCESSES : ps aux" >> $OUTPUT;
  267. echo "------------------" >> $OUTPUT;
  268. ps aux >> $OUTPUT;
  269. echo >> $OUTPUT;
  270. echo >> $OUTPUT;
  271. echo -n "."
  272. echo "------------------" >> $OUTPUT;
  273. echo "INTERRUPTS : cat /proc/interrupts" >> $OUTPUT;
  274. echo "------------------" >> $OUTPUT;
  275. cat /proc/interrupts >> $OUTPUT;
  276. echo -n "."
  277. sleep 2;
  278. echo "---------- sleep(2) ----------" >> $OUTPUT;
  279. cat /proc/interrupts >> $OUTPUT;
  280. echo >> $OUTPUT;
  281. echo >> $OUTPUT;
  282. echo -n "."
  283. echo "------------------" >> $OUTPUT;
  284. echo "DAHDI SCAN : dahdi_scan" >> $OUTPUT;
  285. echo "------------------" >> $OUTPUT;
  286. dahdi_scan >> $OUTPUT;
  287. echo >> $OUTPUT;
  288. echo >> $OUTPUT;
  289. echo -n "."
  290. echo "----------------------------" >> $OUTPUT;
  291. echo "CAT OF DAHDI CHANNELS : cat /proc/dahdi/" >> $OUTPUT;
  292. echo "----------------------------" >> $OUTPUT;
  293. if [ -d /proc/dahdi/ ]; then
  294. for file in $(ls /proc/dahdi/ 2> /dev/null); do
  295. echo "----------------------------" >> $OUTPUT;
  296. echo "/proc/dahdi/$file:" >> $OUTPUT;
  297. cat /proc/dahdi/$file >> $OUTPUT;
  298. echo >> $OUTPUT;
  299. echo -n "."
  300. done
  301. fi
  302. echo >> $OUTPUT;
  303. echo "------------------" >> $OUTPUT;
  304. echo "DMESG OUTPUT : dmesg" >> $OUTPUT;
  305. echo "------------------" >> $OUTPUT;
  306. dmesg >> $OUTPUT;
  307. echo >> $OUTPUT;
  308. echo >> $OUTPUT;
  309. echo -n "."
  310. echo "------------------" >> $OUTPUT;
  311. echo "LOADED MODULES : lsmod" >> $OUTPUT;
  312. echo "------------------" >> $OUTPUT;
  313. lsmod >> $OUTPUT;
  314. echo >> $OUTPUT;
  315. echo >> $OUTPUT;
  316. echo -n "."
  317. # Grab the parameters for each module
  318. for mod in $SUPPORTED_MODULES; do
  319. if [ -d /sys/module/$mod ]; then
  320. echo "------------------" >> $OUTPUT
  321. echo "$mod parameters" >> $OUTPUT
  322. echo "------------------" >> $OUTPUT
  323. echo "/sys/module/$mod/parameters:" >> $OUTPUT
  324. for param in $(ls /sys/module/$mod/parameters/ /sys/module/$mod/ 2> /dev/null); do
  325. if [ -f /sys/module/$mod/parameters/$param ]; then
  326. echo -n "$param: " >> $OUTPUT
  327. cat /sys/module/$mod/parameters/$param 2> /dev/null >> $OUTPUT
  328. elif [ -f /sys/module/$mod/$param ]; then
  329. # Handle Zaptel doing it differently
  330. echo -n "$param: " >> $OUTPUT
  331. cat /sys/module/$mod/$param 2> /dev/null >> $OUTPUT
  332. fi
  333. echo -n "."
  334. done
  335. echo >> $OUTPUT
  336. fi
  337. done
  338. echo "------------------------" >> $OUTPUT;
  339. echo "DAHDI MODULE INFO : modinfo" >> $OUTPUT;
  340. echo "------------------------" >> $OUTPUT;
  341. for file in $(ls /lib/modules/$(uname -r)/dahdi/*.ko \
  342. /lib/modules/$(uname -r)/dahdi/*/*.ko\
  343. /lib/modules/$(uname -r)/extra/*.ko \
  344. /lib/modules/$(uname -r)/extra/*/*.ko \
  345. /lib/modules/$(uname -r)/misc/*.ko \
  346. /lib/modules/$(uname -r)/misc/*/*.ko 2> /dev/null); do
  347. if [ -f $file ]; then
  348. echo "------------------------" >> $OUTPUT;
  349. modinfo $file >> $OUTPUT;
  350. echo >> $OUTPUT;
  351. echo -n "."
  352. fi
  353. done
  354. echo "------------------------" >> $OUTPUT;
  355. echo >> $OUTPUT;
  356. echo "------------------" >> $OUTPUT;
  357. echo "PCI LIST : lspci -vvvb" >> $OUTPUT;
  358. echo "------------------" >> $OUTPUT;
  359. lspci -vvvb >> $OUTPUT;
  360. echo >> $OUTPUT;
  361. echo >> $OUTPUT;
  362. echo -n "."
  363. echo "------------------" >> $OUTPUT;
  364. echo "PCI LIST(no lookup) : lspci -vvvbn" >> $OUTPUT;
  365. echo "------------------" >> $OUTPUT;
  366. lspci -vvvbn >> $OUTPUT;
  367. echo >> $OUTPUT;
  368. echo >> $OUTPUT;
  369. echo -n "."
  370. echo "------------------" >> $OUTPUT;
  371. echo "CPU INFO : cat /proc/cpuinfo" >> $OUTPUT;
  372. echo "------------------" >> $OUTPUT;
  373. cat /proc/cpuinfo >> $OUTPUT;
  374. echo >> $OUTPUT;
  375. echo >> $OUTPUT;
  376. echo -n "."
  377. echo "----------------------" >> $OUTPUT;
  378. echo "VPM FIRMWARE INSTALLED : ls -la /lib/firmware" >> $OUTPUT;
  379. echo "----------------------" >> $OUTPUT;
  380. $(ls -la /lib/firmware 2> /dev/null >> $OUTPUT);
  381. echo >> $OUTPUT;
  382. echo >> $OUTPUT;
  383. echo -n "."
  384. echo "------------------" >> $OUTPUT;
  385. echo "NETWORK INFO : route -n; iptables -L; ifconfig -a" >> $OUTPUT;
  386. echo "------------------" >> $OUTPUT;
  387. route -n 2> /dev/null >> $OUTPUT;
  388. echo >> $OUTPUT;
  389. echo "------------------" >> $OUTPUT;
  390. iptables -L 2> /dev/null >> $OUTPUT;
  391. echo >> $OUTPUT;
  392. echo "------------------" >> $OUTPUT;
  393. ifconfig -a 2> /dev/null >> $OUTPUT;
  394. echo >> $OUTPUT;
  395. echo >> $OUTPUT;
  396. echo -n "."
  397. echo "------------------" >> $OUTPUT;
  398. echo "DMIDECODE : dmidecode" >> $OUTPUT;
  399. echo "------------------" >> $OUTPUT;
  400. dmidecode >> $OUTPUT;
  401. echo >> $OUTPUT;
  402. echo >> $OUTPUT;
  403. echo -n "."
  404. echo "------------------" >> $OUTPUT;
  405. echo "KERNEL CONFIG : cat /path/.config" >> $OUTPUT;
  406. echo "------------------" >> $OUTPUT;
  407. for file in /lib/modules/$(uname -r)/build/.config /usr/src/linux/.config; do
  408. if [ -f $file ]; then
  409. echo "------------------" >> $OUTPUT;
  410. echo "$file:" >> $OUTPUT;
  411. cat $file >> $OUTPUT;
  412. echo >> $OUTPUT;
  413. echo -n "."
  414. fi
  415. done
  416. echo >> $OUTPUT;
  417. FIRMWARE_DIR=`grep firmware_package_directory /etc/asterisk/res_digium_phone.conf|sed 's/;.*$//;'|grep firmware|sed 's/firmware_package_directory=//;'`;
  418. if [ `echo $FIRMWARE_DIR|egrep -v '^$'|wc -l` -eq "0" ]
  419. then
  420. FIRMWARE_DIR="/var/www/firmware_package_directory"
  421. fi
  422. echo "------------------" >> $OUTPUT;
  423. echo "FIRMWARE LISTING: ls -al $FIRMWARE_DIR" >> $OUTPUT;
  424. echo "------------------" >> $OUTPUT;
  425. ls -al $FIRMWARE_DIR >> $OUTPUT;
  426. echo >> $OUTPUT;
  427. FIRMWARE_URLS=`grep file_url_prefix /etc/asterisk/res_digium_phone.conf|sed 's/;.*$//;'|grep file|sed 's/file_url_prefix=//;'`;
  428. for FIRMWARE_URL in $FIRMWARE_URLS; do
  429. echo "------------------" >> $OUTPUT;
  430. echo "REMOTE FIRMWARE LISTING: wget $FIRMWARE_URL" >> $OUTPUT;
  431. echo "------------------" >> $OUTPUT;
  432. wget "$FIRMWARE_URL" -O- 2>/dev/null >> $OUTPUT;
  433. echo >> $OUTPUT;
  434. done
  435. echo "done!"
  436. }
  437. collect_var_lib_list()
  438. {
  439. # Delete existing VAR_LIB_LIST
  440. [ -f $VAR_LIB_LIST ] && rm -rf $VAR_LIB_LIST
  441. DIR_LISTING="/var/lib/asterisk/"
  442. if [ -d /var/lib/digium ]; then
  443. DIR_LISTING="/var/lib/digium/ ${DIR_LISTING}"
  444. fi
  445. if [ -d /usr/lib/asterisk/modules/ ]; then
  446. DIR_LISTING="/usr/lib/asterisk/modules/ ${DIR_LISTING}"
  447. fi
  448. echo "ls -1aAR $DIR_LISTING > $VAR_LIB_LIST"
  449. $(ls -1aR ${DIR_LISTING} | sed -e '/^\.\.*$/d' > $VAR_LIB_LIST);
  450. }
  451. collect_config_backup()
  452. {
  453. collect_var_lib_list
  454. # Include the /etc/asterisk directory, modprobe.conf, and the modprobe.d directory
  455. TAR_FILES="/etc/asterisk/ /etc/modprobe.*"
  456. # Check if any Asterisk licenses are installed
  457. # G.729, Fax, ABE, Cepstral, Skype, etc.
  458. if [ -d /var/lib/asterisk/licenses/ ]; then
  459. TAR_FILES="$TAR_FILES /var/lib/asterisk/licenses/*"
  460. fi
  461. # Check if any Digium licenses are installed
  462. # HPEC
  463. if [ -d /var/lib/digium/licenses/ ]; then
  464. TAR_FILES="$TAR_FILES /var/lib/digium/licenses/*"
  465. fi
  466. # Check if DAHDI is installed
  467. if [ -d /etc/dahdi ]; then
  468. TAR_FILES="$TAR_FILES /etc/dahdi*"
  469. fi
  470. # Grab the dahdi init scripts, in case they have been modified
  471. if [ -f /etc/init.d/dahdi ]; then
  472. TAR_FILES="$TAR_FILES /etc/init.d/dahdi"
  473. fi
  474. # Check for fxotune.conf
  475. if [ -f /etc/fxotune.conf ]; then
  476. TAR_FILES="$TAR_FILES /etc/fxotune.conf*"
  477. fi
  478. # Check for misdn-init.conf
  479. if [ -f /etc/misdn-init.conf ]; then
  480. TAR_FILES="$TAR_FILES /etc/misdn-init.conf*"
  481. fi
  482. # Check for digiuminfo.txt
  483. if [ -f $HOME/$OUTPUT_FILE ]; then
  484. TAR_FILES="$TAR_FILES $OUTPUT_FILE"
  485. fi
  486. # Check for asterisk listing
  487. if [ -f $VAR_LIB_LIST ]; then
  488. TAR_FILES="$TAR_FILES $VAR_LIB_LIST_FILE"
  489. fi
  490. # Collect System Log Files
  491. if [ -f /var/log/dmesg ]; then
  492. TAR_FILES="$TAR_FILES /var/log/dmesg"
  493. fi
  494. if [ -f /var/log/messages ]; then
  495. TAR_FILES="$TAR_FILES /var/log/messages"
  496. fi
  497. if [ -f /var/log/syslog ]; then
  498. TAR_FILES="$TAR_FILES /var/log/syslog"
  499. fi
  500. [ -f $TARBALL_OUTPUT ] && rm -rf $TARBALL_OUTPUT
  501. [ -f $TARBALL_OUTPUT.gz ] && rm -rf $TARBALL_OUTPUT.gz
  502. echo "tarring: tar -chvf ${TARBALL_OUTPUT} $TAR_FILES"
  503. cd $HOME && tar -chvf $TARBALL_OUTPUT $TAR_FILES
  504. echo "gzipping $TARBALL_OUTPUT"
  505. gzip $TARBALL_OUTPUT
  506. }
  507. collect()
  508. {
  509. echo "This may take up to half a minute to run. Please be patient."
  510. collect_digiuminfo;
  511. collect_config_backup;
  512. # ensure the output was written
  513. if [ -f $TARBALL_OUTPUT.gz ]; then
  514. clear;
  515. echo;
  516. echo;
  517. echo "Tarball has been stored to:"
  518. echo "$TARBALL_OUTPUT.gz"
  519. echo "Please send this file to an email case you already"
  520. echo "have open with Digium Tech Support."
  521. else
  522. echo;
  523. echo;
  524. echo "An error has occurred in capturing information."
  525. echo "$TARBALL_OUTPUT.gz was not found."
  526. echo;
  527. echo "Please investigate your system, and send the output"
  528. echo "above to your Digium Technical Support Ticket."
  529. fi
  530. }
  531. clear;
  532. if [ $NONINTERACTIVE -eq 1 ]; then
  533. collect;
  534. else
  535. echo
  536. echo "This script will try to collect the following pieces of"
  537. echo "information from your system."
  538. echo
  539. echo "1. Information about your system such as:"
  540. echo "pci listing, dmesg, running processes, and kernel version"
  541. echo
  542. echo "2. A backup of elements of your configuration such as:"
  543. echo "asterisk config files, license files, loaded dahdi module"
  544. echo "parameters, and other asterisk/dahdi related files."
  545. echo
  546. echo "Collect this information [y/n] ? "
  547. read files;
  548. if [ "$files" = "y" ] || [ "$files" = "yes" ]; then
  549. collect;
  550. else
  551. clear;
  552. echo;
  553. echo "User selected not to continue."
  554. fi
  555. fi
  556. exit