• Scripts, VCS, Vertias 11-25-2010 Comments Off
    #!/bin/sh
    #
    # parmanand patram; 2010-11-25
    # find and clear faulted VCS resource
    #
    # This script takes a list of VCS resource groups
    # and clears any FAULTED states in the cluster.
    # ex.
    # clear_VCS_faulted.sh 'GROUP1 GROUP2 ...'
    
    VCS_GROUPS=$1
    VCS_BINPATH=/opt/VRTSvcs/bin
    
    for VCS_GROUP in ${VCS_GROUPS}
    do
            # hares will show all resources of this group that are faulted
            # but we will only need to clear based on the unique hostname
            for SYS in `${VCS_BINPATH}/hares -display -group ${VCS_GROUP} -attribute State | grep FAULTED | awk '{print $3}' | sort | uniq`
            do
            #echo ${VCS_BINPATH}/hares -display -group ${VCS_GROUP} -attribute State | grep FAULTED
            ${VCS_BINPATH}/hagrp -clear ${VCS_GROUP} -sys ${SYS}
            done
    done
  • Big Brother, Monitoring, Solaris 11-23-2010 Comments Off
    #!/bin/sh
    
    # ext-proto
    #
    # BIG BROTHER - PROTOTYPE EXTERNAL SCRIPT
    # Sean MacGuire
    # Version 1.9
    # Mar 13th, 2002
    #
    # (c) Copyright Quest Software, Inc.  1997-2002  All rights reserved.
    #
    # Adapted to test RAID on Sun boxes (either raidctl or metastat or both)
    # parmanand patram
    # Nov 23rd 2010.
    
    #
    # SCRIPTS IN THE BBHOME/ext DIRECTORY ARE ONLY RUN IF
    # THEY ARE DEFINED IN THE ENTRY FOR THE CURRENT HOST
    # LISTED IN THE ext/bb-bbexttab FILE.
    #
    
    ################################### SETUP #############################
    #
    # root must run a crontab like every 5 minutes to provide raidctl output
    # 0,15,30,45 * * * * for VOLUME in `/usr/sbin/raidctl -l| grep Volume: | awk -F':' '{print $2}'`; do /usr/sbin/raidctl -l $VOLUME > /tmp/raidctl_${VOLUME}_txt; done >/dev/null 2>&1
    #
    # Additional setup is as 'normal' bb extension test.
    
    #
    # BBPROG SHOULD JUST CONTAIN THE NAME OF THIS FILE
    # USEFUL WHEN YOU GET ENVIRONMENT DUMPS TO LOCATE
    # THE OFFENDING SCRIPT...
    #
    BBTEST="RAID"
    BBPROG=$0; export BBPROG
    
    #
    # BBHOME CAN BE SET MANUALLY WHEN TESTING.
    # OTHERWISE IT SHOULD BE SET FROM THE BB ENVIRONMENT
    #
    # BBHOME=/home/sean/bb; export BBHOME   # FOR TESTING
    
    if test "$BBHOME" = ""
    then
            echo "BBHOME is not set... exiting"
            exit 1
    fi
    
    if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
    then
             # echo "*** LOADING BBDEF ***"
            . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
    fi
    
    #
    # NOW COLLECT SOME DATA
    # IN THIS CASE, IT'S THE STATUS OF THE RAID CHECKED BY raidctl AND metastat
    # FOR MONTREAL, QUEBEC
    
    # SELECT SOME LEVELS... GREEN IS THE DEFAULT...
    
    WARN='undef'       # this test will never have a warning. RAID is either OK or not OK.
    PANIC='yes'      # GO RED AND PAGE if FAILURE is set to 'yes'
    
    # zero out the output file
    cat /dev/null > $BBTMP/$BBTEST
    
    # perform the raidctl tests
    COLOR="green"
    
    # IMPORTANT: user bb cannot run raidctl, so root must run a cron script to dump out
    # raidctl info for each volume into /tmp/raidctl_VOLUME_txt
    
    for VOLUME_FILE in `ls /tmp/raidctl_c*t*d*_txt`; do
    
            VOLUME=`echo $VOLUME_FILE | awk -F'_' '{print $2}'`
            TEST=`cat $VOLUME_FILE | egrep -v '^c|^Volume|Sub|Disk|-' | grep -v GOOD`
            if [ "$TEST" = '' ]; then      #disk is 'GOOD'
                    echo "OK for RAID volume $VOLUME" >> /$BBTMP/$BBTEST
                    cat $VOLUME_FILE >> /$BBTMP/$BBTEST
                    echo "-----------------------------------------" >> /$BBTMP/$BBTEST
            else    # disk has problems
                    COLOR="red"
                    echo "FAILURE on RAID volume $VOLUME" >> /$BBTMP/$BBTEST
                    cat $VOLUME_FILE >> /$BBTMP/$BBTEST
                    echo "-------------> ${TEST} <-----------------" >> /$BBTMP/$BBTEST
            fi
    done
    
    # perform the metastat tests
    for MIRROR in `/sbin/metastat | grep Mirror | awk -F':' '{print $1}'`; do
            TEST=`/sbin/metastat $MIRROR | grep 'State:' | grep -v Okay`
            if [ "$TEST" = '' ]; then      #mirror id OK
                    echo "RAID mirror $MIRROR OK:"
                            /sbin/metastat $MIRROR >> /$BBTMP/$BBTEST
                    echo "-----------------------------------------" >> /$BBTMP/$BBTEST
            else    # disk has problems
                    COLOR="red"
                    echo "FAILURE in RAID mirror $MIRROR" >> /$BBTMP/$BBTEST
                            /sbin/metastat $MIRROR >> /$BBTMP/$BBTEST
                    echo "-------------> ${TEST} <-----------------" >> /$BBTMP/$BBTEST
            fi
    done
    
    #
    # AT THIS POINT WE HAVE OUR RESULTS.  NOW WE HAVE TO SEND IT TO
    # THE BBDISPLAY TO BE DISPLAYED...
    #
    
    # MACHINE NAME MUST EITHER BE A REAL MACHINE NAME, OR
    # LOOK LIKE A REAL MACHINE (in the case of arbitrary measurements
    # like temperature).  IF THE NAME YOU ARE USING DOESN'T EXIST
    # IN THE DNS THEN IT SHOULD BE LISTED IN THE bb-hosts FILE WITH noping,
    # PREFERABLY IN IT'S OWN GROUP...
    
    MACHINE="`hostname`"
    
    #
    # THE FIRST LINE IS STATUS INFORMATION... STRUCTURE IMPORANT!
    # THE REST IS FREE-FORM - WHATEVER YOU'D LIKE TO SEND...
    #
    LINE="status $MACHINE.$TEST $COLOR `date`
    RAID staus of disks
    `cat /$BBTMP/$BBTEST`
    
    # NOW USE THE BB COMMAND TO SEND THE DATA ACROSS
    $BB $BBDISP "$LINE"                     # SEND IT TO BBDISPLAY
    
  • SQL & PL/SQL, SQLPLUS, Scripts 11-15-2010 Comments Off

    #!/bin/bash

    #
    # login to database and run a query

    SQL_HOME=WHERE
    LOG_HOME=WHERE
    SQL_USER=WHAT
    SQL_PASS=WHAT
    SQL_HOST=WHAT
    SQL_DB=WHAT
    SQL_PORT=1521
    LOGFILE=${SQL_HOME}/output.log

    SQL_LOGIN_STR=”${SQL_HOME}/sqlplus -S ${SQL_USER}/${SQL_PASS}@${SQL_HOST}:${SQL_PORT}/${SQL_DB} ”

    cd $SQL_HOME

    RESULT=`${SQL_LOGIN_STR} << EOF
    SET HEADING OFF
    SELECT NAME FROM V\\$DATABASE;
    exit;
    EOF`

    if [ $RESULT == $SQL_DB ]; then
    echo `date`”: OK: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
    else
    echo `date`”: Got Error: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
    fi

  • Big Brother, Monitoring 11-08-2010 Comments Off

    \x00\x57\x00\x00\x01\x00\x00\x00\x01\x36\x01\x2C\x00\x00\x08\x00\x7F\xFF\xA3\x0A\x00\x00\x01\x00\x00\x1D\x00\x3A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00(CONNECT_DATA=(COMMAND=ping))

  • VCS, Vertias 11-08-2010 Comments Off

    /etc/VRTSvcs/conf/config/main.cf