NMON Setup on Linux Servers

nmon (short hand for Nigel's Monitor) is a computer performance system monitor tool
for the AIX and Linux operating systems. The nmon tool has two modes a) displays the
performance stats on-screen in a condensed format or b) the same stats are saved to a
comma-separated values (CSV) data file for later graphing and analysis to aid the
understanding of computer resource use, tuning options and bottlenecks.
Prerequisite:
The server must have enough space to capture nmon logs generated 24x7.
Create a separate FileSystem as /nmon_data and ensure the logs are generated inside the FS.
Installation:

1) Install the nmon rpm:

Version can be different, the below pkg is shown just for instance.

[root@Server]# rpm -ivh nmon-16g-3.el6.x86_64.rpm
warning: nmon-16g-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895:
NOKEY
Preparing... ########################################### [100%]
1:nmon ########################################### [100%]

Link: https://pkgs.org/download/nmon

2) Download nmonchart.tar and untar the file:

tar -xf nmonchart31.tar

Link: http://nmon.sourceforge.net/pmwiki.php

3) Update the permissions and ownerships of the extracted files:

chmod 775 *
chown root:root *

4) To automate the log collection through nmon, copy the below script and run the same
through cron. It will also perform the log rotation.

Crontab Entry:

0 0 * * * /nmon_data/nmon_collector.sh

Script:

#cat nmon_collector.sh
#!/bin/sh
#Kill nmon if running
for i in `ps -ef | grep "nmon_data" | grep -v grep | grep -v nmon_collector | awk '{print $2}'`
do
kill -9 $i
sleep 30
done
#Nmon command
nmon -f -s 60 -c 1440 -F /nmon_data/nmon_$(date +%Y-%m-%d_%H-%M-%S).nmon

#Gzip files older than 8 days and remove files older than 35 days
cd /nmon_data
find . -name "*.nmon" -mtime +8 -exec gzip {} \;
find . -name "*.nmon.gz" -mtime +35 -exec rm {} \;

5) To create a html file from nmon file, use the below "nmonchart" command:

sh nmonchart /home/xxxxxxxxx.nmon xxxxxxxx.html

Or even you can use the “NMON Analyser” to get the graphical view.

6) To Create nmon filesystem :

Check the free space in VG (rootvg)
vgdisplay rootvg

Create LV:

lvcreate –n lvname –L +size vgname
mkfs.xfs /dev/vg/lv ------------------------ For RHEL/OEL7.x
mkfs.ext4 /dev/vg/lv-----------------------  For RHEL/OEL 6.x/earlier
mkdir filesystem name
update /etc/fstab
mount filesystem

Example:

lvcreate -n nmon_fs -L +3G rootvg
mkfs.xfs /dev/rootvg/nmon_fs
mkdir /nmon_data
vi /etc/fstab
/dev/mapper/rootvg-nmon_fs /nmon_data xfs defaults 0 0
mount /nmon_data

No comments:

Post a Comment

Installation of Jenkins on Linux and Deployment NGINX through Jenkins

Installation of Jenkins: [root@worker1 ~]# useradd -c "jenkins user" jenkins [root@worker1 ~]# passwd jenkins Changing passw...