Thursday 6 October 2016

script for single solaris zone from global zone only?

# cat zonesinfo.sh
#!/bin/bash
#########################################
######### ################SCRIPT#######
##########Zones INFO##############
#####VERSION=1.0############################
##DESIGN&IMPLEMENTED:CHITTIBABU MIRIYALA#
#########################################
echo "From:chitti.babu@gmail.com" >"/tmp/output1"
echo "To:chitti.babu@yahoo.com" >"/tmp/output1"
echo "Subject:ZONES CONFIGURATION INFO:`uname -n` ">>"/tmp/output1"
echo "Content-type: text/html">>/tmp/output1
echo "<html>">>"/tmp/output1"
echo "<body>">>"/tmp/output1"
echo "<table bgcolor="#e7f5fe" width=100% border='3'>">>"/tmp/output1"
echo "<tr bgcolor="#FFA500"> <td colspan="4"><center><H3> GLOBAL ZONE  INFORMATION </H3></center></td> <td colspan="4"><center><H3> LOCAL ZONE  INFORMATION </H3></center></td></tr>" >>"/tmp/output1"
echo "<tr bgcolor="#d1c4e9"> <td><center><H3>HOST NAME   </H3></center></td><td><center><H3> IPADDRESS  </H3></center></td><td><center><H3> VCPU  </H3></center></td><td><center><H3> RAM  </H3></center></td> <td><center><H3>HOST NAME   </H3></center></td><td><center><H3> IPADDRESS  </H3></center></td><td><center><H3> VCPU  </H3></center></td><td><center><H3> RAM  </H3></cent
er></td> </tr>" >>"/tmp/output1"
HOSTNAME=`uname -n`
echo "<td >"$HOSTNAME"</td>" >>"/tmp/output1"
IPAD=`cat /etc/hosts|grep $HOSTNAME|awk '{print $1}'`
echo "<td >"$IPAD"</td>" >>"/tmp/output1"
echo "<td >"`psrinfo|wc -l`"</td>" >>"/tmp/output1"
echo "<td>"`prtconf|grep -i "Memory size" |awk -F: '{print $2}'`"</td>" >>"/tmp/output1"
ZoneName=`/usr/sbin/zoneadm list -cv|grep -v "NAME"|grep -v "global"|awk '{print $2}'`
zonecfg -z $ZoneName info >/tmp/zoneinfo.output
echo "<td>"`cat /tmp/zoneinfo.output|grep zonename|awk -F: '{ print $2 }'`"</td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep address|awk -F: '{ print $2 }'`"</td>" >>"/tmp/output1"
CPU=`ssh -q $ZoneName 'psrinfo|wc -l'`
#echo "<td>"`cat /tmp/zoneinfo.output|grep cpu-shares|grep -v 'name'|tr -d "[ ]"|awk -F: '{ print $2 }'`"</td>" >>"/tmp/output1"
echo "<td>"$CPU"</td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep physical|grep -v vnet|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "</table>" >>"/tmp/output1"
echo "<table bgcolor="#e7f5fe" width=100% border='3'>">>"/tmp/output1"
echo "<tr bgcolor="#FFA500"> <td colspan="2"><center><H3> GLOBAL ZONE  INFORMATION </H3></center></td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9"><b> ZONE NAME </b> </td>" >>"/tmp/output1"
echo "<td>"Global"</td></tr>" >>"/tmp/output1"
echo "<tr><td colspan='2' bgcolor="#d1c4e9"><b> RUNNING ZONES INFORMATION </b> </td></tr>" >>"/tmp/output1"
echo "<tr><pre><td colspan='2'>" >>"/tmp/output1"
/usr/sbin/zoneadm list -cv >>"/tmp/output1"
echo "</pre></td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9"><b> RAM SIZE</b> </td>" >>"/tmp/output1"
echo "<td>"`prtconf|grep -i "Memory size" |awk -F: '{print $2}'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9" colspan='2'><b> UPTIME , KERNEL VERSION  </b> </td>" >>"/tmp/output1"
echo "<tr><td colspan='2'>"`uptime`"</td></tr>" >>"/tmp/output1"
echo "<tr><td colspan='2'>"`uname -a`"</td></tr>" >>"/tmp/output1"
echo "<tr><td  bgcolor="#d1c4e9" colspan='2'><b> CPU INFORMATION  </b> </td></tr>" >>"/tmp/output1"
echo "<tr><pre><td colspan='2'>" >>"/tmp/output1"
psrinfo >>"/tmp/output1"
echo "</pre></td></tr>" >>"/tmp/output1"
echo "<tr><td  bgcolor="#d1c4e9" colspan='2'><b> FILE SYSTEM INFORMATION  </b> </td></tr>" >>"/tmp/output1"
echo "<tr><pre><td colspan='2'>" >>"/tmp/output1"
df -h >>"/tmp/output1"
echo "</pre></td></tr>" >>"/tmp/output1"
echo "</table>" >>"/tmp/output1"
echo "<table bgcolor="#e7f5fe" width=100% border='3'>">>"/tmp/output1"
echo "<tr bgcolor="#FFA500"> <td colspan="2"><center><H3> LOCAL ZONES  INFORMATION </H3></center></td></tr>" >>"/tmp/output1"
#ZoneName=`/usr/sbin/zoneadm list -cv|grep -v "NAME"|grep -v "global"|awk '{print $2}'`
#echo $ZoneName
#zonecfg -z $ZoneName info >/tmp/zoneinfo.output
echo "<tr><td bgcolor="#d1c4e9"><b> INSTALLED ZONE NAME </b> </td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep zonename|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9"><b> INSTALLED ZONE PATH </b> </td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep zonepath|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td  bgcolor="#d1c4e9" colspan='2'><b>ZONES UPTIME , KERNEL VERSION  </b> </td>" >>"/tmp/output1"
echo "<tr><td colspan='2'>"`ssh -q $ZoneName  'uptime'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td colspan='2'>"`ssh -q $ZoneName  'uname -a'`"</td></tr>" >>"/tmp/output1"
#echo "<tr><td bgcolor="#d1c4e9"><b> NUMBER OF CPUS </b> </td></tr>" >>"/tmp/output1"
#echo "<td>"`cat /tmp/zoneinfo.output|grep cpu-shares|grep -v 'name'|tr -d "[ ]"|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9"><b> SHARED RAM SIZE</b> </td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep physical|grep -v vnet|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9"><b> SHARED SWAP SIZE</b> </td>" >>"/tmp/output1"
echo "<td>"`cat /tmp/zoneinfo.output|grep swap|grep -v 'name'|tr -d "[ ]"|awk -F: '{ print $2 }'`"</td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9" colspan='2'><b> SHARED  FILE SYSTEM INFORMATION  </b> </td></tr>" >>"/tmp/output1"
echo "<tr><pre><td colspan='2'>" >>"/tmp/output1"
ssh -q $ZoneName  'df -h' >>"/tmp/output1"
echo "</pre></td></tr>" >>"/tmp/output1"
echo "<tr><td bgcolor="#d1c4e9" colspan='2'><b> SHARED RESOURCE  INFO  </b> </td></tr>" >>"/tmp/output1"
echo "<tr><pre><td colspan='2'>" >>"/tmp/output1"
/usr/sbin/zonecfg -z $ZoneName info >>"/tmp/output1"
echo "</pre></td></tr>" >>"/tmp/output1"
echo "</table>" >>"/tmp/output1"
echo "</body>">>"/tmp/output1"
echo "</html>">>"/tmp/output1"
cat "/tmp/output1"|/usr/sbin/sendmail -t
>"/tmp/output1"
#

how to upgrade QLOGIC Firmware in T4 series servers / Q-logic SAN SURFER?

How to install SANSURFER in solaris11

to download pkg:-
http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/DefaultNewSearch.aspx
select model & click Go
download both
1)Boot Code
2)Management Tools for Solaris

============To configure iso local repository in solaris 11=====

#mkdir /var/tmp/patch/QLOGIC

#pkgrepo create /var/tmp/patch/QLOGIC

#cd /var/tmp/patch/QLOGIC
                                                                                                                                        
#ls
pkg5.repository

#pkgrecv -s /var/tmp/patch/QConvergeConsoleCLI/QConvergeConsoleCLI-1.1.03-38-solaris-sparc.p5p -d QLOGIC qaucli
Processing packages for publisher qlogic ...
Retrieving and evaluating 1 package(s)...
PROCESS                                         ITEMS    GET (MB)   SEND (MB)
Completed                                         1/1     7.2/7.2   32.5/32.5

#pkg set-publisher -p file:///var/tmp/patch/QLOGIC  qlogic
pkg set-publisher:
  Added publisher(s): qlogic

#pkg install qaucli
           Packages to install:  1
            Services to change:  1
       Create boot environment: No
Create backup boot environment: No

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1       297/297      7.2/7.2    0B/s

PHASE                                          ITEMS
Installing new actions                       515/515
Updating package state database                 Done
Updating package cache                           0/0
Updating image state                            Done
Creating fast lookup database                   Done
Updating package cache                           2/2





before patch

=====================to see info================

Enter a file name or Hit <RETURN> to abort: /var/tmp/patch/q8q20404.bin
Installed flash version      : 02.04.04.00
To be installed flash version: 02.04.04.00

root@ucuxcontrol6s:/root =#qaucli
Using config file: /opt/QLogic_Corporation/QConvergeConsoleCLI/qaucli.cfg
Installation directory: /opt/QLogic_Corporation/QConvergeConsoleCLI
Working dir: /root
Using config file: /opt/QLogic_Corporation/QConvergeConsoleCLI/netscli.cfg
Loading CNA Data ...
Loading:  1. CNA ...
Loading:  1. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  1. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  2. CNA ...
Loading:  2. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  2. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  3. CNA ...
Loading:  3. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  3. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  4. CNA ...
Loading:  4. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  4. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Refreshing interfaces ... Please wait ...




        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Main Menu

    1:  Adapter Information
    2:  Adapter Configuration
    3:  Adapter Updates
    4:  Adapter Diagnostics
    5:  Adapter Statistics
    6:  FabricCache CLI
    7:  Refresh
    8:  Help
    9:  Exit


        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Adapter Type Selection

    1:  Converged Network Adapter


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Converged Network Adapter Information

    1:  CNA Adapter Information
    2:  CNA Port Information
    3:  CNA VPD Information
    4:  CNA NIC Information
    5:  CNA FCoE Information
    6:  CNA Port Target/LUN Information


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    CNA Adapter Information

     1: CNA Model: QEM8152  SN: 0402L00-1132991806
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     2: CNA Model: QEM8152  SN: 0402L00-1142004006
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     3: CNA Model: QEM8152  SN: 0402L00-1142004196
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     4: CNA Model: QEM8152  SN: 463916H+1342041987
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    CNA Adapter Information

    1:  NIC
    2:  FCoE


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 2
--------------------------------------------------------------------------------
Host Name                      : ucuxcontrol6s
HBA Model                      : QEM8152
Device ISP ID                  : ISP8001
Chip Revision                  : 0x2(A1)
HBA Description                : QEM8152 SUN PCI Express to 10 GbE Dual Channel CNA (FCoE)
HBA Alias                      :
Serial Number                  : 0402L00-1132991806
Driver Version                 : qlc-160208-5.05
Running Firmware Version       : 8.03.00
Flash Image Version            : 020014
PCI Bus Number                 : 65
PCI Device Number              : 0
PCI Function Number            : 3
--------------------------------------------------------------------------------

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    CNA Adapter Information

    1:  NIC
    2:  FCoE


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1
--------------------------------------------------------------------------------
Hostname                    : ucuxcontrol6s
Adapter Model               : QEM8152
Device ISP ID               : ISP8000
Chip Revision               : A1
Adapter Alias               : None
Serial Number               : 0402L00-1132991806
MAC Address Function 1      : 00:c0:dd:1d:88:b4
MAC Address Function 1      : 00:c0:dd:1d:88:b6
Driver Version              : Unknown
MPI Firmware Version        : 1.40.04
Flash Package Version       : 2.0.14
PXE Boot Version            : 01.14
FCoE Driver Version         : qlc-160208-5.05
FCoE Firmware Version       : 8.03.00
FCoE SDMAPI Version         : 7.02 Build 3
--------------------------------------------------------------------------------




=============to upgrade================

 Main Menu

    1:  Adapter Information
    2:  Adapter Configuration
    3:  Adapter Updates
    4:  Adapter Diagnostics
    5:  Adapter Statistics
    6:  FabricCache CLI
    7:  Refresh
    8:  Help
    9:  Exit


        Please Enter Selection: 3

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Adapter Type Selection

    1:  Converged Network Adapter


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection:
Invalid selection!

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Adapter Type Selection

    1:  Converged Network Adapter


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    CNA Adapter Update

    1:  Flash Update
    2:  Parameters Update
    3:  MPI Config Table Update
    4:  FW Preload Table Update
    5:  FW Serdes Table Update
    6:  FW Mini Dump


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1

        QConvergeConsole

        CLI - Version 1.1.3 (Build 38)

    Flash Update

     1: CNA Model: QEM8152  SN: 0402L00-1132991806
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     2: CNA Model: QEM8152  SN: 0402L00-1142004006
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     3: CNA Model: QEM8152  SN: 0402L00-1142004196
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]
     4: CNA Model: QEM8152  SN: 463916H+1342041987
          Port   1 [Protocol(s): NIC FCoE]
          Port   2 [Protocol(s): NIC FCoE]


        (p or 0: Previous Menu; m or 98: Main Menu; ex or 99: Quit)
        Please Enter Selection: 1
Enter a file name or Hit <RETURN> to abort: /var/tmp/patch/q8q20404.bin
Installed flash version      : 02.00.14.00
To be installed flash version: 02.04.04.00
Load Flash (Boot & Firmware images)? (yes, no) [yes]: yes
NOTE: Boot From SAN mode is enabled, so card reset must not happen.
Loading file /var/tmp/patch/q8q20404.bin, please wait ...

Successfully updated flash (Boot & Firmware images).
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!                                                                  !!!
!!! Flash update was successful.                                     !!!
!!! Reboot of Operating system is required to activate flash update. !!!
!!!                                                                  !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Using config file: /opt/QLogic_Corporation/QConvergeConsoleCLI/netscli.cfg
Loading:  1. CNA ...
Loading:  1. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  1. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  2. CNA ...
Loading:  2. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  2. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  3. CNA ...
Loading:  3. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  3. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Loading:  4. CNA ...
Loading:  4. CNA Physical Port : 1 (Index :  1) Function ID :  0 ...
Loading:  4. CNA Physical Port : 2 (Index :  2) Function ID :  1 ...
Refreshing interfaces ... Please wait ...


================infor after upgrade==========

--------------------------------------------------------------------------------
Host Name                      : ucuxcontrol6s
HBA Model                      : QEM8152
Device ISP ID                  : ISP8001
Chip Revision                  : 0x2(A1)
HBA Description                : QEM8152 SUN PCI Express to 10 GbE Dual Channel CNA (FCoE)
HBA Alias                      :
Serial Number                  : 0402L00-1132991806
Driver Version                 : qlc-160208-5.05
Running Firmware Version       : 8.03.00
Flash Image Version            : 020404
PCI Bus Number                 : 65
PCI Device Number              : 0
PCI Function Number            : 3
--------------------------------------------------------------------------------

Solaris servers Check Availability script


1)in this script we have server-client technology
2)server(central server which can login in to other servers with out passwords) can collect information from clients & push to users
3)client script will be placed on all clients & generate information(Nodename,kernel release,uptime,last reboot,status)
4)keep maintain all servers need to collect information in solaris_list file


client script

# cat client.sh
#!/bin/bash
############################################################
###########################################################
###SOLARIS SERVERS AVAILABILITY CHECK##################################
###version 1.0##########################################
####designed: CHITTI BABU MIRIYALA################
###############################################
#!/bin/bash
NODE_NAME=`uname -n`
KERNEL_REL=`uname -v`
UP_TM=`uptime|awk -F"," '{print $1}'`
LST_BOT=`who -b|awk '{print $4, $5 ,$6}'`
echo "<td>$NODE_NAME</td><td>$KERNEL_REL</td><td>$UP_TM</td><td>$LST_BOT</td><td>Available</td></tr>"



server script

# cat server_live.sh
#!/bin/bash
############################################################
###########################################################
###SOLARIS SERVERS AVAILABILITY CHECK##################################
###version 1.0##########################################
####designed: CHITTI BABU MIRIYALA################
###############################################
>/tmp/server_health_output1
echo "From:chitti.babu@gmail.com" >"/tmp/server_health_output1"
echo "To:chitti.babu@yahoo.com">>"/tmp/server_health_output1"
>>"/tmp/server_health_output1"
echo "Subject:SOLARIS SERVERS AVAILABILITY CHECK">>"/tmp/server_health_output1"
echo "Content-type: text/html">>"/tmp/server_health_output1"
echo "<html>">>"/tmp/server_health_output1"
echo "<body>">>"/tmp/server_health_output1"
echo "<table width=100%>">>"/tmp/server_health_output1"
echo "<tr BGCOLOR="#33ffec"><td colspan=6><h4><center> SOLARIS SERVERS AVAILABILITY STATUS </h4></td></tr>">>"/tmp/server_health_output1"
echo "<tr BGCOLOR="#FFFF00"><td> <h5>NODE IP ADDRESS </h5> </td><td> <h5>NODE NAME</h5> </td><td> <h5>KERNEL VERSION</h5></td><td> <h5>UP TIME</h5> </td><td> <h5>LAST REBOOTED</h5></td><td><h5>SERVER STATUS</h5> </td></tr>">>"/tmp/server_health_output1"
for i in `cat /opt/scripts/solaris_list`
do
#ping -q -c 1 $i > /tmp/null
ping -p 22 $i > /tmp/null
if [ $? -eq 0 ]
then

echo "<tr BGCOLOR="#00FF00"><td> $i</td>">>"/tmp/server_health_output1"
        ssh -q $i  '/bin/bash /opt/scripts/client.sh' >>"/tmp/server_health_output1"
else

echo "<tr BGCOLOR="#FF0000"><td colspan=6> $i SERVER NOT REACHBLE NEED ADMIN HELP</td></tr>">>"/tmp/server_health_output1"
fi
done
echo "</table>" >>"/tmp/server_health_output1"
echo "</body>">>"/tmp/server_health_output1"
echo "</html>">>"/tmp/server_health_output1"
cat "/tmp/server_health_output1"|/usr/sbin/sendmail -t
#cat "/tmp/server_health_output1"|mail "chitti.babu@gmail.com"
>"/tmp/server_health_output1"