Wednesday, March 16, 2016

Processes using high memory or cpu using unix95

 Listing of processes who are using high memory : UNIX95= ps -eo sz,comm,args | sed 1d | sort -rn | head -10|awk '{size=$1/1024; pri... thumbnail 1 summary

 Listing of processes who are using high memory :


UNIX95= ps -eo sz,comm,args | sed 1d | sort -rn | head -10|awk '{size=$1/1024; printf("%dMb %s\n", size,$2);}'| more


 or


UNIX95= ps -eo vsz,comm,args | sed 1d | sort -rn | more


 Listing of processes who are using high CPU:


UNIX95= ps -e -o "vsz pcpu ruser pid stime time state args" | sort -rn |head -10



How to restore nagios configuration from backup

Requirement : You messed up some configuration in nagios and need to revert back to last known good configuration. Solution: Navigate ... thumbnail 1 summary
Requirement :

You messed up some configuration in nagios and need to revert back to last known good configuration.

Solution:

Navigate to the directory where nagios configuration backups are kept. Normally they should be in gunzip format.

Once inside that directory run restore command.

# check_mk --restore check_mk.11-Mar-2016.tar.gz

After restore to make sure ownership is well in place, run below command

# chown -R apache:nagcmd /etc/check_mk/conf.d/wato/

Lastly restart nagios to take up restored configuration.

# check_mk -R --restart nagios-check_mk

How to remove password expiry in HPUX HP Unix

Requirement : To set never expire attribute on account password. Some applications/users are required to have same password for longer du... thumbnail 1 summary
Requirement :

To set never expire attribute on account password. Some applications/users are required to have same password for longer duration. This requires them to exit from system wide password expiry policy. So that those accounts can run lifetime without need of changing their passwords.

Image source : freeimages


How to do it :



/usr/lbin/modprpw -m exptm=-1  username
/usr/lbin/modprpw -m expwarn=-1  username
/usr/lbin/modprpw  -m lftm=-1  username
/usr/lbin/modprpw  -m mintm=-1  username



Highest size files in mount point

Command to search and display files with high utilization in a mount point. #du -a /tmp | sort -nr | cut -f2 | xargs du -s | head -n 10 ... thumbnail 1 summary
Command to search and display files with high utilization in a mount point.


#du -a /tmp | sort -nr | cut -f2 | xargs du -s | head -n 10


Replace /tmp with mount point of your choice and run command.