~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to tools/report.collector

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-07-16 16:40:24 UTC
  • mfrom: (1.1.11) (2.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130716164024-lvwrf4xivk1wdr3c
Tags: 1.1.9+git20130321-1ubuntu1
* Resync from debian expiremental.
* debian/control:
  - Use lower version for Build-Depends on libcorosync-dev
    and libqb-dev.
  - Build-Depends on libcfg-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 #                      Almost everything as part of hb_report
3
3
 # Copyright (C) 2010 Andrew Beekhof <andrew@beekhof.net>
4
4
 #                      Cleanups, refactoring, extensions
5
 
 # 
 
5
 #
6
6
 # This program is free software; you can redistribute it and/or
7
7
 # modify it under the terms of the GNU General Public
8
8
 # License as published by the Free Software Foundation; either
9
9
 # version 2.1 of the License, or (at your option) any later version.
10
 
 # 
 
10
 #
11
11
 # This software is distributed in the hope that it will be useful,
12
12
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
14
 # General Public License for more details.
15
 
 # 
 
15
 #
16
16
 # You should have received a copy of the GNU General Public
17
17
 # License along with this library; if not, write to the Free Software
18
18
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 #
20
20
 
21
 
if 
 
21
if
22
22
    echo $REPORT_HOME | grep -qs '^/'
23
23
then
24
24
    debug "Using full path to working directory: $REPORT_HOME"
67
67
}
68
68
 
69
69
find_files() {
70
 
    dirs=$1
 
70
    dirs=
71
71
    from_time=$2
72
72
    to_time=$3
 
73
    for d in $1; do
 
74
        if [ -d $d ]; then
 
75
           dirs="$dirs $d"
 
76
        fi
 
77
    done
 
78
 
 
79
    if [ x"$dirs" = x ]; then
 
80
        return
 
81
    fi
 
82
 
73
83
    isnumber "$from_time" && [ "$from_time" -gt 0 ] || {
74
84
        warning "sorry, can't find files in [ $1 ] based on time if you don't supply time"
75
85
        return
212
222
 
213
223
    crm_uuid -r > $target/$HB_UUID_F 2>&1
214
224
 
215
 
    if 
 
225
    if
216
226
        ps -ef | egrep -qs [c]rmd
217
227
    then
218
228
        crm_mon -1 2>&1 | grep -v '^Last upd' > $target/$CRM_MON_F
265
275
    file=$1
266
276
    compress=""
267
277
    if [ -z "$SANITIZE" ]; then
268
 
        return 
 
278
        return
269
279
    fi
270
280
    echo $file | grep -qs 'gz$' && compress=gzip
271
281
    echo $file | grep -qs 'bz2$' && compress=bzip2
328
338
        pkg_mgr="deb"
329
339
    elif which rpm >/dev/null 2>&1 ; then
330
340
        pkg_mgr="rpm"
331
 
    elif which pkg_info >/dev/null 2>&1 ; then 
 
341
    elif which pkg_info >/dev/null 2>&1 ; then
332
342
        pkg_mgr="pkg_info"
333
 
    elif which pkginfo >/dev/null 2>&1 ; then 
 
343
    elif which pkginfo >/dev/null 2>&1 ; then
334
344
        pkg_mgr="pkginfo"
335
345
    else
336
346
        warning "Unknown package manager"
407
417
    fi
408
418
}
409
419
 
 
420
getblackboxes() {
 
421
    flist=$(
 
422
        find_files $BLACKBOX_DIR $1 $2
 
423
    )
 
424
 
 
425
    for bb in $flist; do
 
426
        bb_short=`basename $bb`
 
427
        qb-blackbox $bb &> $3/${bb_short}.blackbox
 
428
        info "Extracting contents of blackbox: $bb_short"
 
429
    done
 
430
}
 
431
 
410
432
#
411
433
# some basic system info and stats
412
434
#
439
461
 
440
462
    # Cluster glue version hash (if available)
441
463
    stonith -V 2>/dev/null
442
 
    
 
464
 
443
465
    # Resource agents version hash
444
466
    echo "resource-agents: `grep 'Build version:' /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs`"
445
467
 
472
494
        echo NOTICE - Lockspace overview:
473
495
        dlm_tool ls
474
496
        dlm_tool ls | grep name |
475
 
        while read X N ; do 
 
497
        while read X N ; do
476
498
            echo NOTICE - Lockspace $N:
477
499
            dlm_tool lockdump $N
478
500
        done
551
573
    if [ "x$facility" = x ]; then
552
574
        facility=`getcfvar $cf_type $facility_var $cf_file`
553
575
        [ "" = "$facility" ] && facility="daemon"
554
 
        if [ "none" = "$facility" ]; then
555
 
            fatal "No logging is configured"
556
 
        fi
557
 
        msg="Mark:pcmk:`perl -e 'print time()'`"
558
 
        logger -p $facility.info $msg >/dev/null 2>&1
559
 
        sleep 2 # Give syslog time to catch up in case its busy
560
 
        findmsg 1 "$msg"
561
 
    fi
 
576
    fi
 
577
    if [ "x$facility" = x ]; then
 
578
        facility="daemon"
 
579
    fi
 
580
 
 
581
    # Always include system logs (if we can find them)
 
582
    msg="Mark:pcmk:`perl -e 'print time()'`"
 
583
    logger -p $facility.info $msg >/dev/null 2>&1
 
584
    sleep 2 # Give syslog time to catch up in case its busy
 
585
    findmsg 1 "$msg"
 
586
 
 
587
    # Initial pacemakerd logs and tracing might also go to a file (other than the syslog log file)
 
588
    findmsg 3 "Starting Pacemaker"
 
589
 
 
590
    # Make sure we get something from the Policy Engine
 
591
    findmsg 3 "Calculated Transition"
562
592
}
563
593
 
564
594
essential_files() {
565
595
        cat<<EOF
566
596
d $HA_STATE_DIR 0755 root root
567
597
d $PE_STATE_DIR 0750 hacluster haclient
 
598
d $CRM_CONFIG_DIR 0750 hacluster haclient
568
599
d $CRM_STATE_DIR 0750 hacluster haclient
569
600
EOF
570
601
    case $1 in
601
632
fi
602
633
 
603
634
if [ $SEARCH_LOGS = 1 ]; then
604
 
    logfiles=`get_logfiles $cluster "$cluster_cf" "$logd_cf"`
 
635
    logfiles=`get_logfiles $cluster "$cluster_cf" "$logd_cf" | sort -u`
605
636
fi
606
637
 
607
638
if [ -z "$logfiles" ]; then
611
642
 
612
643
sys_info $cluster $PACKAGES > $SYSINFO_F
613
644
essential_files $cluster | check_perms  > $PERMISSIONS_F 2>&1
614
 
getconfig $cluster "$REPORT_HOME/$REPORT_TARGET" "$cluster_cf" "$logd_cf" "$HA_STATE_DIR/crm/$CIB_F" "$HA_STATE_DIR/hostcache" "/etc/drbd.conf" "/etc/drbd.d"
 
645
getconfig $cluster "$REPORT_HOME/$REPORT_TARGET" "$cluster_cf" "$logd_cf" "$CRM_CONFIG_DIR/$CIB_F" "$HA_STATE_DIR/hostcache" "/etc/drbd.conf" "/etc/drbd.d"
615
646
 
616
647
getpeinputs    $LOG_START $LOG_END $REPORT_HOME/$REPORT_TARGET
617
648
getbacktraces  $LOG_START $LOG_END > $REPORT_HOME/$REPORT_TARGET/$BT_F
 
649
getblackboxes  $LOG_START $LOG_END $REPORT_HOME/$REPORT_TARGET
618
650
 
619
651
case $cluster in
620
652
    cman|corosync)
621
 
        if 
 
653
        if
622
654
            ps -ef | egrep -qs '[c]orosync'
623
655
        then
624
 
            corosync-blackbox > corosync-blackbox-live.txt
 
656
            corosync-blackbox &> corosync-blackbox-live.txt
625
657
        fi
626
 
        corosync-fplay > corosync-blackbox.txt
 
658
#       corosync-fplay > corosync-blackbox.txt
627
659
 
628
660
        tool=`pickfirst corosync-objctl corosync-cmapctl`
629
661
        case $tool in
630
 
            *objctl)  $tool -a > corosync.dump;;
631
 
            *cmapctl) $tool    > corosync.dump;;
 
662
            *objctl)  $tool -a > corosync.dump  2>/dev/null;;
 
663
            *cmapctl) $tool    > corosync.dump  2>/dev/null;;
632
664
        esac
633
665
        ;;
634
666
esac
681
713
rm -f $pattfile
682
714
trap "" 0
683
715
 
684
 
# Purge files containing no information 
 
716
# Purge files containing no information
685
717
for f in `ls -1`; do
686
718
    if [ -d "$f" ]; then
687
719
        continue
702
734
    # Link the first logfile to a standard name if it doesn't yet exist
703
735
    f=`basename $l`
704
736
    if [ -e $f -a ! -e $HALOG_F ]; then
705
 
        ln -s $f $HALOG_F 
 
737
        ln -s $f $HALOG_F
706
738
    fi
707
739
done
708
740
 
714
746
        rm -rf $REPORT_HOME
715
747
    fi
716
748
fi
717