Skip to main content

Posts

Showing posts from October, 2013

rename DRAC from CLI OS

For some reason, a number of our physical hosts do not have their DRACs configured correctly, or according to our standard. I wrote this script to clean them up. #!/bin/bash # Desc:  This horribly assembled bit of scripting is intended to configure the DRAC using #        a few basic fundamental configuration variables. #        The end result should be a host DRAC that is reachable via #        <hostname>.mgmt.company.com # A few helpful commands to review: # /opt/dell/srvadmin/bin/idracadm7 getconfig -g cfgLanNetworking # /opt/dell/srvadmin/bin/idracadm config -g cfgLanNetworking -o cfgDNSRacName `hostname -s` yum -y install srvadmin-all srvadmin-idrac7 ls /opt/dell/srvadmin/bin/idracadm && myDRAC="/opt/dell/srvadmin/bin/idracadm" ls /opt/dell/srvadmin/bin/idracadm7 && myDRAC="/opt/dell/srvadmin/bin/idracadm7" if [ -z $myDRAC ] then   echo "ERRO...

DRAC and OpenIPMI

DISCLAIMER:  The majority of the page was most definitely stolen from http://www.openfusion.net/tags/dell - Gavin Carr invested a bit of time in to creating this information.  I am making my own copy just in case his disappears someday. Spent a few days deep in the bowels of a couple of datacentres last week, and realised I didn't know enough about Dell's DRAC base management controllers to use them properly. In particular, I didn't know how to mess with the drac settings from within the OS. So spent some of today researching that. Turns out there are a couple of routes to do this. You can use the Dell native tools (e.g. racadm ) included in Dell's OMSA product , or you can use vendor-neutral IPMI , which is well-supported by Dell DRACs. I went with the latter as it's more cross-platform, and the tools come native with CentOS, instead of having to setup Dell's OMSA repositories. The Dell-native tools may give you more functionality, but for what I wante...

Display LUN information for ASM devices RHEL 5 and 6

I know close to nothing about Per l .  This script was created on RHEL 5 an d I wanted t he functi onality to be extended to RHEL 6.   In regards to our script t he signif icant differen ces between RHEL 5 and 6 are: RHEL 5 /dev/mpath     -- path to m ultipath devices  \_                   -- identifier for multipath device RHEL 6 /dev/mapper   - - path to m ultipath devices   |-                   -- identifier for multipath device   `-                  -- identifier for multipath device   #!/usr/bin/perl @rhelver = `cat /etc/redhat-release`; $rhelver[0] =~ / (\d\.\d) /;      $RELEASE = $1; # ARRAY OF HDS ARRAYS $sxm_arrays = {   '726a'=>'ITSHDS0...

Checking memory usage (for Apache)

ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' acquired from: http://webserverpage.com/how-to-measure-or-calculate-maximum-memory-usage-of-apache/ #!/bin/bash if [ $# -ne 1 ] then   echo ""   echo "ERROR: pass in process name"   echo "  $0 {httpd|java}"   echo ""   exit 9 fi echo "* * * * * * * *" uname -n ps -ylC ${1} | awk '{x += $8;y += 1} END {print "'${1}' Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' echo "" exit 0 morpheus:~ jradtke$ for HOST in 2 3 4 5; do ssh fatapp0${HOST} "uname -n; for PROC in httpd java; do /opt/bin/check_process_memory.sh \${PROC}; done"; echo; done

BASH foo

Update a file named after a "system" with the IP address from a ":" delimited text file. system:192.168.0.100 cat list | awk -F\: '{ print $1" "$2 }' | while read SYS IP; do echo "address $IP" >> ${SYS}.cfg ; done - Passing responses in to an install script ( echo NB_CLT_7.5.0.6; echo y; echo q; echo y ) | ./NB_update.install This.. is awesome To get the text between two 'strings'  cat sar11 |  awk '/plist-sz/,/Average/ ' 00:00:01      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15 00:01:01            2       998      1.14      0.38      0.18 00:02:01            1      1006      2.35      0.91    ...

sudo using X11 forwarding

I have a need to export my display from a RHEL host AFTER I have sudo'd to root... (such as virt-manager console) xauth list | grep `uname -n` > /tmp/`logname`-xauth && chmod 660 /tmp/`logname`-xauth sudo su - LOGNAME=`logname` xauth add `tail -1 /tmp/${LOGNAME}-xauth` virt-manager

Script Template (for version control RCS)

The following is a script header/template that I will use which works with RCS to update the version in the file #!/bin/bash # ### BEGIN BUILD INFO # @(#)$Id: ruhroh,v 1.2 2013/10/08 14:13:04 root Exp $ # Build System:         pdgllprhnsat01.corp..com ### END BUILD INFO # ### BEGIN INIT INFO # chkconfig: 2345 99 01 # Provides:           ruhroh # Required-Start:    N/A # Default-Stop:     0 1 2 3 4 5 6 # Default-Start:     3 5 # Short-Description:     Emails users when system is shutdown or started # Description:         Sends an email at system start and shutdown ### END INIT INFO