Tuesday, July 17, 2012

atomic repo for centos - upgrade php from 5.1.6 to 5.2.x

http://wiki.centos.org/HowTos/PHP_5.1_To_5.2

How to restore a missing RCS-managed file
# co -p ./RCS/missing_filename,v >> ./missing_filename


How to view current locks on RCS-managed files
# rlog -L -R RCS/*

How remove current locks on RCS-managed files
# rcs -u ./filename_of_locked_file

Tuesday, May 8, 2012

Dell PowerConnect 62xx POS

Holy shit, this Dell PowerConnect stuff sucks. Never, EVER buy this shit.
Its some kind of bastardized version of a Cisco switch.

How it got into the Data Center, I will never know. Idiots at CDW I'm guessing.

I've had it with these pesky and unnecessarily weird devices.

NEVer again!!!

(I found out today that they disabled STP because there was a bug in the Dell firmware a while back. YA! Lets disable it, nevermind updating the firmware or actually getting industry-standard production hardware..)

Wednesday, March 14, 2012

esxi5: tag your raid array as SSD (if it is one)

I have four Intel 520 SSD's connected to a 9260LP-4i LSI controller plugged into a SuperMicro X8TDi

observe:


~ # esxcli storage core device list
naa.600605b00418fd8016ed05ec1a609a91
   Display Name: Local LSI Disk (naa.600605b00418fd8016ed05ec1a609a91)
   Has Settable Display Name: true
   Size: 341856
   Device Type: Direct-Access
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/disks/naa.600605b00418fd8016ed05ec1a609a91
   Vendor: LSI
   Model: MR9260-4i
   Revision: 2.12
   SCSI Level: 5
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: false
   Is SSD: false
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0200000000600605b00418fd8016ed05ec1a609a914d5239323630

mpx.vmhba32:C0:T0:L0
   Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
   Has Settable Display Name: false
   Size: 956
   Device Type: Direct-Access
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0
   Vendor: Crucial
   Model: Gizmo!      
   Revision: 1100
   SCSI Level: 2
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: true
   Is SSD: false
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0000000000766d68626133323a303a30

mpx.vmhba0:C0:T0:L0
   Display Name: Local Optiarc CD-ROM (mpx.vmhba0:C0:T0:L0)
   Has Settable Display Name: false
   Size: 0
   Device Type: CD-ROM
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/cdrom/mpx.vmhba0:C0:T0:L0
   Vendor: Optiarc
   Model: DVD RW AD-7280S
   Revision: 1.01
   SCSI Level: 5
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: true
   Is SSD: false
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0005000000766d686261303a303a30



collect info:

~ # esxcli storage nmp device list
naa.600605b00418fd8016ed05ec1a609a91
   Device Display Name: Local LSI Disk (naa.600605b00418fd8016ed05ec1a609a91)
   Storage Array Type: VMW_SATP_LOCAL
   Storage Array Type Device Config: SATP VMW_SATP_LOCAL does not support device configuration.
   Path Selection Policy: VMW_PSP_FIXED
   Path Selection Policy Device Config: {preferred=vmhba1:C2:T0:L0;current=vmhba1:C2:T0:L0}
   Path Selection Policy Device Custom Config:
   Working Paths: vmhba1:C2:T0:L0

mpx.vmhba32:C0:T0:L0
   Device Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
   Storage Array Type: VMW_SATP_LOCAL
   Storage Array Type Device Config: SATP VMW_SATP_LOCAL does not support device configuration.
   Path Selection Policy: VMW_PSP_FIXED
   Path Selection Policy Device Config: {preferred=vmhba32:C0:T0:L0;current=vmhba32:C0:T0:L0}
   Path Selection Policy Device Custom Config:
   Working Paths: vmhba32:C0:T0:L0

mpx.vmhba0:C0:T0:L0
   Device Display Name: Local Optiarc CD-ROM (mpx.vmhba0:C0:T0:L0)
   Storage Array Type: VMW_SATP_LOCAL
   Storage Array Type Device Config: SATP VMW_SATP_LOCAL does not support device configuration.
   Path Selection Policy: VMW_PSP_FIXED
   Path Selection Policy Device Config: {preferred=vmhba0:C0:T0:L0;current=vmhba0:C0:T0:L0}
   Path Selection Policy Device Custom Config:
   Working Paths: vmhba0:C0:T0:L0

~ # esxcfg-info | grep -A1 "Default Path Selection Policy"
                  |----Default Path Selection Policy................VMW_PSP_MRU
                  |----Name.........................................VMW_SATP_MSA
--
                  |----Default Path Selection Policy................VMW_PSP_MRU
                  |----Name.........................................VMW_SATP_ALUA
--
                  |----Default Path Selection Policy................VMW_PSP_MRU
                  |----Name.........................................VMW_SATP_DEFAULT_AP
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_SVC
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_EQL
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_INV
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_EVA
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_ALUA_CX
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_SYMM
--
                  |----Default Path Selection Policy................VMW_PSP_MRU
                  |----Name.........................................VMW_SATP_CX
--
                  |----Default Path Selection Policy................VMW_PSP_MRU
                  |----Name.........................................VMW_SATP_LSI
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_DEFAULT_AA
--
                  |----Default Path Selection Policy................VMW_PSP_FIXED
                  |----Name.........................................VMW_SATP_LOCAL
--
            |----World Command Line.................................grep -A1 Default Path Selection Policy
            |----Cartel ID..........................................4991

now, add the rule:

~ # esxcli storage nmp satp rule add -s VMW_SATP_LOCAL --device naa.600605b00418fd8016ed05ec1a609a91 --option=enable_ssd
~ # esxcli storage core claiming unclaim --type device --device naa.600605b00418fd8016ed05ec1a609a91
~ # esxcli storage core claimrule load
~ # esxcli storage core claimrule run

observe:

~ # esxcli storage core device list
naa.600605b00418fd8016ed05ec1a609a91
   Display Name: Local LSI Disk (naa.600605b00418fd8016ed05ec1a609a91)
   Has Settable Display Name: true
   Size: 341856
   Device Type: Direct-Access
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/disks/naa.600605b00418fd8016ed05ec1a609a91
   Vendor: LSI
   Model: MR9260-4i
   Revision: 2.12
   SCSI Level: 5
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: false
   Is SSD: true
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0200000000600605b00418fd8016ed05ec1a609a914d5239323630

mpx.vmhba32:C0:T0:L0
   Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
   Has Settable Display Name: false
   Size: 956
   Device Type: Direct-Access
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0
   Vendor: Crucial
   Model: Gizmo!        
   Revision: 1100
   SCSI Level: 2
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: true
   Is SSD: false
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0000000000766d68626133323a303a30

mpx.vmhba0:C0:T0:L0
   Display Name: Local Optiarc CD-ROM (mpx.vmhba0:C0:T0:L0)
   Has Settable Display Name: false
   Size: 0
   Device Type: CD-ROM
   Multipath Plugin: NMP
   Devfs Path: /vmfs/devices/cdrom/mpx.vmhba0:C0:T0:L0
   Vendor: Optiarc
   Model: DVD RW AD-7280S
   Revision: 1.01
   SCSI Level: 5
   Is Pseudo: false
   Status: on
   Is RDM Capable: false
   Is Local: true
   Is Removable: true
   Is SSD: false
   Is Offline: false
   Is Perennially Reserved: false
   Thin Provisioning Status: unknown
   Attached Filters:
   VAAI Status: unsupported
   Other UIDs: vml.0005000000766d686261303a303a30
~ #

Friday, October 28, 2011

ruby installation with rvm on Ubuntu 10.04.3 LTS

:~# PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin"
:~# apt-get install git-core curl build-essential openssl libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
:~# bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

#something was broken here during package management above, not sure...
echo "export PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin\"" > >> ./.bashrc

:~# rvm pkg install zlib
:~# rvm install 1.9.2
:~# rvm use 1.9.2
:~# rvm default 1.9.2
:~# rvm all do gem install eventmachine
:~# echo "[[ -s \"/usr/local/rvm/scripts/rvm\" ]] && . \"/usr/local/rvm/scripts/rvm\"" >> ./.profile

root@sssid1:~# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
root@sssid1:~#

Tuesday, October 11, 2011

how to securely wipe a drive in linux

option 1
# shred -n 7 -z /dev/sdb

option 2
# dd if=/dev/urandom of=/dev/sdb bs=4096 count=7
# dd if=/dev/zero of=/dev/sdb bs=4096 count=7

Friday, September 30, 2011

clear postfix mail queue

for f in ` mailq |grep .com -B 2 |grep ^[A-Z0-9]|awk '{print $1}'` ; do postsuper -d $f; done

Also, fun times here:
http://www.postfix.org/docs.html

Wednesday, September 28, 2011

Comparison of Disk Encryption Software

http://en.wikipedia.org/wiki/Comparison_of_disk_encryption_software

Wednesday, August 31, 2011

Nagios - ERROR opening session: An empty privacy password was specified.

in Nagios® Core™ 3.2.3 i got this error when running checks with "check_snmp_load":
"ERROR opening session: An empty privacy password was specified."

on the command line, after executing this:
../libexec/snmp/check_snmp_load.pl -l readpriv -x xxxxxx -X xxxxxx -H hostname -w 3,3,2 -c 4,4,3 -T netsl

i got this:
Argument "v6.0.1" isn't numeric in numeric lt (<) at ./check_snmp_load.pl_old line 348.
Load : 0.00 0.00 0.00 : OK

I changed line 348 from:
my $resultat = (Net::SNMP->VERSION < 4) ?

 to:
my $resultat = (Net::SNMP->VERSION lt 4) ?


..works

Wednesday, August 17, 2011

automatically bring up the openvpn client

# /etc/rc.local
echo 0 > /proc/sys/net/ipv4/conf/tun0/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 1 > /proc/sys/net/ipv4/ip_forward
/usr/local/sbin/openvpn --config /etc/openvpn/client.conf --daemon &

#i use this to do all kinds of stuff...

clearing a mail queue

for f in ` mailq |grep hostname.com -B 2 |grep ^[A-Z0-9]|awk '{print $1}'` ; do postsuper -d $f; done

Monday, August 15, 2011

mrepo

http://dag.wieers.com/home-made/mrepo/

Saturday, August 13, 2011

SMTP Codes


211 - A system status message.
214 - A help message for a human reader follows.
220 - SMTP Service ready.
221 - Service closing.
250 - Requested action taken and completed.
251 - The recipient is not local to the server, but the server will accept and forward the message.
252 - The recipient cannot be VRFYed, but the server accepts the message and attempts delivery.

354 - Start message input and end with .. This indicates that the server is ready to accept the message itself

421 - The service is not available and the connection will be closed.
450 - The requested command failed because the user’s mailbox was unavailable (such as being full). Try again later.
451 - The command has been aborted due to a server error. (on their side)
452 - The command has been aborted because the server has insufficient system storage.

500 - The server could not recognize the command due to a syntax error.
501 - A syntax error was encountered in command arguments.
502 - This command is not implemented.
503 - The server has encountered a bad sequence of commands.
504 - A command parameter is not implemented.
550 - The requested command failed because the user’s mailbox was unavailable (such as not found)
551 - The recipient is not local to the server.
552 - The action was aborted due to exceeded storage allocation.
553 - The command was aborted because the mailbox name is invalid.
554 - The transaction failed for some unstated reason

Friday, August 12, 2011

compare packages between two RHEL systems

#generate package list on hostname1
rpm -qa --qf "%{NAME}\n" > hostname1.rpm.txt
cat ./hostname1.rpm.txt | sort | uniq > ./hostname1_final.rpm.txt

#generate package list on hostname2
rpm -qa --qf "%{NAME}\n" > hostname2.rpm.txt
cat ./hostname2.rpm.txt | sort | uniq > ./hostname2_final.rpm.txt

#you want the difference between systems - show diffs on the right and trim leading whitespace
sdiff ./hostname1.rpm.txt ./hostname2.rpm.txt | grep '>' | sed -e 's/^[> \t]*//'


#you want the difference between systems - show diffs on the left and trim trailing whitespace
sdiff ./hostname1.rpm.txt ./hostname2.rpm.txt | grep '<' | sed -e 's/[ \t<]*$//'

Wednesday, August 3, 2011

clearing a mail queue

#sendmail
sendmail -qS -v subdomain.test.com

#postfix
for f in ` mailq |egrep subdomain.test.com -B 2 |grep ^[A-Z0-9]|awk '{print $1}'` ; do postsuper -d $f; done

Thursday, July 28, 2011

GPG key error when updating RHEL 5.x system

when running a `yum update -y`, i got:

--
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 897da07a


Public key for nash-5.1.19.6-71.el5.i386.rpm is not installed
--


I had to install:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta

then run again.


also, check this:

rpm -qa |grep gpg

if you have multiple of the same gpg keys installed use the following:

rpm -e --allmatches gpg-pubkey*
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta

Monday, July 25, 2011

mdadm notes

mdadm --remove /dev/md0 /dev/sdb
#pull disk, replace with new one

# you have to fail a disk before you remove it
# however, if the system wont release the raid partner, you need to slide the offending disks out and boot off a good disk.

#here you can review the layout
[root@host~]# fdisk -l /dev/sda

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          16      128488+  fd  Linux raid autodetect
/dev/sdb2              17        1291    10241437+  fd  Linux raid autodetect
/dev/sdb3            1292        2566    10241437+  83  Linux
/dev/sdb4            2567       30401   223584637+   5  Extended
/dev/sdb5            2567        2827     2096451   fd  Linux raid autodetect
/dev/sdb6            2828        2860      265041   fd  Linux raid autodetect
/dev/sdb7            2861       30401   221223051   fd  Linux raid autodetect

#review the descriptions of the disks



-----------


[root@host ~]# sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=   256977, Id=fd, bootable
/dev/sda2 : start=   257040, size= 20482875, Id=fd
/dev/sda3 : start= 20739915, size= 20482875, Id=83
/dev/sda4 : start= 41222790, size=449113140, Id= 5
/dev/sda5 : start= 41222853, size=  4192902, Id=fd
/dev/sda6 : start= 45415818, size=   530082, Id=fd
/dev/sda7 : start= 45945963, size=444389967, Id=fd
[root@host ~]# sfdisk -d /dev/sdb

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
No partitions found
-----------


#this command is similar to `sfdisk -l`, but you can use it to copy the layout to the new replacement disk
#its destructive to sdb, be sure you know what you're doing. read man page, right?  :)


-----------

[root@host~]# sfdisk -d /dev/sda | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 30522 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1   *        63    257039     256977  fd  Linux raid autodetect
/dev/sdb2        257040  20739914   20482875  fd  Linux raid autodetect
/dev/sdb3      20739915  41222789   20482875  83  Linux
/dev/sdb4      41222790 490335929  449113140   5  Extended
/dev/sdb5      41222853  45415754    4192902  fd  Linux raid autodetect
/dev/sdb6      45415818  45945899     530082  fd  Linux raid autodetect
/dev/sdb7      45945963 490335929  444389967  fd  Linux raid autodetect
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
[root@host~]# sfdisk -d /dev/sdb
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=       63, size=   256977, Id=fd, bootable
/dev/sdb2 : start=   257040, size= 20482875, Id=fd
/dev/sdb3 : start= 20739915, size= 20482875, Id=83
/dev/sdb4 : start= 41222790, size=449113140, Id= 5
/dev/sdb5 : start= 41222853, size=  4192902, Id=fd
/dev/sdb6 : start= 45415818, size=   530082, Id=fd
/dev/sdb7 : start= 45945963, size=444389967, Id=fd


-----------




#check the status of the set
cat /proc/mdstat

#now, add the partition slices back to the set
mdadm --add /dev/md0 /dev/sdb1
mdadm --add /dev/md1 /dev/sdb5
mdadm --add /dev/md3 /dev/sdb6
mdadm --add /dev/md4 /dev/sdb7
mdadm --add /dev/md2 /dev/sdb2


#review
mdadm --detail /dev/md0

#review progress
cat /proc/mdstat


healthy output:

[root@host ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0] sdb1[1]
      128384 blocks [2/2] [UU]
   
md1 : active raid1 sda5[0] sdb5[1]
      2096384 blocks [2/2] [UU]
   
md3 : active raid1 sda6[0] sdb6[1]
      264960 blocks [2/2] [UU]
   
md4 : active raid1 sda7[0] sdb7[1]
      221222976 blocks [2/2] [UU]
   
md2 : active raid1 sda2[0] sdb2[1]
      10241344 blocks [2/2] [UU]
   
unused devices:


UNhealthy output:

[root@host ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1]
      128384 blocks [2/2] [_U]
   
md1 : active raid1 sdb5[1]
      2096384 blocks [2/2] [_U]
   
md3 : active raid1 sdb6[1]
      264960 blocks [2/2] [_U]
   
md4 : active raid1 sdb7[1]
      221222976 blocks [2/2] [_U]
   
md2 : active raid1 sdb2[1]
      10241344 blocks [2/2] [_U]
   
unused devices:

#have a nice day



--------------------------------------------------------
[root@somehost ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sat Oct 31 03:08:47 2009
Raid Level : raid1
Array Size : 128384 (125.40 MiB 131.47 MB)
Device Size : 128384 (125.40 MiB 131.47 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Mon Jul 25 04:48:26 2011
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

UUID : xxxxxx:xxxxxxxx:xxxxxxx:dd7a13a5
Events : 0.74

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
--------------------------------------------------------

nagios check: check_by_ssh!"sudo /bin/cat /proc/mdstat | grep _ /proc/mdstat -c | grep 0 -c