Brief about the initial process sequence while the system boots up.

While booting, special process called the ‘swapper’ or ‘scheduler’ is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children:

  • the process dispatcher,
  • vhand and
  • dbflush

with IDs 1,2 and 3 respectively.
This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el).

How does the inode map to data block of a file?

Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block. The 13th address points to a three-level(triple in-direction)index block. This provides a very large maximum file size with efficient access to large files, but also small files are accessed directly in one disk read.

Useful tools for techies especially for developers and sys admin

There are many situation in programming and testing where we can use these tools to get our work done faster and effectively.

1) Firebug Download
Very interesting tool. Can not live without it if you really have to do Javascript and CSS testing. Not only that it also helps in request tracking and cookie management.

2) FireCookie download
Another interesting FireFox add on for cookie management. You can change the cookie on the fly and add new cookie whenever required. Very use full if your site is using cookie intensively.

3) YSlow Download
Add on to firefox, very use full if you have to asses performance of your site. specially recommendation and site score by Yslow is use full to improve overall performance of site.

4) Web Developer Download
Add on to firefox. You can do ton of things from debugging java script to changing and testing css, HTML on the fly with web developer tool. Have to have tool for HTML developer.

5) HTTP Watch Download
Very use full tool for both IE and firefox for inspecting http traffic on site. Very use full to debug some performance issue. Can watch AJAX request and response and debug it. You cn also use Net tab in firebug for same perpose though. But some time I feel Net tab doesn’t work, HTTP Watch is more relaiable.

6) Fiddler Download
ooooo … debugging traffic and web issue in IE is really difficult. Fiddler is one of those tool that can help to watch traffic on site easily.

7) Samurai Thread dump analyzer Download
Very use full tool to analyze thread dump. If your site is having performance issues (100% CPU usage). You can use this tool to analyze all the waiting threads. You can take thread dump using command kill -3

8) JadEclipse Download JAD Executable Download
Use full tool to decompile class file in eclipse. After installing JAD eclipse, go to windows -> preferences -> Jad Eclipse -> and set Path to decompiler as C:JADjad.exe and Directory as temp file as D:TEMP. for jad eclipse to work.

9) Jmeter Download
Very use full tool to do load testing. Since this tool is free you can easily do load testing on your site whenever you want. Also this tool is very easy to set up and configure.

10) HTML Parser Download
Another Use full free java API to parse HTML. Documentation of this API is not good though with some inspection you will find this API very interesting and easy to use.

11) Regular Expression check Link
If you are using regular expression a lot, this web site will help you to create and test your regular expression. I use this link quite often to test my regex expressions.

12) Key Notes Download
Well, This is not any tool as such but very use full to keep your notes.

13) Java Code analyzer tool Download Download for eclipse
It is a very use full tool to analyze Java code performance. There are plug ins available for many IDE. Tool also tells you if you have any code issue in your code (Null pointer exception and all). Very use full to develop a quality code.

14) Message Post tool (Wget) Download
Wget is very handy massage POST tool and can be used to POST XML across applications.

15) Visual VM (Java Profiling tool) Download
Very nice and neat free Java profiling tool. For enterprise application I will even recommend YourKit Download. But for quick and free memory issue problems you can can use this tool effectively. You should have Java 6.0 for this to run.

16) Any Edit plugin for eclipse Download
If the JSP pages contains a lot of white spaces or tabs, it may take more time to load the page and requires more network band width. Any Edit is a nice tool to remove unnecessary spaces from the page.

17) Heap Dump Analyzer (MAT) Download
Some time your application suffer with memory issues, for example out of memory error. And you don’t have any idea what is going on. There are many different reasons for out of memory error but most common is memory leak. Eclipse Memory Analyzer (MAT) is a power full to tool to analyze heap dump and narrow down the problem. Please note that you should have -XX:+HeapDumpOnOutOfMemoryError parameter set to collect heap dump. Java 1.6 also comes with a tool called jmap (memory map) to force heap dump. More information can be found here.

../../../libraries/libldap/error.c:273: ldap_parse_result: Assertion `r != ((void *)0)’ failed

If you are getting error as mentioned below while doing some operation your linux server bash shell.
../../../libraries/libldap/error.c:273: ldap_parse_result: Assertion `r != ((void *)0)’ failed

Then its due to nss-ldap software running on your server. One of the reason I found and fixed with was nscd service was down on my server restarting it fixed the issue.

Error I saw in logs were..

/var/log/messages:

Oct 28 03:01:27 HOSTNAME nscd: nss_ldap: reconnected to LDAP server ldap://domain.com/ after 1 attempt
Nov 10 02:49:58 HOSTNAME nscd: nss_ldap: reconnecting to LDAP server (sleeping 4 seconds)…
Nov 10 02:50:14 HOSTNAME nscd: nss_ldap: reconnected to LDAP server ldap://domain.com/ after 2 attempts
Jan 18 07:45:09 HOSTNAME kernel: nscd[5114]: segfault at 00002b1c735dee78 rip 00002b1b6d4fe885 rsp 000000004185c6d0 error 4

Fix :
[root@HOSTNAME webdocs]# /etc/init.d/nscd status
nscd dead but subsys locked
You have new mail in /var/spool/mail/root
[root@HOSTNAME webdocs]# /etc/init.d/nscd restart
Stopping nscd: [FAILED]
Starting nscd: [ OK ]
[root@HOSTNAME webdocs]# /etc/init.d/nscd status
nscd (pid 30292) is running…
You have new mail in /var/spool/mail/root
[root@HOSTNAME webdocs]#

fetchmail: client/server synchronization error Query status=7 (ERROR)

IMAP commands to test DELETE of message
One of the more common commands that seems to fail is the DELETE command from the device. This can sometimes be caused by the user not having a Trash folder, or the Trash folder not being at the top level of the message store. It sometimes helps to telnet into the user’s account and perform the same IMAP commands that the NotifyLink server is performing, in order to see where we may be failing. To do so:
1. Telnet into the mail server over port 143 and login to the user’s mailbox. To login, the IMAP command is: a login username password , where you replace the username and password with the user’s actual email username and password.
2. Select the folder where the original message to be deleted is located. For example, if it is in the INBOX folder, then type: a select INBOX
3. We now need to know the UID of the message you want to delete. You can either pull this from the MessageID field of NotificationCheckpoint table based on the NotifyLink MID that we are trying to delete. Or if you don’t know the UID, you can use the FETCH command like: a FETCH 1 (UID) , where 1 is the index of the message in the folder. So in this example you are trying to get the UID for the first message in the folder, where the first message is the OLDEST message in the folder.
4. Using the UID from step 3, now copy the message to the trash folder (suppose its UID is 123) : a uid copy 123 trash
5. Now mark the message as deleted: a uid store 123 +flags.silent (Seen Deleted)
6. Finally, expunge the inbox by calling: a expunge
Determining where in the process that we fail may help in determining the root cause of why the DELETE command is failing.

#telnet server 143
And follow above instruction..

– Jayesh

how to check oracle client version on linux

You can try by which is not the correct way..

strings $ORACLE_HOME/bin/oracle|grep "XML Schema Processor version"
but thats not the correct way because some of the client installs don't have an Oracle binary, just a client
library shared object.  A similar method to the above for client-only installs would be:
The command for it is locate correct libclntsh.so file that you are using.
#strings $ORACLE_HOME/lib/libclntsh.so | grep '^Version [0-9]'
One challenge is that even if you find all copies of libclntsh.so on a
host, there is no guarantee that they are each part of a complete
install.  The only real way to make sure is to try using each one (set
ORACLE_HOME & LD_LIBRARY_PATH)

Each install that has been completed to installer standard should have
a line in the file /etc/oraInst.loc that says where the
oraInventory(s) are located on the host.  IIRC, Opatch.pl has some
code you could probably crib to query any given oraInventory.

Of course, the existence of an oraInventory that says there is a
client install somewhere does not guarantee that one exists and works.

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