Monday, May 11, 2009

Highlighting matching on regexp

hi all,

If you wish to declare a environment variable to have regular expression operates with grep where the standard output showing the colors, in fact, you can!

export GREP_OPTIONS='--color=auto'

Have fun.

yen_onn_hiu@nasilemak:~/regexp> grep .a.. text1
sales1.xls
sales2.xls
sales3.xls
apac1.xls
na1.xls
na2.xls
sa1.xls

Thursday, May 7, 2009

VAS troubleshooting skills

Yesterday, I have been spending times to debug the vastool. That's give me error when prompting the id of the account.

End up, I did a "vas merge" to get all the vas cache load into the /etc/passwd and /etc/group. That's pain. But, It works temporarily.

Here are the bunch of vas command for troubleshooting.

1. To check on the user access

vastool user checkaccess [account_name]

2. To get the vastool status result

ftp://ftp.vintela.com/vas/support/vas_status.sh.gz

To get the vastool snapshot

/opt/quest/libexec/vas/scripts/vas_snapshot.sh

3. To flush the cache

vastool flush

4. To check is vas

vastool isvas user [account name]

5. Test AD connection and user password
vastool kinit [account_name]

6. Test VAS service access control (assuming your using sshd)
vastool user checkaccess -s sshd [acount_name]

7. Check authentication logs
1) Add the words "debug" and "trace" to the end of all pam_vas lines in /etc/pam.d/system-auth
2) Add "*.debug /var/log/debug" to /etc/syslog.conf
3) Restart syslog daemon
4) Attempt login
5) Look at output in /var/log/debug for indication/reason of failure

8. You can also turn on vasd debug if desired
1) vastool configure vas vasd debug-level 3

Tuesday, March 3, 2009

vmware way of discovering lun

In order to list a vmware lun, please do this.

[root@testdev01 volumes]# esxcfg-mpath -l
Disk vmhba1:0:16 /dev/sdr (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:16 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:16 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:16 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:16 Standby preferred

Disk vmhba1:0:17 /dev/sds (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:17 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:17 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:17 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:17 Standby preferred

Disk vmhba1:0:18 /dev/sdt (204800MB) has 4 paths and policy of Most Recently Used FC 10:0.0 10000000c9610905<->5006016941e02f2b vmhba1:0:18 Standby FC 10:0.0 10000000c9610905<->5006016141e02f2b vmhba1:1:18 On active FC 14:0.0 10000000c96106fc<->5006016041e02f2b vmhba2:0:18 On FC 14:0.0 10000000c96106fc<->5006016841e02f2b vmhba2:1:18 Standby preferred

Tuesday, February 10, 2009

Discovering HBA information from RHEL3 and SLES10

If you wish to retrieve information on HBAs on RHEL3 or SLES10 SP1. Basically, here is the path that you are looking for.

RHEL3: /proc/scsi/lpfc/
SLES10 SP1: /sys/class/fc_host/

As for the SLES10 SP2 : /sys/class/scsi_host/

There are bunch of information like HBA model, firmware, speed, port_state and WWN.

Discovering HBA from OEL5

hbanyware prepares a good place to query the hba information.

e.g.
[root@test03 audit]# /usr/sbin/hbanyware/hbacmd listhbas
Manageable HBA List
Port WWN : 10:00:00:00:c9:63:1d:79

Node WWN : 20:00:00:00:c9:63:1d:79
Fabric Name: 10:00:00:05:1e:04:6c:8b
Flags : 8000f0e5
Host Name : test03.hiu.com
Mfg : Emulex Corporation
Port WWN : 10:00:00:00:c9:63:1d:34

Node WWN : 20:00:00:00:c9:63:1d:34
Fabric Name: 10:00:00:05:1e:04:3f:9d
Flags : 8000f0e5
Host Name : test03.hiu.com
Mfg : Emulex Corporation

In order to get the HBA Model, you can get the information from hbanyware command as well.

[root@test03 audit]# /usr/sbin/hbanyware/hbacmd hbaAttributes 10:00:00:00:c9:63:1d:79
HBA Attributes for 10:00:00:00:c9:63:1d:79
Host Name : test03.hiu.com

Manufacturer : Emulex Corporation
Serial Number : BG72036851
Model : LPe1150-E
Model Desc : EMC LPe1150-E 4Gb PCIe Fibre Channel Adapter
Node WWN : 20 00 00 00 c9 63 1d 79
Node Symname : Emulex LPe1150-E FV2.72A2 DV8.2.0.22
HW Version : 2057706d
Opt ROM Version:
FW Version : 2.72A2 (W3F2.72A2), sli-3
Vendor Spec ID : 10DFNumber of Ports: 1
Driver Name : lpfc
Device ID : F0E5
HBA Type : LPe1150-E
Operational FW : SLI-3 Overlay
SLI1 FW : SLI-1 Overlay 2.72a2
SLI2 FW : SLI-2 Overlay 2.72a2
SLI3 FW : SLI-3 Overlay 2.72a2
IEEE Address : 00 00 c9 63 1d 79
Boot BIOS : 1.70a3
Driver Version : 8.2.0.22; HBAAPI(I) v2.1.g, 12-07-07
Kernel Version : 1.20a4
HBA Temperature: Not Available

Sunday, February 8, 2009

Configure opensuse11 + rewrite_module

if you are using opensuse 11 with cakephp development, most likely you will need to have the rewrite_module enabled on apache2.

All apache2 modules are kept at /usr/lib/apache2. Please use this command to enable your rewrite_module. Enjoy!

a2enmod rewrite
/etc/init.d/apache2 force-reload

Sunday, October 12, 2008

Passed Novell CLP10

After making my mind to go for the certification, i finally passed the cert. It is not that too hard but, the remote connection is slow and lame. What make worse of it is the timer is keep on triggering, making the feeling of panics and nervous.


Wednesday, October 8, 2008

Backup Files

TAR
We have two different backup, full backup and incremental backup.

Let's pick our backup folder as /srv/www/htdocs.

To do a full backup, you need to prompt this command

cd /srv/www
tar cvz -g /tmp/backup/snapshot_htdocs -f /tmp/backup/htdocs_full.tar.gz htdocs

To do a incremental backup.

tar cvz -g /tmp/backup/snapshot_htdocs -f /tmp/backup/htdocs_incremental.tar.gz htdocs

RSYNC
Rsync backup is much more better than tar. Both incremental and full backup can use the same command to execute. Rsync will pick the changes on backup target without capturing the file snapshot.

rsync -ave ssh root@ip_addr_to_be_backup:/home/users /tmp/backup_dir

Monday, October 6, 2008

syslog

The configuration of syslog-ng is distributed across three files

  • /etc/sysconfig/syslog
  • /etc/syslog-ng/syslog-ng.conf.in
  • /etc/syslog-ng/syslog-ng.conf



/etc/sysconfig/syslog contains general parameters applicable to syslog-ng.

/etc/syslog-ng/syslog-ng.conf.in is the template used to create the configuration file /etc/syslog-ng/syslog-ng.conf, which is the configuration file actually used by syslog-ng. both files have the same syntax.

syslogd and syslog-ng share two concepts that you have to understand to the able to configure either one:

  • facilities
  • priorities

Sunday, October 5, 2008

Creating a virtual interface on opensuse11

  • a normal network interface can be queried via the command ifconfig
opensuse01:~ # ifconfig
eth2 Link encap:Ethernet HWaddr 00:0C:29:4F:74:C5
inet addr:192.168.80.134 Bcast:192.168.80.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe4f:74c5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:346 errors:0 dropped:0 overruns:0 frame:0
TX packets:781 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44214 (43.1 Kb) TX bytes:109649 (107.0 Kb)
Interrupt:18 Base address:0x2024
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:326 errors:0 dropped:0 overruns:0 frame:0
TX packets:326 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:45674 (44.6 Kb) TX bytes:45674 (44.6 Kb)
============================================
  • To add the virtual interface.
ip addr add 192.168.80.135/24 brd + dev eth2 label eth2:1
  • ifconfig again to the command prompt will display this
eth2:1 Link encap:Ethernet HWaddr 00:0C:29:4F:74:C5
inet addr:192.168.80.135 Bcast:192.168.80.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18 Base address:0x2024
============================================
  • Please do a ping to the new virtual interface.
opensuse01:~ # ping 192.168.80.135
PING 192.168.80.135 (192.168.80.135) 56(84) bytes of data.
64 bytes from 192.168.80.135: icmp_seq=1 ttl=64 time=0.034 ms
64 bytes from 192.168.80.135: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 192.168.80.135: icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from 192.168.80.135: icmp_seq=4 ttl=64 time=0.049 ms