Setup OS monitoring for paging activity

It is critical to monitor, detect, investigate and resolve swaping and paging activities at OS.
If paging and swaping occurs then this means that your OS does not have enough physical memory
or it is not properly allocated. This can significantly affect performances, making your applications to perform extremely poorly while the paging is occurring.
This document outlines steps to setup monitoring to detect and alert when paging is occurring at the OS. This is done using OS cron. This example is on and HP Unix box.

Disclaimer: Apply to a TEST environment first. Use on production systems is at DBAs own risk.

1) Logon as the database or application owner

vi and insert the following into this file:

# The following shell script will monitor paging activity will send an
# email if OS paging occurs.
# Author: Bobby A.
# script named /home/applprod/scripts/
#! /bin/ksh
for i in `tail -6 /home/applprod/vmstat_collection.out | awk ‘{print $9′}`
if [[ $i != 0 && $i != po ]]
head -2 /home/applprod/vmstat_collection.out > /home/applprod/sendmail_vmstat.out
tail -7 /home/applprod/vmstat_collection.out >> /home/applprod/sendmail_vmstat.out
cat /home/applprod/sendmail_vmstat.out | /usr/bin/mailx -s “*** Experiencing OS paging On

Server_name***” \
-r email_of_sender list of email of users to be alerted separated by space
rm -f /home/applprod/sendmail_vmstat.out

2) crontab -l >
crontab -e and insert the floowing at the bottom of the cron:
# Monitoring paging and IO:
# vmstat collections every 10 seconds for 84 collections meaning collecting for 14 minutes every 15 minutes 7 AM to 5 PM.
# This is 6 collections for each minute.
0,15,30,45 7-17 * * 1-5 vmstat 10 84 >> /home/applprod/vmstat_collection.out
1-59 7-17 * * 1-5 /home/applprod/scripts/

The list of users in would get an email alert every time monitored OS is experiencing paging and swaping.
To display cron:
crontab -l
1) ps -elf | sort -r -k 10 | more

–> This is sorted with the 10th field as the sort key in reverse, which is the memory
size of each process from high to low.
Here you can determine which processes use most memory and decide what to do such as which applications to shutdown.

2) Look at how memory is allocated using tools such as glance (HP) or ipcs –a and decide what
to do such as detecting applications to which you have over allocated memory.

3) Add more memory to the server.

Latest Blog Items


Thank you for your interest in idbasolutions.

Contact us using this email: