Friday, December 3, 2010

Scan Opened TCP Ports Based on Server Name List Script

 In order to see if the server is sql server or other port is listening, the following script can scan the port based on the server list. 


#!/usr/bin/perl -w

use IO::Socket;
use strict;
my $debug = 0;
my $servername='';
my @ports=('2025','1433');

open(SERVERNAME,"sqlserver.log");

while ($servername=<SERVERNAME>){

        chomp $servername;
        print "scaning server:$servername .....\n\n" if $debug;

        foreach my $port (@ports){

          my $sock = new IO::Socket::INET (
                PeerAddr => $servername,
                PeerPort => $port,
                Proto => 'tcp');
          if (! $sock ) {
                print "ServerName:$servername:$!\n" if $debug
          }else {
                print "ServerName:$servername:OPENED:$port\n";
                close($sock);
          }
        }
}
close(SERVERNAME);

Install Naigos NPRE and Nagios Plugin on AIX 6.1

Failed on compiling from source code and ran out of time to troubleshoot the source code. Then went to pre-compiled solution.

The following procedure has been tested and it working on my box at least.


Install Naigos NPRE and Nagios Plugin on AIX 6.1

                    Written  on 12/3/2010


1. Download nagios plugin and NREP precompiled binary from http://www.guntram.de/nagios/.

2. install them into /usr/loacl/nagios folder.

3. Configure NRPE running with /etc/rc.local


edit nrpe.cfg file to put your customization there.


# mkitab -i rcnfs "rclocal:2:wait:/etc/rc.local >/dev/console 2>&1"
# touch /etc/rc.local
# chmod 700 /etc/rc.local

Then put the command lines to start the daemons in /etc/rc.local.

nohup /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d




Reference:

http://linuxdocument.blogspot.com/2010/03/installing-nrpe-212-on-aix.html
http://www.guntram.de/nagios/
http://saifulaziz.wordpress.com/2006/12/06/how-do-i-start-local-daemons-at-aix-system-startup/

Thursday, July 5, 2007

setup a CA to self-sign the SSL cert.

1. download a Openssl For windows binaries and source package
http://sourceforge.net/project/showfiles.php?group_id=23617&release_id=188569

2. unzip both of the OpenSSL packages to temporary folders. From the binaries package "bin" folder, copy the files "openssl.exe" and the two DLLs into the source package's "apps" folder.

In the "apps" folder is a file called CA.pl. Open this perl script in a text editor and change the line

$SSLEAY_CONFIG=$ENV{"SSLEAY_CONFIG"};
to
$SSLEAY_CONFIG="-config openssl.cnf";

3. Copy the cert request file to into this "apps" directory, and rename it to "newreq.pem".

Next, open a command prompt window in the apps directory, and run the following commands:

* perl CA.pl -newca
* perl CA.pl -signreq



$ perl CA.pl -newca

sg22785@maximus-a7juw9u ~/openssl-0.9.7c-src/src/openssl-0.9.7c/apps
$ perl CA.pl -signreq
Using configuration from openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Jul 5 20:24:25 2007 GMT
Not After : Jul 4 20:24:25 2008 GMT
Subject:
countryName = US
stateOrProvinceName = California
localityName = Los Angeles
organizationName = MAXIMUS
organizationalUnitName = Education
commonName = lasttmp1.schoolmax.net
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
D2:AD:D2:27:2A:52:BD:67:1A:BF:4A:65:8E:E8:52:6E:D6:E7:B9:30
X509v3 Authority Key Identifier:
DirName:/C=AU/ST=QLD/CN=SSLeay/rsa test CA
serial:04

Certificate is to be certified until Jul 4 20:24:25 2008 GMT (365 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Signed certificate is in newcert.pem

Thursday, June 28, 2007

ORA-01555 error.

Under the help from Wenson, the following ora-01555 has been fixed.


Errors in file D:\ora81\RDBMS\TRACE\ORA16184.TRC:
ORA-00604: error occurred at recursive SQL level 1
ORA-01555: snapshot too old: rollback segment number with name "" too small

Fix:

shutdown immeidate
startup mount
recover database
alter database open
or alter database open resetlogs

Monday, June 25, 2007

The Thinking from Wii

An article on this month's issue of Fortune arouses my interests about Wii. The success story about Wii is really impressive - battling on the indifference of people who have no interest in video games. Wii focuses on delivering experiences with lower price rather than other gaming industry giants do, such as SNE and MSFT. Good game experience is not necessary to be expensive!

The first time I knew Wii was from a friend, Diedian's home. The little box is really something that is very attractive. The way that a player is playing the game and the sensitivity to the player's body movements are more accurate than I thought. I heard that Wii was also hard to get.

The target of the Wii's marketing segment is bald and I am not sure how long the successful trend can last. Since the target consumers are not game-sensitive, and this segment usually is composed of low value users of traditional electronic games. I am interested in how the product information can be spread to those people, and how much the target consumer are willing to pay for this box. Currently the list price is less than 300 US.

The "little" company's revenue is unbelievable-- 8.36 B with only 3,400 employees, almost 8 times of that of the company I work at, and just a little less than Mattel ( Barbie doll company) which has been in Market for more than 50 years, 2.5M per employee whereas 1M per employee at Google. I checked their website (http://www.nintendo.com) and wanted to check out how to invest this company. But they seem to be only traded in Japan. In US, we have to purchase ADR ( America Depository Receipt) from some banks. Never done any ADR trade before. Might investigate it more later on.

RHEL AS4 NFS client can not mount volum during the boot time.

Symptom:

Got the following error in the /var/log/messages file during the boot. But after the boot manually mount is OK.

Jun 25 14:58:03 laappt6 mount: mount: mount to NFS server 'laappt3' failed:
Jun 25 14:58:03 laappt6 mount: System Error: No route to host.

Cause:

The NFS mount script runs during the network initialize phase.

Solution :


Found two solutions from web.

1. append "/bin/mount -a " in /etc/rc.d/rc.local

2. insert the following line in to /etc/rc.d/init.d/netfs file.


before :

[ ! -f /var/lock/subsys/portmap ] && service portmap start
action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4

after :
[ ! -f /var/lock/subsys/portmap ] && service portmap start
#added by David W.
action $"Sleeping for 30 secs:" sleep 30
#end of added by David W.
action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4


Reference:

1. CrazyToon,
http://crazytoon.com/2007/05/11/centos-and-redhat-problem-nfs-mount-at-boot-up-fails-with-error-system-error-no-route-to-host/

Friday, June 22, 2007

Use Microsfot iSCSI Initiator to access Openfiler

The steps are straightforward .

1. download microsoft iscsi initiator and install it.
2. configure the target.
3. click target tab and make sure the disk is connected , otherwise, click logon.
4. use disk management on windows to format to assign a drive letter.