Wednesday, September 12, 2012

How to disable wireless when connected to LAN + Dell Latitude E6430

Settings wireless to turn off on physical LAN connection

 
Go to BIOS by press F12 during reboot.


Power Mgt ==> wireless radio control == > check the "Control WLAN RADIO & Control WWAN RADIO".

Reboot the laptop.

 Now it will


automatically disable wireless card/adapter  when connected to LAN
auto-switch wireless and lan on windows 7

 

 

 

ssh-keygen - Password-Less SSH Login

Step 1
[root@host1 ]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
dd:1c:62:5c:d0:87:39:f0:29:18:a0:f0:15:d2:a4:32 root@host1
The key's randomart image is:
+--[ RSA 2048]----+
|  . .o=o. o+.o   |
|   o =.  + o=..  |
|  E +   . = +o   |
|   o     o = .   |
|        S . o    |
|                 |
|                 |
|                 |
|                 |
+-----------------+

Step 2
[root@host1]# ssh-copy-id -i ~/.ssh/id_rsa.pub host2

Step3.
[root@host1 ]# ssh host2

Monday, September 10, 2012

Zabbix_get to know the items value + how to get the percente disk space usage by zabbix on windows OR “Not supported” by Zabbix.

for windows percentage disk space free

Template_Windows:vfs.fs.size[c:,free].last(0)}<1g br="br">(in item value use the "numeric unassigned")


Template_Windows:vfs.fs.size[c:,pfree].last(0)}<10 br="br">(in item value use the "numeric flot")
 OR
you can add:

HTML Code:
PerfCounter = LogicalDisk:PercentFreeSpaceOnC,"\LogicalDisk(C:)\% Free Space",900
PerfCounter = LogicalDisk:PercentFreeSpaceOnD,"\LogicalDisk(D:)\% Free Space",900

on you zabbix_agentd.conf. And create trigger to alert you when machine has lower then 10% or 5%


OR

Run zabbix_get on the Zabbix server machine.

for example

[root@abc ~]# zabbix_get -s 10.10.10.33 -k system.swap.size[,free]
5379874816
[root@abc ~]# zabbix_get -s 10.10.10.33 -k vfs.fs.size[c:,free]
56677302784
[root@abc ~]# zabbix_get -s 10.10.10.33 -k vfs.fs.size[c:,pfree]
77.957042
[root@abc ~]# zabbix_get -s 10.10.10.33 -k vfs.fs.size[c:,free]
56677367296


Troubleshooting:
If your item isn’t receiving any data even though there are error entries in the log then enable detailed logging in Zabbix to verify that the agent and server haven’t a problem. (If they do then the status of the item will be changed to “Not supported” by Zabbix.)

To enable logging, make sure there is DebugLevel=5 and LogFile=/var/log/zabbix-agent/zabbix_agentd.log (without a leading #)  in /etc/zabbix/zabbix_agentd.conf.

One possible cause of problem is if Hostname in /etc/zabbix/zabbix_agentd.conf and in the Zabbix UI differ, f.ex. if one of them is fully qualified and the other isn’t.

Saturday, September 8, 2012

cvs lock delete


Find /cvs | grep ‘/#cvs.’ > /tmp/cvs_lock
cat /tmp/cvs_lock | while read line; do  if [ -d $line ]; then echo "deleteing $line DIR"; rm -rf $line; fi; if [ -f $line ]; then echo "deleting $line FILE"; rm -f $line; fi; done | tee -a /tmp/del_log_cvs_lock

Wednesday, September 5, 2012

Dstat Logging


To log the data in a csv format so that it can be used later for processing & generate graphs

dstat -ts --top-io --top-bio --noheaders --nocolor --output /tmp/dstat.csv 5 > /dev/null &

The main output is redirected to /dev/null, which means it won't get 
written anywhere.  Instead you'll get a CSV file at /tmp/dstat.csv.


Schedule it via cron every minute


#  Run dstat and log the reports

* * * * * root dstat -ts --top-io --top-bio --noheaders --nocolor 5 3 >> /var/log/dstat.txt


If you prefer a log of the data in CSV format, put this into the file instead:


#  Run dstat and log the reports

* * * * * root dstat -ts --top-io --top-bio --noheaders --nocolor --output /var/log/dstat.csv 5 3 > /dev/null


Rotate the created log

If you plan to leave the dstat logger running (and aren't just going to run it for a day or so to check on a burst of disk activity) you'll want to rotate its log occasionally to keep it from getting too big.
To that end, create a file for editing at "/etc/logrotate.d/dstat" and put the below entry to this.
/var/log/dstat.csv {
  rotate 5
  weekly
  compress
  missingok
  notifempty
}

Also
use "iotop" & "vmstat 1"
run vmstat 1 and watch the bo (buffer out) column.
If it's a userspace process you may see it with "iotop".

Monday, August 27, 2012

Mount a linux server dir to another linux server directory


Say we have 2 servers named as
server1                 (192.168.1.45)
server2                 (192.168.1170)

we want to mount a directory of 192.168.1.45 on the .170 server

Step1.
install nfs server on server1 (.45)
#yum install nfs-utils nfs4-acl-tools portmap
#chkconfig nfs on

Step2.
Share the directory on server1(.45)
#vim /etc/exports
/image1 192.168.1.170(rw)
save the file {it will give server2 (.170) read write access}
# exportfs -avr

Step3.
Mounting the /image1 directory on the server2
you need to create a directory on server2 where you want to mount the directory from server1
#mkdir /image1

#vim /etc/fstab
192.168.1.45:/image1     /image1 nfs hard,intr 0 0
save and close the  file

#mount -t nfs -a

the above command will mount the server1 shared directory to the server2 directory(/image1).

Saturday, August 4, 2012

How to Disable ndr's in sendmail


 vi /etc/mail/sendmail.mc

Change the below line
dnl # define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
  TO
define(`confPRIVACY_FLAGS', `authwarnings,nobodyreturn')dnl

save and exit

Restart the Sendmail


Remove directory from CVS



CVS doesn't really keep directories under version control. If you want to remove a directory from a project, you first remove all the files in it, then use update -P to remove the directory from the working directory.

CVS checkout and update will always check out empty directories; that's just the way CVS is built. Do an update with "-P" -- "prune" -- to remove empty directories:

cvs update -dP

(Adding "-d" will update new directories that have appeared since your last update; otherwise, CVS will ignore them.)

Cvs tends to work on a two phase approach regarding directories that's why there is a -P option for many cvs commands to "Prune empty directories".

When this has happened, e.g. want to rename a directory I've just added, I delete the directory, delete the entry for the directory in the CVS/Entries file, it'll be a line perpended with a "D".

If I've committed, I make sure my current working area that contains the empty directory/ies is all checked in. Then I blow away the part of the work area that I have added the directories to.
Ex.

/mySandbox/Project_to_remove/etc_etc
/mySandbox/Project_to_remove/emptyDir


I make sure everything is up to date in both directories containing the stuff I want to keep. I then blow away Project_to_remove from within mySandbox.
Going back and checking out the same work area, e.g. Project_to_remove will give me the work area without the empty dirs.
Or just leave everything as is and use the -P option to get CVS check everything out (or update everything) then prune out the empty dirs.

Renaming Directories

checkout the project, make the changes on the local working copy, delete the CVS project in the repository and import the changed project again.



Redirect HTTPS TO HTTP

URL Rewriting


open your httpd.conf file and put the lines below.
-----------------------------------------------------------------
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R,L]
-----------------------------------------------------------------

Apache have a good document for this.

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


How to Mount Windows Share with CentOS

1. Install below package
#yum install samba-client
#yum install cifs-utils
2. create a file to keep/save you windows password in that. (you can also pass them directly on shell)
cd /home/nk
vim secret.txt
username=Domain\windowsUsername
password=YourPassowrForWindowsDomain

save and exit by :wq

4. make a directory where you want to mount the windows share folder
mkdir /mnt/nk

5.pass the below command to mount the windows shared folder to Centos folder
mount -t cifs //192.168.1.14/share /mnt/nk/ -o credentials=/home/nk/secret.txt

here : 192.168.1.14 is the windows machine IP
           "share" is the name of the folder you want to share(make sure you have access to this)

6. check that folder is mounted by "mount" command

Or
 mount -t cifs //192.168.1.14/share /mnt/nk/ -o -o username=#####,password=######
 
If the machine is in domain
mount -t cifs //192.168.1.14/share /mnt/nk/ -o -o username=DomainName/xxxx,password=xxxx



Tuesday, July 31, 2012

GUI for CentOS 6.2 minimal install Edition

yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"
yum groupinstall basic-desktop desktop-platform x11 fonts 

Once the minimal installation is done & then you are installing the 
Deskstop Packages changing Default runlevel from 3 to 5 does not start 
Xorg for GUI hence we need to add “exec /etc/X11/prefdm -nodaemon” in 
/etc/inittab file.
 

Thursday, July 12, 2012

base.bind.h ealing Lost connection to xxxt(GC). Running in disconnec ted mode: unlatch

Jul 12 19:14:52 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Lost connection to xxxt(GC). Running in disconnec
ted mode: unlatch
Jul 12 19:14:52 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Reconnected to xxxxxxxxxxt(GC).  Running in connected
mode.
Jul 12 19:45:22 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Lost connection to xxxxxxxxxx(GC). Running in disconn
ected mode: unlatch
Jul 12 19:45:22 pimage1-rl adclient[1986]: INFO  base.bind.h
ealing Reconnected to xxxxxxxxxx(GC).  Running in connected mo
de.





"adreload" and even "centrifydc restart"

In ADUC, right click on the Computer object, select "Reset Account"

On client side:

Run the command "adkeytab -C" or "adkeytab -r" as root


restart adclient one more time. If it still continues to be in disconnected mode,  "adinfo -g " check the output for examination. 

Friday, July 6, 2012

mysql question


>how much the expected data base size would be
>what/what kind of application is going to deploy
> connection type b/n application & data base (is application using connection pool etc etc)
>Security of data base (users in database eg. root pwd secure in database & connect only thru localhost)
>What mysql table engine preferred (myISAM or Innodb ) ==> how is our applicaiton (e.g if more insert and select then go with myISAM
and if more update and select then go with innodb
and if more insert + delete + select then go with innodb
and if one time bulk insert + one time delete + select then myisam
>reason               myisam -- lock table level
innodb -- locks table in row level
If databases have majority of innodb table then
setup server with following parameter
innodb_buffer_size s/b 65-75 % of available RAM and so on
>Before that I need to know the config of the system

                - RAM
                - What processor
                - What media (SATA or SAS or SSD)

Wednesday, July 4, 2012

How to delete all the root mail in linux by mutt + root mailbox full or 5.2.2: Permanent Failure: Mailbox Status: Mailbox full

How to delete all the root mail in linux by mutt

#mutt
/root/Mail does not exist. Create it? ([yes]/no):
yes

Then press "D"
At the bottom it asks "Delete messages matching:"
 ~s .*

-*-Mutt: /var/spool/mail/root [Msgs:46339 New:46339 Del:46339 48M]---(date/date)-

press "q" to quit and "y" to confirm

Monday, July 2, 2012

Too many files open

No. of Open Files
# lsof | wc -l

[root@aqua ~]# sysctl fs.file-max
fs.file-max = 10000
[root@aqua ~]# sysctl fs.file-max
fs.file-max = 10000

File Descriptor in Kernal memory
[root@aqua ~]# sysctl fs.file-nr
fs.file-nr = 2928       0       10000

a. 2828 is no. of allocated file handles
b. 0 no. of unused but alloted handles
c. 10000 system wide maximum number of file handles

No. of file handles used by a process xxx
#lsof -p xxx|wc -l
 
=================
Too Many files open

use lsof command
ps aux
ps aux | grep jetty
lsof -p 1105
lsof -p 1105 | wc -l
ll /proc/11105/fd
ll /proc/1105/fd | sort -g +10 -10

To sort by the Name column
lsof -p 1105 | sort +10 -10 >/tmp/openFiles.txt

The FD column is the File Descriptor column. It is either the number of the file or one of the following:

    cwd current working directory
    Lnn library references (AIX)
    err FD information error (see NAME column)
    jld jail directory (FreeBSD)
    ltx shared library text (code and data)
    Mxx hex memory-mapped type number xx
    m86 DOS Merge mapped file
    mem memory-mapped file
    mmap memory-mapped device
    pd parent directory
    rtd root directory
    tr kernel trace file (OpenBSD)
    txt program text (code and data)
    v86 VP/ix mapped file

Determine the limit

Each user has a limit for the number of open files. This limit applies to each process run by the user. For example say the limit is 1024 and the user has three processes running, each process can open 1024 files for a total of 3072.

To determine the soft limit:
ulimit -Sn
1024

To determine the hard limit:
ulimit -Hn
2048

ulimit -n shows you the soft limit. The soft limit is the limit applied for opening files. The hard limit is the limit you can increase the soft limit to.

Increase the Limit

To increase the limit to 10000 use the following command:

ulimit -Sn 10000

You can change the hard limit too, ulimit -Hn 10000. ulimit -n 10000 changes both the soft and hard limits to the same value.

Note: Once you reboot the limit is reset.
You cannot determine the limit of the root user using ulimit. For example:

sudo ulimit -n
sudo: ulimit: command not found
To make the limits bigger and to make the change permanent, edit your configuration file and reboot.

You can use * in the limit.conf file instead of a user name to specify all users, however this does not apply to the root!

    soft nofile 10000
    hard nofile 10000
    
    The limit.conf file is applied during the boot process. 
    
    
    You cannot start a process late enough in the boot process! For example: “sudo update-rc.d tomcat defaults 99 01″ is at the end and it is still too late.

The work around is to force the limit to be set before starting the process. Put “ulimit -n 4000″ before starting your process, then the limit.conf file is processed here.

There is another file limit in the system, the total number of files that can be opened by all processes.

To see the file max value:
sysctl -a | grep fs.file-max
fs.file-max = 170469 
  
 
File descriptor can be limited in both system level and shell level.
 
To check maximum number of fd in system type 'cat /proc/sys/fs/file-max'.
730437
 
If u want to set it add 'fs.file-max = 200000' to /etc/sysctl.conf
 
 
To check shell level limit
 
Shell level 'ulimit -n' 

1024

In /etc/security/limits.conf
* soft nofile 2048
* hard nofile 2048
 
 
To get total number of handle that a process use
 
lsof -p PID |wc -l
 
 
For File Descriptors == >  Easy way to edit the file
 
echo "#### Custom Addedlines ####">> /etc/security/limits.conf 
echo "* soft nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "root soft nofile 32768" | sudo tee -a /etc/security/limits.conf
echo "root hard nofile 32768" | sudo tee -a /etc/security/limits.conf
 
 
For User limits  == > 

* soft nofile 32768
* hard nofile 32768
root soft nofile 32768
root hard nofile 32768
* soft memlock unlimited
* hard memlock unlimited
root soft memlock unlimited
root hard memlock unlimited
* soft as unlimited
* hard as unlimited
root soft as unlimited
root hard as unlimited
 
 
In addition, you may need to be run the following command:
sysctl -w vm.max_map_count=131072
The command enables more mapping. It is not in the limits.conf file.



Disable Swap

Disable swap entirely. This prevents the Java Virtual Machine (JVM) from responding poorly because it is buried in swap and ensures that the OS OutOfMemory (OOM) killer does not kill


sudo swapoff --all

 
 
OR
 
echo "*   soft    nofile  131070" >> /etc/security/limits.conf
echo "*   hard    nofile  131070" >> /etc/security/limits.conf

echo 0 > /proc/sys/vm/swappiness
echo "vm.swappiness=0" >> /etc/sysctl.conf


Note
Both the “hard” and the “soft” ulimit affect MongoDB’s performance. The “hard” ulimit refers to the maximum number of processes that a user can have active at any time. This is the ceiling: no non-root process can increase the “hard” ulimit. In contrast, the “soft” ulimit is the limit that is actually enforced for a session or process, but any process can increase it up to “hard” ulimit maximum.
A low “soft” ulimit can cause can't create new thread, closing connection errors if the number of connections grows too high. For this reason, it is extremely important to set both ulimit values to the recommended values
 
 OR
sudo vim /etc/security/limits.conf

*           soft    nofile         10000
*           hard    nofile         20000
Modify the common-session file with the following: sudo vim /etc/pam.d/common-session
session required pam_limits.so
==
you can set system wide limits by editing /etc/security/limits.conf and /etc/pam.d/common-session, however, this only applies interactive and non-interactive shells (and processes started by them).
If you want to try system wide limits, then add a line like the following to /etc/security/limits.conf:
*  -  nofile 65000

In /etc/pam.d/common-session, enable the limits module by adding:
session required pam_limits.so

Keep in mind that all this really does is have PAM set the limit for 
interactive and non-interactive shells when loaded. Processes then 
pickup these limits when started from shells/scripts. You should 
probably do a restart to fully enact these settings. 


and reboot the system.

The option with wildcard *didn’t work for me , because I used root accout to run my programms and wildcard option doesn’t affect the superuser.

 
 

Sunday, July 1, 2012

CentOS 6.2 + Qpidd

When CentOS 6.2 is installed in GUI mode then it install Qpidd by default.


Tasks: 700 total,   5 running, 695 sleeping,   0 stopped,   0 zombie
Cpu(s): 12.2%us, 19.5%sy,  0.0%ni, 67.3%id,  0.0%wa,  0.0%hi,  1.1%si,  0.0%st
Mem:  32866212k total,  5185096k used, 27681116k free,   365688k buffers
Swap: 33554424k total,        0k used, 33554424k free,  3212884k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4358 root      20   0 4428m  68m  10m S 338.7  0.2   6291:59 dsm_om_connsvcd
 3310 root      20   0 5574m 885m  10m S 146.8  2.8   3095:24 java
 3259 root      20   0  113m 8316 4612 S 99.8  0.0   3155:52 java
 3554 qpidd     20   0 1960m  12m 3108 S 23.5  0.0 620:13.01 qpidd


# rpm -qa | grep qpid
qpid-cpp-server-0.14-14.el6_2.x86_64
qpid-cpp-client-0.14-14.el6_2.x86_64
qpid-cpp-client-ssl-0.14-14.el6_2.x86_64
qpid-qmf-0.14-7.el6_2.x86_64
qpid-cpp-server-ssl-0.14-14.el6_2.x86_64

It has dependecy on

Dependencies Resolved

===========================================================================================================================================
 Package                                 Arch                       Version                             Repository                    Size
===========================================================================================================================================
Removing:
 qpid-cpp-client                         x86_64                     0.14-14.el6_2                       @updates                     4.0 M
 qpid-cpp-client-ssl                     x86_64                     0.14-14.el6_2                       @updates                     341 k
 qpid-cpp-server                         x86_64                     0.14-14.el6_2                       @updates                     3.3 M
 qpid-cpp-server-ssl                     x86_64                     0.14-14.el6_2                       @updates                     147 k
 qpid-qmf                                x86_64                     0.14-7.el6_2                        @updates                     1.4 M
Removing for dependencies:
 matahari                                x86_64                     0.4.4-12.el6_2                      @updates                      18 k
 matahari-agent-lib                      x86_64                     0.4.4-12.el6_2                      @updates                      81 k
 matahari-broker                         x86_64                     0.4.4-12.el6_2                      @updates                      32 k
 matahari-host                           x86_64                     0.4.4-12.el6_2                      @updates                     102 k
 matahari-network                        x86_64                     0.4.4-12.el6_2                      @updates                      72 k
 matahari-service                        x86_64                     0.4.4-12.el6_2                      @updates                     126 k
 matahari-sysconfig                      x86_64                     0.4.4-12.el6_2                      @updates                      54 k

Transaction Summary
===========================================================================================================================================
Remove       12 Package(s)


[root@imonitor etc]# rpm -qa | grep matahari
matahari-broker-0.4.4-12.el6_2.x86_64
matahari-0.4.4-12.el6_2.x86_64
matahari-network-0.4.4-12.el6_2.x86_64
matahari-sysconfig-0.4.4-12.el6_2.x86_64
matahari-lib-0.4.4-12.el6_2.x86_64
matahari-host-0.4.4-12.el6_2.x86_64
matahari-service-0.4.4-12.el6_2.x86_64
matahari-agent-lib-0.4.4-12.el6_2.x86_64

To stop it use
# /etc/init.d/qpidd stop

To Remove it & its dependency completely

#yum remove qpid-*

Running Transaction
  Erasing    : matahari-0.4.4-12.el6_2.x86_64                                                                                         1/12
  Erasing    : matahari-broker-0.4.4-12.el6_2.x86_64                                                                                  2/12
  Erasing    : qpid-cpp-server-ssl-0.14-14.el6_2.x86_64                                                                               3/12
  Erasing    : matahari-host-0.4.4-12.el6_2.x86_64                                                                                    4/12
  Erasing    : matahari-network-0.4.4-12.el6_2.x86_64                                                                                 5/12
  Erasing    : matahari-service-0.4.4-12.el6_2.x86_64                                                                                 6/12
  Erasing    : matahari-sysconfig-0.4.4-12.el6_2.x86_64                                                                               7/12
  Erasing    : matahari-agent-lib-0.4.4-12.el6_2.x86_64                                                                               8/12
  Erasing    : qpid-qmf-0.14-7.el6_2.x86_64                                                                                           9/12
  Erasing    : qpid-cpp-client-ssl-0.14-14.el6_2.x86_64                                                                              10/12
  Erasing    : qpid-cpp-server-0.14-14.el6_2.x86_64                                                                                  11/12
  Erasing    : qpid-cpp-client-0.14-14.el6_2.x86_64                                                                                  12/12

Removed:
  qpid-cpp-client.x86_64 0:0.14-14.el6_2         qpid-cpp-client-ssl.x86_64 0:0.14-14.el6_2     qpid-cpp-server.x86_64 0:0.14-14.el6_2
  qpid-cpp-server-ssl.x86_64 0:0.14-14.el6_2     qpid-qmf.x86_64 0:0.14-7.el6_2

Dependency Removed:
  matahari.x86_64 0:0.4.4-12.el6_2              matahari-agent-lib.x86_64 0:0.4.4-12.el6_2    matahari-broker.x86_64 0:0.4.4-12.el6_2
  matahari-host.x86_64 0:0.4.4-12.el6_2         matahari-network.x86_64 0:0.4.4-12.el6_2      matahari-service.x86_64 0:0.4.4-12.el6_2
  matahari-sysconfig.x86_64 0:0.4.4-12.el6_2


or

#yum erase matahari-lib matahari-agent-lib matahari-broker matahari-host matahari-service matahari-sysconfig matahari-network matahari qpid-cpp-client qpid-cpp-client-ssl qpid-cpp-server-ssl qpid-cpp-server sigar polkit dbus qpid-qmf boost ConsoleKit eggdbus boost-filesystem boost-program-options boost-graph boost-date-time boost-serialization boost-test boost-thread boost-regex boost-wave  boost-signals boost-iostreams boost-python ConsoleKit-libs libicu