Installing Apache 2.2.11 with Weblogic 10.3 on Ubuntu 9.04 64 bit

This post takes you through the steps to install Apache 2.2.11 on Ubuntu 9.04 64 bit and make it work with Weblogic 10.3. The post walks through the steps that I followed, the problems that I faced and the solutions ( er..hacks) to get them resolved.

Installing Apache

  • Is simple do

sudo apt-get install apache2

If you want to build it from sources then follow these steps.

  • Once you have installed apache2 then the installation happens at the following locations in Ubuntu

Apache config files are in /etc/apache
Apache log files are in /var/log/apache
Apache libs are in /usr/lib/apache
Other files can be in /usr/share/apache, /var/lib/apache
executables in /usr/sbin apache and apache2ctl

  • Now to start apache execute the following

vhazrati@vhazrati-laptop:/usr/sbin$ sudo apache2ctl start

  • Note that the server is started as a root, else you might get the following error

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

You should be able to access the default page on http://localhost now and see It Works!

Now, Integrating with Weblogic


  • Download the apache plugins for weblogic 10.3 from the following location

http://download.oracle.com/otn/bea/weblogic/server103/server103_apacheplugins.zip

  • Unzip the contents and select the mod_wl_22.so file from the location

<apache-plugin-unzip-location>linux/x86_64

  • This file needs to be loaded the following location

/usr/lib/apache2/modules

  • to test whether the file is valid or not do ldd

vhazrati@vhazrati-laptop:/usr/lib/apache2/modules$ ldd mod_wl_22.so
linux-vdso.so.1 =>  (0×00007fff02ffe000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0×00007f5cfaaff000)
libm.so.6 => /lib/libm.so.6 (0×00007f5cfa87a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0×00007f5cfa661000)
libc.so.6 => /lib/libc.so.6 (0×00007f5cfa2ef000)
/lib64/ld-linux-x86-64.so.2 (0×00007f5cfafc5000)

  • You might notice that some file like in my case libstdc++.so.5 => was not found!

-bash-3.00$ ldd mod_wl_22.so
libstdc++.so.5 => not found
libm.so.6 => /lib64/tls/libm.so.6 (0×0000002a9572f000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0×0000002a958b5000)
libc.so.6 => /lib64/tls/libc.so.6 (0×0000002a959c3000)
/lib64/ld-linux-x86-64.so.2 (0×000000552aaaa000)

  • Goto the synaptic package manager, search and install this file.
  • Now create a weblogic.load file with the following contents

LoadModule weblogic_module /usr/lib/apache2/modules/mod_wl_22.so

  • and put it at the following location

/etc/apache2/mods-enabled

  • You can also create a weblogic.conf file with the following contents at the same location

<Location /medrec>
SetHandler weblogic-handler
WebLogicHost 127.0.1.1
WebLogicPort 7011
</Location>

This would help in redirecting a request like http://localhost/medrec to the weblogic server running on 127.0.1.1 and at 7011 port with the application name medrec.

  • Restart Apache

vhazrati@vhazrati-laptop:/usr/sbin$ sudo apache2ctl restart

  • Check whether the weblogic_module has been loaded successfully or not

vhazrati@vhazrati-laptop:/usr/sbin$ apache2 -t -D DUMP_MODULES
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_worker_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)
status_module (shared)
weblogic_module (shared)

  • If you see the weblogic_module loaded fine then you have configured it correctly and can now access the application at

http://localhost/medrec/

  • To test whether the apache2.conf file is correct or not you can use

vhazrati@vhazrati-laptop:/usr/sbin$ apache2 -t
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
Syntax OK

Other Potential Problem(s)

  • You may encounter the problem bad user name ${APACHE_RUN_USER}

this is because the value of ${APACHE_RUN_USER} is not getting picked up. Ideally it should be picked up from /etc/apache2/envvars

which has the following entries

# envvars – default environment variables for apache2ctl

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid

However, still in your case if these values are not picked up then goto the /etc/apache2/apache2.conf file and make the following changes

# These need to be set in /etc/apache2/envvars
# User ${APACHE_RUN_USER}
# Group ${APACHE_RUN_GROUP}
User www-data
Group www-data

  • The weblogic.load file is not read for some reason and hence the weblogic_module is not loaded

Make an entry in the httpd.conf file at the following location

/etc/apache2/httpd.conf

and enter the LoadModule and other configuration data in this file

LoadModule weblogic_module /usr/lib/apache2/modules/mod_wl_22.so

<Location /medrec>
SetHandler weblogic-handler
WebLogicHost 127.0.1.1
WebLogicPort 7011
</Location>

There is an entry in the apache2.conf file to include the httpd.conf file, hence the changes of httpd.conf would get loaded

# Include all the user configurations:
Include /etc/apache2/httpd.conf

Solaris service management

The Service Management Facility (SMF) is a core component of the new Predictive Self-Healing set of technologies introduced in Solaris 10. With SMF, system administrators can use simple command line utilities to easily identify, observe, and manage both the services provided by the system and the system itself.

A Solaris service is any long-lived software object with a well-defined state, start and stop, and relationship to other services on the system. Delivering email, handling ftp requests, and permitting remote command execution are a few examples of services typically provided within the Solaris environment.

In Solaris 10, each software service has an advertised state. Should a failure occur, the system automatically diagnoses it and locates/pinpoints the source of the failure. Failing services are automatically restarted whenever possible, reducing the need for human intervention. Should manual intervention be required, system administrators can quickly identify the root cause of the service’s failure and significantly reduce the times-to-repair and recover from said failure.

Specifically, SMF enables administrators to do the following tasks easily and efficiently:

  • Observe and manage system-wide services
  • Identify “misbehaved” or failed services
  • Securely delegate administrative tasks to non-root users
  • Automatically restart failed services in the appropriate order of dependency
  • Persist the enable/disable of services across system upgrades & patches
  • Preserve compatibility with legacy services
  • Automatically configure snapshots for backup, restore, undo
  • Provide consistent configuration handling

SMF preserves compatibility with “legacy” services. Legacy refers to /etc/rc*.d, /etc/init.d, and /etc/inittab scripts which have been used to manage ISV-provided or internally developed services. Legacy services will continue to work as they did in earlier releases of Solaris, and you will be able to observe these services with SMF. However, they will not participate in or benefit from SMF’s self-healing capabilities, such as service restart, until the scripts have been converted to SMF manifests.

Service Manifests

The above tasks are made possible by a key attribute of SMF: it understands the relationships and dependencies between software services on a Solaris system.

This information is stored in a service manifest which SMF uses when managing services as well as when determining root causes of service failures. The service manifest also describes the conditions under which failed services may be automatically restarted. A separate service manifest is required per service/application. Sun provides some service manifests by default. Optionally, you can customize these manifests, or write your own for other services.

SMF Commands

SMF has a limited yet powerful set of commands. Each command has several options which cover the tasks required to manage Solaris systems. The following table lists the SMF commands.

Command Description
svcs
Reports service status
svcadm
Used for service management: e.g., starting, stopping and restoring services
svccfg
Used to list properties of a service
svcprop
Used to list properties of a service
inetadm
Used to manage inetd services

Table 1—SMF commands

This guide focuses on gathering information about the services running on a Solaris system and troubleshooting a failed service. These tasks are accomplished with the svcs and svcadm commands.

The other commands enable system administrators to manage, modify, and display service manifests. You can read more about them on docs.sun.com under the Solaris 10 Basic Administration Guide.

An Example

This example begins by looking at all the services currently running on your Solaris system and then examining a few of the services for more details. These details include the services upon which they depend and the services which depend upon them.

Displaying System Services Information

  1. To display all services on your Solaris system with their state information, use the svcs command along with the -a option:
    my-system# svcs -a
    
    STATE         STIME      FMRI
    legacy_run    Apr_18     lrc:/etc/rcS_d/S51installupdates
    legacy_run    Apr_18     lrc:/etc/rc2_d/S47pppd 
    legacy_run    Apr_18     lrc:/etc/rc2_d/S99audit 
    legacy_run    Apr_18     lrc:/etc/rc3_d/S76snmpdx 
    legacy_run    Apr_18     lrc:/etc/rc3_d/S90samba
    disabled      Apr_18     svc:/network/ipfilter:default 
    disabled      Apr_18     svc:/network/rpc/keyserv:default 
    disabled      Apr_18     svc:/network/rpc/nisplus:default 
    disabled      Apr_18     svc:/application/print/server:default 
    disabled      Apr_18     svc:/network/dhcp-server:default 
    disabled      Apr_18     svc:/network/http:apache2
    online        Apr_18     svc:/system/svc/restarter:default 
    online        Apr_18     svc:/network/pfil:default 
    online        Apr_18     svc:/network/physical:default 
    online        Apr_18     svc:/system/identity:domain 
    online        Apr_18     svc:/system/cryptosvc:default
    online        Apr_18     svc:/network/inetd:default 
    online        Apr_18     svc:/network/telnet:default 
    online        Apr_18     svc:/network/ssh:default 
    online        Apr_18     svc:/system/zones:default 
    online        Apr_18     svc:/network/nfs/nlockmgr:default 
    offline       Apr_18     svc:/application/print/ipp-listener:default 
    offline       Apr_18     svc:/application/print/rfc1179:default 
    [Note: This is a truncated list]
    

Displaying Individual Services

You can look at individual services as well. This is especially useful during troubleshooting or when examining what is going on with a particular service.

  1. To display information about the inetd service, use the svcs command specifying the service by name:
    my-system# svcs inetd 
    STATE       STIME     FMRI 
    online      Apr_18    svc:/network/inetd:default
    
  2. To display information about the Samba service, use the svcs command specifying the service by name:
    my-system# svcs S90samba 
    STATE       STIME     FMRI 
    legacy_run  Apr_18    lrc:/etc/rc3_d/S90samba
    
  3. To display information about the Apache service, use the svcs command specifying the service by name:
    my-system# svcs apache2 
    STATE       STIME     FMRI 
    disabled    Apr_18    svc:/network/http:apache2
    

Retrieving Dependency Tree Information

SMF permits you to identify all the service dependencies for a given service. That is, the services upon which a given service depends, as well as the services that depend upon that service. The following options are used to provide additional detail on the services.

Option Description
-a
Displays all services, including those which have been disabled
-d
Lists a service’s dependencies
-D
Lists a service’s dependents
-l
Displays all available information about the service
-p
Lists all processes (PID) associated with a service

Table 2—Useful options for svcs(1)

Note that a lowercase -d option and the uppercase -D option actually mean different things. The -d option results in a list of services on which the named service depends, while the -D option results in a list of services which depend upon the named service. Think of them as above and below the service on a dependency tree.

In Step 1, you used the -a option to list all services on the system. Now take a look at the list of services on which inetd depends.

  1. To list the dependencies of the inetd service, use the svcs command, specifying the -d option:
    my-system# svcs -d inetd 
    STATE       STIME     FMRI 
    disabled    Apr_18    svc:/network/inetd-upgrade:default 
    online      Apr_18    svc:/milestone/name-services:default 
    online      Apr_18    svc:/network/loopback:default 
    online      Apr_18    svc:/milestone/network:default 
    online      Apr_18    svc:/system/filesystem/local:default 
    online      Apr_18    svc:/network/rpc/bind:default 
    online      Apr_18    svc:/milestone/sysconfig:default
    

    As you can see, inetd depends upon a number of different services including inetd-upgrade and name-services. The same command can be used to find out if any one of these services depends upon other services. With the information gathered you can sketch out the dependency tree for inetd. Figure 1 shows a partial graph of the dependency tree for inetd.

    Figure 1 Partial dependency tree for inetd
    Figure 1—Partial dependency tree for inetd (enlarge image)

  2. To generate a similar list for Apache2, use the svcs command and the -d option, specifying Apache2 by name:
    my-system# svcs -d apache2 
    STATE       STIME     FMRI 
    online      Apr_18    svc:/network/loopback:default 
    online      Apr_18    svc:/network/physical:default
    

    Next, use the -D option to identify services which depend upon inetd and Apache.

  3. To discover the services which depend upon inetd, use the svcs command with the -D option, specifying inetd by name:
    my-system# svcs -D inetd
    STATE       STIME     FMRI 
    online      Apr_18    svc:/milestone/multi-user:default
    

    In this example you can see that multi-user depends upon inetd.

    Next, find the services which, in turn, depend upon multi-user.

  4. To discover the services which depend upon multi-user, use the svcs command with the -D option, specifying multiuser by name:
    my-system# svcs -D multi-user
    STATE       STIME     FMRI 
    disabled    Apr_18    svc:/network/dhcp-server:default 
    online      Apr_18    svc:/milestone/multi-user-server:default
    

    Notice that there are two services which depend upon multi-user, dhcp-server and multi-user-server.

    Next, examine the dhcp-server.

  5. To discover the services which depend upon dhcp-server, use the svcs command with the -D option, specifying dhcp-server by name. Follow through the whole dependency tree in the same way:
    my-system# svcs -D dhcp-server
    STATE       STIME     FMRI 
    online      Apr_18    svc:/milestone/multi-user-server:default
    

    Find the services which depend upon multi-user-server:

    my-system# svcs -D multi-user-server 
    STATE       STIME     FMRI 
    online      Apr_18    svc:/system/zones:default
    

    Find services which depend upon zones:

    my-system# svcs -D zones 
    STATE       STIME     FMRI 
    

    In this case, there are no services which depend on zones, so this is the end of the dependency tree. See the dependency tree below.

    Figure 2 Tree listing the dependents of inetd

Listing Service Processes

Another common task is to list the processes comprising a service. In this example, we will look at the Apache2 service.

  1. First, check if the service is running, using the svcs command:
    my-system# svcs apache2 
    STATE       STIME     FMRI 
    online      11:25:33  svc:/network/http:apache2
    
  2. To list the process IDs of this service, use the svcs command with the -p option.
    my-system# svcs -p apache2 
    STATE       STIME     FMRI 
    online      11:25:33  svc:/network/http:apache2 
                11:25:33  2438 httpd 
                11:25:34  2439 httpd 
                11:25:34  2440 httpd 
                11:25:34  2441 httpd 
                11:25:34  2442 httpd 
                11:25:34  2443 httpd
    

Viewing all Service Information

  1. To view all available information about a particular service, use the svcs command with the -l option, specifying the service by name:
    my-system# svcs -l apache2
    fmri            svc:/network/http:apache2 
    name            Apache 2 HTTP server 
    enabled         true 
    state           online 
    next_state      none 
    state_time      Wed Jun 07 11:47:04 2006 
    logfile         /var/svc/log/network-http:apache2.log 
    restarter       svc:/system/svc/restarter:default 
    contract_id     297 
    dependency      require_all/error svc:/network/loopback:default (online) 
    dependency      optional_all/error svc:/network/physical:default (online)
    

    This option gives a number of useful details about the service. For example, the service is enabled, is online, and has been online since June 7 11:47:04 2006. The logfile, the restarter, and the service dependencies are given as well.

Common Administrative Tasks

This examples starts the Apache2 service and performs some common administrative tasks on the service.

  1. To start the apache2 service, use the svcadm command with the enable option:
    my-system# svcadm enable apache2
    
  2. To display its status, use the svcs command:
    my-system# svcs http 
    STATE       STIME     FMRI 
    online      11:26:46  svc:/network/http:apache2
    
  3. To examine the process IDs associated with the service, use the scvs command with the -p option
    my-system# svcs -p http 
    STATE       STIME       FMRI 
    online      11:26:46    svc:/network/http:apache2 
                11:26:46    2463 httpd 
                11:26:47    2464 httpd 
                11:26:47    2465 httpd 
                11:26:47    2466 httpd 
                11:26:47    2467 httpd 
                11:26:47    2468 httpd
    
  4. To kill the service, use the pkill command. Then check the status again:
    my-system# pkill http 
    
    my-system# svcs http 
    STATE       STIME     FMRI 
    online      11:28:05  svc:/network/http:apache2
    

    Note that in this example the service did indeed stop, but was restarted automatically. STIME in the two cases are different indicating that the service was restarted. SMF increases the uptime of the service and also makes this information easy to retrieve.

  5. Get more information using the -x option.
    my-system# svcs -x http 
    svc:/network/http:apache2 (Apache 2 HTTP server) 
     State: online since Tue Jun 06 11:28:05 2006 
       See: apache2(1M) 
       See: /var/svc/log/network-http:apache2.log 
    Impact: None.
    

    With SMF it is easy to get additional information about services using the -x and -v options of the svcs(1) command. This is particularly helpful when you are investigating the reason why a particular service has failed.

    Option Description
    -x
    Displays explanations for service states
    -v
    With -x, displays extra information for each explanation

    Table 3 Additional options for svcs(1)

Determining System Faults

In this example you will investigate an Apache service failure.

Note: This is a contrived example because with SMF it is difficult to cause a failure that lasts long enough to warrant investigation. As seen in the previous example, the restarter starts Apache almost immediately and does not give us time to go through this exercise. For the purposes of this guide we have forced a failure of the Apache2 service. Details on creating this failure are included in the next section.

  1. To examine the current state of the Apache2 service, use the svcs command:
    my-system# svcs apache2 
    STATE          STIME     FMRI 
    maintenance    11:38:37  svc:/network/http:apache2
    

    Notice that the state is “maintenance” not online.

  2. To examine the current state of the Apache2 service, use the svcs command:
    my-system# svcs -xv apache2 
    svc:/network/http:apache2 (Apache 2 HTTP server) 
     State: maintenance since Tue Jun 06 11:38:37 2006 
    Reason: Method failed. 
       See: http://sun.com/msg/SMF-8000-8Q 
       See: man -M /usr/share/man -s 1M apache2 
       See: /var/svc/log/network-http:apache2.log 
    Impact: This service is not running.
    

    Notice that the service is not running and that a message ID and URL are given to learn more about the failure. You also can check the log file.

  3. To examine the log file, use the tail command with the -3 option to print the last 3 lines of the file:
    my-system# tail -3 /var/svc/log/network-http:apache2.log 
    [ Jun 6 11:38:37 Stopping because all processes in service exited. ] 
    [ Jun 6 11:38:37 Executing stop method ("/lib/svc/method/http-apache2 stop") ] 
    [ Jun 6 11:38:37 Method "stop" exited with status 96 ]
    

    Notice there are no processes associated with the Apache2 service. The following example shows the expected output when a process is attached to the service:

    my-system# svcs -p apache2 
    STATE          STIME     FMRI 
    maintenance    17:57:36  svc:/network/http:apache2
    

    If the service were working and healthy the output would be:

    my-system# svcs -p apache2 
    STATE       STIME     FMRI 
    online      Jun_07    svc:/network/http:apache2 
                Jun_07    2880 httpd 
                Jun_07    2881 httpd 
                Jun_07    2882 httpd 
                Jun_07    2883 httpd 
                Jun_07    2884 httpd 
                Jun_07    2885 httpd 
    my-system#
    
  4. Look up the message ID (the highlighted line under step 2 above):
    http://sun.com/msg/SMF-8000-8Q
    

    When you look up the message ID on the URL provided, you will learn that this failure could be due to either a missing or broken file.

    In our example, we look in the directory for the Apache file and find that indeed it is missing. We then replace it. In this example, we simulated a lost file by changing the name of the file, so we change it back using the cp command:

    my-system# cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf
    
  5. To re-check the service status, use the svcs command:
    my-system# svcs apache2 
    STATE          STIME     FMRI 
    maintenance    11:38:37  svc:/network/http:apache2
    

    The service is still in maintenance.

  6. To restore the service, use the svcadm command, with the clear option:
    my-system# svcadm clear apache2
    
  7. To confirm it is back online, once again use the svcs command:
    my-system# svcs http 
    STATE       STIME     FMRI 
    online      11:40:45  svc:/network/http:apache2
    
  8. Get more details using the -xv option of the svcs command:
    my-system# svcs -xv apache2 
    svc:/network/http:apache2 (Apache 2 HTTP server) 
     State: online since Tue Jun 06 11:40:45 2006 
       See: man -M /usr/share/man -s 1M apache2 
       See: /var/svc/log/network-http:apache2.log 
    Impact: None.
    

    You can see that the Apache service has been online since Jun 06 11:40:45 2006. By looking the time provided by the State line, you can determine whether a service has been restarted. In our example, we know the service has been restarted. On a production system this type of information can be very useful.

Failing the Apache Service

A failure of the Apache service can be induced using the following commands.

  1. To check that the service is running, use the svcs command:
    my-system# svcs apache2 
    STATE STIME FMRI 
    STATE       STIME     FMRI 
    disabled    11:37:45  svc:/network/http:apache2
    

    Apache is disabled.

  2. To enable Apache2, use the svcadm command with the enable option:
    my-system# svcadm enable apache2
    
  3. To check that the service was enabled, use the svcs command again:
    my-system# svcs apache2 
    STATE       STIME     FMRI 
    online      11:38:15  svc:/network/http:apache2
    
  4. To induce failure, first remove the file using the rm command and then kill the service using the pkill command:
    my-system# rm /etc/apache2/httpd.conf 
    
    my-system# pkill http
    

    The service is now stopped and will not be automatically restarted since the config file has been removed. We already saved a copy of the file under a different name for recovery.

how to improve PC performance

Here are some simple tips which can boost your PC speed.

1. CLEAN UP DISK ERRORS

Whenever a programme crashes or you experience some power outage, your PC may create some errors on hard disk. This slows down computer speed.
For this, check and clean any errors on the computer hard disk.
To run Disk Check go to My Computer. Now, right-click on the drive you want to check for errors and click Properties.

In Properties dialogue box, click on the Tools tab. In the Error-Checking section, press the Check Now button. Access Check Disk to check for errors on your computer.
Depending on the errors, it may take up to an hour to check and clean. This must be followed at least once a week.

2. Remove temporary files

Your PC stores temporary files whenever you browse through the Web. Also, your PC stores temporary files when you work on programmes like Microsoft Word or Excel. This ends up slowing down your PC speed. To overcome it you can use the Windows Disk Cleanup screen to rid your PC of these dead files.

To run Disk Cleanup go to My Computer. Right click on the drive you wish to check for errors and click Properties. In the Properties dialogue box, click Disk Cleanup. You can also use Disk Cleanup to clear unused files from your PC.
After scanning, the Disk Cleanup dialogue box lists the files you can remove from your computer.

3. Organise your data

Often when you search files your PC takes a lot of time to track them. This is because computer breaks files into pieces to increase the speed of access and retrieval. However, once updated, computer saves these files on the space available on the hard drive, which results in fragmented files. This makes your PC go slow because it then searches for all of the file’s parts.

You need a Disk Defragmenter programme to needle all your files back together.
For this, go to My Computer and right click on the drive you want to check for error and click Properties.

In the Properties dialogue box, click the Tools tab, and then in the Defragmentation section, click Defragment. In the Disk Defragmenter dialog box, select the disk and then click Analyse.

After analysing your PC, the Disk Defragmenter pops up a message asking whether you need to defragment your computer or not. Once you defragement your PC, it will reorganise files by programme and size.

4. INSTALL ANTIVIRUS.

Biggest culprits behind slow PC performance are viruses and spyware. Both end up reducing your PC speed. Not only this they can also destroy your data and tamper files.

Also, with the 24X7 online environment, it is important to have anti-virus and anti-spyware programmes installed for secure online experience.

These programmes need to be frequently updated to avoid any attack on your computer.

You can do a recee of the Net for popular anti-virus and anti-spyware solutions. There are also several paid options like McAfee, Norton Anti-virus and Trend Micro.

5. REDUCE PAGE HISTORY

Is your PC giving you trouble while accessing the Internet? Don’t worry. For Internet Explorer users, Microsoft has some rescue options for faster Web browsing.

To improve your PC speed, first reduce the size of your Web page history. For this go to Internet Explorer, and on the Tools menu click on Internet Options. Then go to the History section and type in the number of days you want to keep pages in history.

Preferably reduce the number of days as this will reduce the size of your Web page history.

6. AUTOMATE MICROSOFT UPDATES

For Windows users, Microsoft frequently release updates which may help boost up your PC speed. For this activate automate Microsoft Update so that your computer downloads and installs all the latest updates without giving you any trouble of finding any new releases.

Go to Start menu and click Control Panel. In the Automatic Updates dialog box, check the Automatic check box. If your PC finds any new updates, it will automatically download and install them. This will help you keep your computer up to date.

Enjoy!!

Health Tips for keeping healthy heart. :-)

A chat with Dr.Devi Shetty ,

Narayana Hrudayalaya

( Heart Specialist) Bangalore was arranged by WIPRO for its employees . The transcript of the chat is given below. Useful for everyone.

Qn: What are the thumb rules for a layman to take care of his heart ?

Ans:
1. Diet – Less of carbohydrate, more of protein, less oil
2. Exercise – Half an hour’s walk, at least five days a week; avoid lifts and avoid sitting for a longtime
3. Quit smoking
4. Control weight
5. Control blood pressure and sugar

Qn: Is eating non-veg food (fish) good for the heart?

Ans: No

Qn: It’s still a grave shock to hear that some apparently healthy person
gets a cardiac arrest. How do we understand it in perspective?

Ans: This is called silent attack; that is why we recommend everyone past the age of 30 to undergo routine health checkups.

Qn: Are heart diseases hereditary?

Ans: Yes
Qn: What are the ways in which the heart is stressed? What practices do you suggest to de-stress?

Ans: Change your attitude towards life. Do not look for perfection in everything in life.

Qn: Is walking better than jogging or is more intensive exercise required to keep a healthy heart?

Ans: Walking is better than jogging since jogging leads to early fatigue and injury to joints .

Qn: You have done so much for the poor and needy. What has inspired you to do so?

Ans: Mother Theresa , who was my patient.

Qn: Can people with low blood pressure suffer heart diseases?

Ans: Extremely rare

Qn: Does cholesterol accumulates right from an early age

(I’m currently only 22) or do you have to worry about it only after you are above 30 years of age?

Ans: Cholesterol accumulates from childhood.

Qn: How do irregular eating habits affect the heart ?

Ans: You tend to eat junk food when the habits are irregular and your body’s enzyme release for digestion gets confused.

Qn: How can I control cholesterol content without using medicines?

Ans: Control diet, walk and eat walnut.

Qn: Can yoga prevent heart ailments?

Ans: Yoga helps.

Qn: Which is the best and worst food for the heart?

Ans: Fruits and vegetables are the best and the worst is oil.

Qn: Which oil is better – groundnut, sunflower, olive?

Ans: All oils are bad .

Qn: What is the routine checkup one should go through? Is there any specific test?

Ans: Routine blood test to ensure sugar, cholesterol is ok. Check BP, Treadmill test after an echo.

Qn: What are the first aid steps to be taken on a heart attack?

Ans: Help the person into a sleeping position , place an aspirin tablet under the tongue with a sorbitrate tablet if available, and rush him to a coronary care unit since the maximum casualty takes place within the first hour.

Qn: How do you differentiate between pain caused by a heart attack and that caused due to gastric trouble?

Ans: Extremely difficult without ECG.

Qn: What is the main cause of a steep increase in heart problems amongst youngsters? I see people of about 30-40 yrs of age having heart attacks and serious heart problems.

Ans: Increased awareness has increased incidents. Also, edentary lifestyles, smoking, junk food, lack of exercise in a country where people are genetically three times more vulnerable for heart attacks than Europeans and Americans.

Qn: Is it possible for a person to have BP outside the normal range of 120/80 and yet be perfectly healthy?

Ans: Yes.

Qn: Marriages within close relatives can lead to heart problems for the child. Is it true?

Ans : Yes, co-sanguinity leads to congenital abnormalities and you may not have a software engineer as a child

Qn: Many of us have an irregular daily routine and many a times we have to stay late nights in office. Does this affect our heart ? What precautions would you recommend?

Ans : When you are young, nature protects you against all these irregularities. However, as you grow older, respect the biological clock.

Qn: Will taking anti-hypertensive drugs cause some other complications (short / long term)?

Ans : Yes, most drugs have some side effects. However, modern anti-hypertensive drugs are extremely safe.

Qn: Will consuming more coffee/tea lead to heart attacks?

Ans : No.

Qn: Are asthma patients more prone to heart disease?

Ans : No.

Qn: How would you define junk food?

Ans : Fried food like Kentucky , McDonalds , samosas, and even masala dosas.

Qn: You mentioned that Indians are three times more vulnerable. What is the reason for this, as Europeans and Americans also eat a lot of junk food?

Ans: Every race is vulnerable to some disease and unfortunately, Indians are vulnerable for the most expensive disease.

Qn: Does consuming bananas help reduce hypertension?

Ans : No.

Qn: Can a person help himself during a heart attack (Because we see a lot of forwarded emails on this)?

Ans : Yes. Lie down comfortably and put an aspirin tablet of any description under the tongue and ask someone to take you to the nearest coronary care unit without any delay and do not wait for the ambulance since most of the time, the ambulance does not turn up.

Qn: Do, in any way, low white blood cells and low hemoglobin count lead to heart problems?

Ans : No. But it is ideal to have normal hemoglobin level to increase your exercise capacity.

Qn: Sometimes, due to the hectic schedule we are not able to exercise. So, does walking while doing daily chores at home or climbing the stairs in the house, work as a substitute for exercise?

Ans : Certainly. Avoid sitting continuously for more than half an hour and even the act of getting out of the chair and going to another chair and sitting helps a lot.

Qn: Is there a relation between heart problems and blood sugar?

Ans: Yes. A strong relationship since diabetics are more vulnerable to heart attacks than non-diabetics.

Qn: What are the things one needs to take care of after a heart operation?

Ans : Diet, exercise, drugs on time , Control cholesterol, BP, weight.

Qn: Are people working on night shifts more vulnerable to heart disease when compared to day shift workers?

Ans : No.

Qn: What are the modern anti-hypertensive drugs?

Ans : There are hundreds of drugs and your doctor will chose the right combination for your problem, but my suggestion is to avoid the drugs and go for natural ways of controlling blood pressure by walk, diet to
reduce weight and changing attitudes towards lifestyles.

Qn: Does dispirin or similar headache pills increase the risk of heart attacks?

Ans : No.

Qn: Why is the rate of heart attacks more in men than in women?

Ans : Nature protects women till the age of 45.

Qn: How can one keep the heart in a good condition?

Ans : Eat a healthy diet, avoid junk food, exercise everyday, do not smoke and, go for health checkup s if you are past the age of 30 ( once in six months recommended)…

What is SNMP? how to use SNMP?

This is a brief documentation on using the google-provided MIBs for GSA (Google Search Appliance). This can also be used as a reference to monitor any SNMP enabled device.

Terminologies:
—————
SNMP: SNMP stands for Simple Network Management Protocol and consists of three key components: managed devices, agents, and network-management systems (NMSs). A managed device is a node that has an SNMP agent and resides on a managed network. These devices can be routers and access server, switches and bridges, hubs, computer hosts, or printers. An agent is a software module residing within a device. This agent translates information into a compatible format with SNMP. An NMS runs monitoring applications. They provide the bulk of processing and memory resources required for network management.

MIB: MIB stands for Management Information Base and is a collection of information organized hierarchically. These are accessed using a protocol such as SNMP. There are two types of MIBs: scalar and tabular. Scalar objects define a single object instance whereas tabular objects define multiple related object instances grouped in MIB tables.

OID: OIDs or Object Identifiers uniquely identify manged objects in a MIB hierarchy. This can be depicted as a tree, the levels of which are assigned by different organizations. Top level MIB object IDs (OIDs) belong to different standard organizations. Vendors define private branches including managed objects for their own products.

Tools required:
—————-
In order to get more information on the OID, or to get list of all available params/OID from a device, or to get OID from MIB or vice-versa, it would help if we have access to a linux box with snmp-utils installed. This can be checked using:
$ rpm -qa |grep -i snmp
net-snmp-5.1.2-13.el4
net-snmp-libs-5.1.2-13.el4
net-snmp-utils-5.1.2-13.el4

And if not available, installed from yum. You need to copy the vendor provided MIB file to you home directory under:
/home/username/.snmp/mibs/

For example:
[jayesh@MY_SERVER mibs]# pwd
/home/ram/.snmp/mibs
[jayesh@MY_SERVER mibs]# ls -la
total 24
drwxr-xr-x  2 jayesh jayesh 4096 Oct 28 18:04 .
drwxr-xr-x  3 jayesh jayesh 4096 Oct 28 18:03 ..
-rw-r–r–  1 jayesh jayesh 702 Oct 28 17:56 GOOGLE-MIB.txt
-rw-r–r–  1 jayesh jayesh 5032 Oct 28 17:56 GSA-MIB.txt

Setting up the monitor:
————————–
Your monitoring tool (sitescope) is normally capable of monitoring the usual/standard metrics from an SNMP capable device. The more famous and widely used the device is, the better support. (Cisco, Linux etc).

In case the OIDs are not available to the monitoring system, they can always be imported from the manufacturer provided MIBs.

Monitor can be setup using the MIB or OID for that particular system. In case of GSA, the MIBs that we need to monitor are:
system.temperature.temperatureHealth.0
system.gsaDisk.diskHealth.0
system.machine.machineHealth.0

Or (in terms of complete MIBs)
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureHealth
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskHeal
th
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineH
ealth

Now, we can use the MIB directly to use for our monitoring or we can use the corresponding OID.

In order to get the list of OIDs corresponding to the MIBs, we can use the tools provided by the net-snmp-utils package.

Command:snmptranslate -m GSA-MIB -Ts
Function: to get the list of MIB trees

Command:snmptranslate -m GSA-MIB -To
Function: to get the list of OID

Using both the commands for GSA, we can get the following information:

OID                MIB
.1.3                .iso.org
.1.3.6                .iso.org.dod
.1.3.6.1            .iso.org.dod.internet
.1.3.6.1.1            .iso.org.dod.internet.directory
.1.3.6.1.2            .iso.org.dod.internet.mgmt
.1.3.6.1.2.1            .iso.org.dod.internet.mgmt.mib-2
.1.3.6.1.2.1.10
.iso.org.dod.internet.mgmt.mib-2.transmission
.1.3.6.1.3            .iso.org.dod.internet.experimental
.1.3.6.1.4            .iso.org.dod.internet.private
.1.3.6.1.4.1            .iso.org.dod.internet.private.enterprises
.1.3.6.1.4.1.11129
.iso.org.dod.internet.private.enterprises.google
.1.3.6.1.4.1.11129.1
.iso.org.dod.internet.private.enterprises.google.gsa
.1.3.6.1.4.1.11129.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl
.1.3.6.1.4.1.11129.1.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.crawlRunning
.1.3.6.1.4.1.11129.1.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status
.1.3.6.1.4.1.11129.1.1.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docsServed
.1.3.6.1.4.1.11129.1.1.2.2
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.crawlingRa
te
.1.3.6.1.4.1.11129.1.1.2.3
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docBytes
.1.3.6.1.4.1.11129.1.1.2.4
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.todayDocsC
rawled
.1.3.6.1.4.1.11129.1.1.2.5
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docErrors
.1.3.6.1.4.1.11129.1.1.2.6
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docsFound
.1.3.6.1.4.1.11129.1.1.2.7
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
Running
.1.3.6.1.4.1.11129.1.1.2.8
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
StartTime
.1.3.6.1.4.1.11129.1.1.2.9
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
EndTime
.1.3.6.1.4.1.11129.1.1.2.10
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
EndReason
.1.3.6.1.4.1.11129.1.1.3
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.diagnostics
.1.3.6.1.4.1.11129.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.serving
.1.3.6.1.4.1.11129.1.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.serving.qpm
.1.3.6.1.4.1.11129.1.3
.iso.org.dod.internet.private.enterprises.google.gsa.system
.1.3.6.1.4.1.11129.1.3.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk
.1.3.6.1.4.1.11129.1.3.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskHeal
th
.1.3.6.1.4.1.11129.1.3.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskErro
rs
.1.3.6.1.4.1.11129.1.3.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature
.1.3.6.1.4.1.11129.1.3.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureHealth
.1.3.6.1.4.1.11129.1.3.2.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureErrors
.1.3.6.1.4.1.11129.1.3.3
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine
.1.3.6.1.4.1.11129.1.3.3.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineH
ealth
.1.3.6.1.4.1.11129.1.3.3.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineE
rrors
.1.3.6.1.4.1.11129.1.4
.iso.org.dod.internet.private.enterprises.google.gsa.search
.1.3.6.1.4.1.11129.1.4.1
.iso.org.dod.internet.private.enterprises.google.gsa.search.reports
.1.3.6.1.4.1.11129.1.4.2
.iso.org.dod.internet.private.enterprises.google.gsa.search.logs
.1.3.6.1.4.1.11129.1.5
.iso.org.dod.internet.private.enterprises.google.gsa.eventLogs
.1.3.6.1.5            .iso.org.dod.internet.security
.1.3.6.1.6            .iso.org.dod.internet.snmpV2
.1.3.6.1.6.1            .iso.org.dod.internet.snmpV2.snmpDomains
.1.3.6.1.6.2            .iso.org.dod.internet.snmpV2.snmpProxys
.1.3.6.1.6.3            .iso.org.dod.internet.snmpV2.snmpModules
.0.0                .ccitt.zeroDotZero

Now, we can use this information, to setup the monitor for the system. (we would need the IP address of the device, the community string, and of course, access to SNMP-readonly)

I would guess, SiteScope needs the OID, community string, and the IP address of the device to monitor.

Here is an example shell script, that uses snmp-utils (snmpget) and the GSA
MIBS:

#!/bin/bash
#set -o xtrace
DEVICE=”Yur_IP_HERE”
MIBS=”system.temperature.temperatureHealth.0 system.gsaDisk.diskHealth.0 system.machine.machineHealth.0″
# GSA-MIB::diskHealth.0 = INTEGER: green(0) for MIB in ${MIBS} do

RESULT=`snmpget -m GSA-MIB -v 2c -c public -t 5 ${DEVICE} ${MIB}| cut -f4 -d”:” | grep -E -o “[0-9]”`

case ${RESULT} in
0) STATUS=”Good”;;
1) STATUS=”Warning”;;
2) STATUS=”Critical”;;
*) STATUS=”Unreachable/Unknown”;;
esac

if [ ${STATUS} != “Good” ]
then
(
PARAM=`echo ${MIB}|cut -f3 -d”.”`
echo “From: MY_EMAIL_FROM@DOMAIN.COM”
echo “To: MY_EMAIL@DOMAIN.COM”
echo “Subject: [GSA] ${PARAM} ${STATUS}”
echo “GSA Device ${DEVICE} is in ${STATUS} state for ${PARAM}. Please investigate.”
)| sendmail -t
fi
Done

How to check the installed mod_jk version

2 ways you can do that.

1. Better approach is
# strings /PATH/TO/APACHE/modules/mod_jk.so |grep -i mod_jk
mod_jk.so
mod_jk.c
mod_jk/1.2.18 <-- There you go. 2. If you have that already installed then if you have enable mod_jk log then you can check from that log file or you can do http://Your_SERVER/ApplicationURL/SomeFOLDER/@#@#CS<>>$#$#$% You will get internal serever error over there at the bottom you will get the mod_jk version with apache version. e.g. Apache/2.0.59 (Unix) mod_jk/1.2.28

Steps to create SSL certificate

Change directory to conf/cert of your Apache SSL instance home

Generate key and CSR using the CN as the name of the web-site this apache instance will host. (Check the end of the doc to create csr)

Now you will have to give this CSR to the third party company and purchase the SSL certificate from them.

Steps to follow once we get the signed certificate:

Take the backup of previous certificate and then copy
EntrustSecureServerCA.crt
TrustedSecureCertificateAuthority.crt

ssl_home_ge_com.crt and replace the MY_SERVER1.key ( which gets created from step 3)

Restart the apachessl after all the changes. To use this certificate on other server2 , copy all the certificates there and rename MY_SERVER1.key to MY_SERVER2.key )

# openssl req -new -nodes -keyout MY_SERVER1.key -out MY_SERVER1csr

Crash in HotSpot Compiler Thread or Compiled Code

If the fatal error log indicates that the crash occurred in a compiler thread, then it is possible (but not always the case) that you have encountered a compiler bug. Similarly, if the crash is in compiled code then it is possible that the compiler has generated incorrect code.

In the case of the HotSpot Client VM (-client option), the compiler thread appears in the error log as CompilerThread0. With the HotSpot Server VM there are multiple compiler threads and these appear in the error log file as CompilerThread0, CompilerThread1, and AdapterThread.

Below is a fragment of an error log for a compiler bug that was encountered and fixed during the development of J2SE 5.0. The log file shows that the HotSpot Server VM is used and the crash occurred in CompilerThread1. In addition, the log file shows that the Current CompileTask was the compilation of the java.lang.Thread.setPriority method.

# An unexpected error has been detected by HotSpot Virtual Machine:
#
:
# Java VM: Java HotSpot(TM) Server VM (1.5-internal-debug mixed mode)
:
---------------  T H R E A D  ---------------

Current thread (0x001e9350): JavaThread "CompilerThread1" daemon [_thread_in_vm, id=20]

Stack: [0xb2500000,0xb2580000),  sp=0xb257e500,  free space=505k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xc3b13c]
:

Current CompileTask:
opto: 11      java.lang.Thread.setPriority(I)V (53 bytes)

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00229930 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=21]
=>0x001e9350 JavaThread "CompilerThread1" daemon [_thread_in_vm, id=20]
 :

In this case there are two potential workarounds:

  • The brute force approach: change the configuration so that the application is run with the -client option to specify the HotSpot Client VM.
  • Assume that the bug only occurs during the compilation of the setPriority method and exclude this method from compilation.

The first approach (to use the -client option) might be trivial to configure in some environments. In others, it might be more difficult if the configuration is complex or if the command line to configure the VM is not readily accessible. In general, switching from the HotSpot Server VM to the HotSpot Client VM also reduces the peak performance of an application. Depending on the environment, this might be acceptable until the actual issue is diagnosed and fixed.

The second approach (exclude the method from compilation) requires creating the file .hotspot_compiler in the working directory of the application. Below is an example of this file:

exclude    java/lang/Thread    setPriority

In general the format of this file is exclude CLASS METHOD, where CLASS is the class (fully qualified with the package name) and METHOD is the name of the method. Constructor methods are specified as <init> and static initializers are specified as <clinit>.


Note – The .hotspot_compiler file is an unsupported interface. It is documented here solely for the purposes of troubleshooting and finding a temporary workaround.


Once the application is restarted, the compiler will not attempt to compile any of the methods listed as excluded in the .hotspot_compiler file. In some cases this can provide temporary relief until the root cause of the crash is diagnosed and the bug is fixed.

In order to verify that the HotSpot VM correctly located and processed the .hotspot_compiler file that is shown in the example above, look for the following log information at runtime. Note that the file name separator is a dot, not a slash.

### Excluding compile:    java.lang.Thread::setPriority

Script for oracle Database monitoring

shell script for DB monitoring.

[root@MY_SERVER1 monitor]#
#!/bin/bash
count=0;
SCRIPT_HOME=”/Your/folder/”
MONITOR_SCRIPT=”${SCRIPT_HOME}/MyEnv_db_monitor.pl”
LOCKFILE=/tmp/MyEnv_db_monitor.lock

if [ -f “${LOCKFILE}” ]
then
(
echo “${LOCKFILE} ALREADY EXISTS.. DB monitor will not run”
ls -la ${LOCKFILE}
) | mail -s “MY ENVIRONMENTDB Monitor is not running. Lock” MY_EMAIL@DOMAIN.com
else
touch ${LOCKFILE}
dblisteners=(IP2:PORT2 IP2:PORT1)
len=${#dblisteners[*]} #Num elements in array

#echo “dblisteners are $len members.They are:”
i=0
while [ $i -lt $len ]; do
#       echo “${dblisteners[$i]}”
server=`echo “${dblisteners[$i]}” | cut -d: -f1`
port=`echo “${dblisteners[$i]}” | cut -d: -f2`
#       echo $server $port
${MONITOR_SCRIPT} $server $port > /dev/null 2>&1
if [ $? -eq 0 ]
then
count=$((count+1))
fi

let i++
done
# ${MONITOR_SCRIPT} > /dev/null 2>&1
if  [ $count -eq 2 ]
then
rm ${LOCKFILE}
fi
fi

——————————————————————

[root@MY_SERVER1 monitor]# cat /Your/folder/MyEnv_db_monitor.sh
#!/bin/bash
count=0;
SCRIPT_HOME=”/Your/Folder”
MONITOR_SCRIPT=”${SCRIPT_HOME}/MyEnv_db_monitor.pl”
LOCKFILE=/tmp/MyEnv_db_monitor.lock

if [ -f “${LOCKFILE}” ]
then
(
echo “${LOCKFILE} ALREADY EXISTS.. DB monitor will not run”
ls -la ${LOCKFILE}
) | mail -s “MY ENVIRONMENTStage DB Monitor is not running. Lock” MY_EMAIL@DOMAIN.com
else
touch ${LOCKFILE}
dblisteners=(IP1:PORT1 IP2:PORT2)
len=${#dblisteners[*]} #Num elements in array

#echo “dblisteners are $len members.They are:”
i=0
while [ $i -lt $len ]; do
#       echo “${dblisteners[$i]}”
server=`echo “${dblisteners[$i]}” | cut -d: -f1`
port=`echo “${dblisteners[$i]}” | cut -d: -f2`
#       echo $server $port
${MONITOR_SCRIPT} $server $port > /dev/null 2>&1
if [ $? -eq 0 ]
then
count=$((count+1))
fi

let i++
done
# ${MONITOR_SCRIPT} > /dev/null 2>&1
if  [ $count -eq 2 ]
then
rm ${LOCKFILE}
fi
fi
[root@MY_SERVER1 monitor]# cat /Your/folder/MyEnv_db_monitor.pl
#!/usr/bin/perl -w

use warnings;
use strict;
use DBI;

BEGIN {
$ENV{ORACLE_HOME}=’/opt/oracle/product/9.2.0′;
$ENV{LD_LIBRARY_PATH}=’/opt/oracle/product/9.2.0/lib’;
}

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
my $timestamp = sprintf(“%4d-%02d-%02d %02d:%02d:%02dn”,$year+1900,$mon+1,$mday,$hour,$min,$sec);
chomp $timestamp;
print “The time is $timestampn”;

my $server = $ARGV[0];
my $appsport = $ARGV[1];
chomp $server; chomp $appsport;
print “The server is $server connecting to $appsport n”;
my $mail = “/usr/lib/sendmail -t”;
my $recipient = “MY_EMAIL@DOMAIN.COM”;
my $from = “MyEnv_db_monitor@DOMAIN.COM”;
my $timeOut = 60; # wait 60 seconds for connection
my $db = “DBNAME”;
my ($username, $password) = (‘DB_SCHEMA_NAME’,’DB_PASSWORD’);
#my $db_conn_dsn=”dbi:Oracle:host=DB_SERVER_NAME;port=PORT;sid=$db”;
my $db_conn_dsn=”dbi:Oracle:host=DB_SERVER_NAME;port=${appsport};sid=$db”;
my $flag = “/tmp/dbdbflag2.txt$server”;
my $qflag = “/tmp/dbtaskqueflag2.txt$server”;
my $rowcount = “”;
my $dummyflag = “/tmp/dbdummyflag2.txt$server”;

if ( -e $flag ) { # Check for DB status flag file
print “DB Flag exists.n”;
} else { # Create flag file
system “/bin/touch $flag”;
}

if ( -e $qflag ) { # Check for task que status flag file
print “Task que flag exists.n”;
} else { # Create flag file
system “/bin/touch $qflag”;
}

my $flagstatus = `/bin/cat $flag`;
chomp $flagstatus;
print “The status of the db flag is $flagstatusn”;

my $qflagstatus = `/bin/cat $qflag`;
chomp $qflagstatus;
print “The status of the task que flag is $qflagstatusn”;

if ( -e $dummyflag ) { # Check for Dummy status flag file
print “Dummy Flag exists.n”;
system “/bin/touch $dummyflag”;
} else { # Create flag file
system “/bin/touch $dummyflag”;
}

my $mtime_qflag = (stat($qflag))[9];
my $mtime_dflag = (stat($dummyflag))[9];

print “The mtime for qflag is $mtime_qflag secsn”;
print “The mtime for dflag is $mtime_dflag secsn”;

my $refresh_interval = ($mtime_dflag-$mtime_qflag)/3600;

print “The que flag has been refreshed since $refresh_interval hoursn”;

if (( $refresh_interval > 24 ) && ( $qflagstatus ne “LESS” )) {
system “echo BLANK > $qflag”;
} else {
print “The refresh interval is $refresh_interval hours and the flag status is $qflagstatusn”;
}

if ($db) {
print “checking $dbn”;
my $dbh=”;
eval {
#set alarm to timeout current operation
local $SIG{ALRM} = sub {die “connection timeoutn”};
alarm $timeOut;
print “Trying to connect to $db with $username and $passwordn”;
$dbh = DBI->connect($db_conn_dsn,$username,$password, { RaiseError => 1 } ) || die “Database connection not made: $DBI::errstr”;
};
alarm 0; # reset the alarm
if ($dbh) { # success
print “Connection succeeded for $dbn”;

my $sql = “select count(*) from vap_default.taskqueue”;
my $sth = $dbh->prepare($sql) or die “Cannot prepare sql statement” . $dbh->errstr(). “n”;
$sth->execute() or die “cannot execute sql query” . $sth->errstr() . “n”;
($rowcount) = $sth->fetchrow_array();
$sth->finish;
print “The task queue row count is $rowcountn”;

$dbh->disconnect;

print “DB is now up.n”;
if ( $flagstatus eq “DOWN” ) {
system “echo ‘RECOVERED’ > $flag”;
print “The DB has just recovered at $timestamp.n”;
&upmail;
} else {
print “Do nothing. DB was anyways up.n”;
}

print “Just outside failure blockn”;

} else { # failure
print “Inside failure blockn”;
if ( $flagstatus eq “DOWN” ) {
print “Do nothing. DB is still downn”;
} else {
print “Error connecting to $db at $timestampn”;
&downmail;
system “echo ‘DOWN’ > $flag”;
}
}
}

sub downmail {
open(MAIL, “|$mail”);
print MAIL “To: $recipientn”;
print MAIL “From: $fromn”;
print MAIL “Subject: MY ENVIRONMENTStage DATABASE_NAME on  Database Connection Failure $server $appsportn”;
print MAIL “$timestamp: FAILED CONNECTION TO MY ENVIRONMENT DATABASE.nnTurning Big-IP monitors OFF. $server $appsport”;
close MAIL;
system(“/Your/folder/disable_remote_tomcats.sh $server $appsport”);
}

sub upmail {
open(MAIL, “|$mail”);
print MAIL “To: $recipientn”;
print MAIL “From: $fromn”;
print MAIL “Subject: MY ENVIRONMENT DATABASE_NAME on  Database Connection Recovered $server $appsportn”;
#print MAIL “$timestamp: RECOVERED CONNECTION TO MY ENVIRONMENT DATABASE.nnTurning Big-IP monitors ON”;
print MAIL “$timestamp: RECOVERED CONNECTION TO MY ENVIRONMENTDATABASE.”;
close MAIL;
system(“/Your/folder/enable_remote_tomcats.sh $server $appsport”);
}

sub qmoremail {
open(MAIL, “|$mail”);
print MAIL “To: $recipientn”;
print MAIL “From: $fromn”;
print MAIL “Subject: MY ENVIRONMENTDATABASE_NAMEon  Vignette Task Queue Record Countn”;
print MAIL “$timestamp: TASK QUEUE RECORD COUNT = $rowcountnn”;
close MAIL;
}

sub qlessmail {
open(MAIL, “|$mail”);
print MAIL “To: $recipientn”;
print MAIL “From: $fromn”;
print MAIL “Subject: MY ENVIRONMENTDATABASE_NAMEon  Vignette Task Queue Record Countn”;
print MAIL “$timestamp: TASK QUEUE RECORD COUNT = $rowcountnn”;
close MAIL;
}

——————————————————————————————

Not Mendatary– but require in my environment thats why I added this.. In order to enable disaster recovery site.

[root@MY_SERVER1 monitor]# cat “/Your/folder/disable_remote_tomcats.sh”
#!/bin/bash

tomcat_user=”tomcat0″;
tomcat_node=$1;
#for tomcat_node in ${nodes}
#do
for tomcats in `seq 0 1`
do
ssh ${tomcat_user}@${tomcat_node} “mv /appl/tomcat${tomcats}/webapps/portal/Status/Status.jsp /appl/tomcat${tomcats}/webapps/portal/Status/Status.jsp.old”
done
#done

echo “${tomcat_node}  tomcat nodes are disabled in BigiP.” | mail -s “${tomcat_node} tomcat nodes are disabled” MY_EMAIL@DOMAIN.com
#echo “All tomcat nodes are disabled in BigiP. Enabling DR nodes” | mail -s “[DR Enabled] MY ENVIRONMENTApp Status Pages” YOUR_EMAIL@DOMAIN.COM
#/Your/folder/enable_dr.sh

[root@MY_SERVER1 monitor]#

[root@MY_SERVER1 monitor]# cat /Your/folder/enable_dr.sh
#!/bin/bash
drnodes=”MY_DR_NODE1 MY_DR_NODE2″

for dr_node in ${drnodes}
do
/usr/bin/ssh root@${dr_node} “mv /appl/webdocs/portal/Status/Status.jsp.down /appl/webdocs/portal/Status/Status.jsp”
done

echo “enabling DR nodes on `/bin/date`.” | /bin/mail -s “enabling DR nodes” YOUR_EMAIL@DOMAIN.COM MY_EMAIL@DOMAIN.COM

[root@MY_SERVER1 monitor]#

——————————————————————————————
[root@MY_SERVER1 monitor]# cat “/Your/folder/enable_remote_tomcats.sh”
#!/bin/bash

#nodes=”MY_SERVER1 MY_SERVER2″
tomcat_user=”tomcat0″;
tomcat_node=$1;

#for tomcat_node in ${nodes}
#do
for tomcats in `seq 0 1`
do
ssh ${tomcat_user}@${tomcat_node} “mv /appl/tomcat${tomcats}/webapps/portal/Status/Status.jsp.old /appl/tomcat${tomcats}/webapps/portal/Status/Status.jsp”
done
#done

#echo “${tomcat_node} All Tomcat Status pages are up. Trying to handle DR nodes…” | mail -s “[Restored] MY ENVIRONMENT App Status Pages” MY_EMAIL@DOMAIN.com
echo “${tomcat_node} All Tomcat Status pages are up.” | mail -s “[Restored] MY ENVIRONMENT App Status Pages” MY_EMAIL@DOMAIN.com
#/Your/folder/manage_dr.sh

[root@MY_SERVER1 monitor]#

[root@MY_SERVER1 monitor]# cat /Your/folder/manage_dr.sh
#!/bin/bash
#set -o xtrace
drnodes=”MY_DR_NODE2 MY_DR_NODE1″
poolcount1=0;
poolcount2=0;
STATUS_URI=”portal/Status/Status.jsp”
pool1=”URL1
URL2″
pool2=”URL3
URL4″

for MyEnv_node in ${pool1}
do
status=`/usr/bin/lynx –connect_timeout=3 –dump http://${MyEnv_node}.corporate.ge.com/${STATUS_URI} | grep “ITS_UP” | wc -l`
poolcount228=$((poolcount228+status))
done

for MyEnv_node in ${pool2}
do
status=`/usr/bin/lynx –connect_timeout=3 –dump http://${MyEnv_node}/${STATUS_URI} | grep “ITS_UP” | wc -l`
pool2count=$((pool2count+status))
done

#if [ $pool1count -ge 2 -a ${pool2count} -ge 2 ]
if [ $pool2count -ge 2 ]
then
for dr_node in ${drnodes}
do
/usr/bin/ssh root@${dr_node} “mv /appl/webdocs/portal/Status/Status.jsp /appl/webdocs/portal/Status/Status.jsp.down”
done
echo “disabling DR nodes on `date`. Will be re-enabled in 20 mins” | mail -s “Disabling DR nodes” YOUR_EMAIL@DOMAIN.COM MY_EMAIL@DOMAIN.COM
/usr/bin/at -f /Your/folder/enable_dr.sh  now + 20 min
else
echo -e “DR Nodes still kept UP, since dynamic nodes are not upnWill retry in 5 mins from now” | mail -s “DR nodes still UP” YOUR_EMAIL@DOMAIN.COM MY_EMAIL@DOMAIN.COM
/usr/bin/at -f /Your/folder/manage_dr.sh  now + 5 min
fi

[root@MY_SERVER1 monitor]#

Internet Explorer shortcut keys

Shortcut Keys Description
Alt + Left Arrow Back a page.
Backspace Back a page.
Alt + Right Arrow Forward a page.
F5 Refresh current page, frame, or tab.
F11 Display the current website in full screen mode. Pressing F11 again will exit this mode.
Esc Stop page or download from loading.
Ctrl + (- or +) Increase or decrease the font size, pressing ‘-‘ will decrease and ‘+’ will increase.
Ctrl + Enter Quickly complete an address. For example, type tcs in the address bar and press CTRL + ENTER to get http://www.tcs.com/
Ctrl + D Add a Favorite for the page currently opened.
Ctrl + I Display available bookmarks.
Ctrl + N Open New browser window.
Ctrl + P Print current page / frame.
Ctrl + T Opens a new tab.
Ctrl + F4 Closes the currently selected tab.
Ctrl + Tab Moves through each of the open tabs.
Spacebar Moves down a page at a time.
Shift + Spacebar Moves up a page at a time.
Alt + Down arrow Display all previous text entered in a text box and/or available options on drop down menu.
Alt + D Highlights the text in the address bar