In many cases, it is easiest to just have nmon start when the system starts. The instructions here detail how to do this on both Linux and AIX.
Linux
- Copy the nmon init.d script (for RHEL or SLES) to /etc/init.d/nmon
- Copy the nmon logrotate.d script to /etc/logrotate.d/nmon
- Create a symbolic link from the nmon executable to /usr/bin/nmon
- Setup permissions and start the nmon service chown root:root /etc/init.d/nmon chmod 755 /etc/init.d/nmon chown root:root /etc/logrotate.d/nmon chcon --reference /etc/init.d/network /etc/init.d/nmon chmod 644 /etc/logrotate.d/nmon chown root:root /usr/bin/nmon_x86_64_rhel6 chcon --reference /etc/logrotate.d/yum /etc/logrotate.d/nmon chmod 755 /usr/bin/nmon_x86_64_rhel6 ln -s -f /usr/bin/nmon_x86_64_rhel6 /usr/bin/nmon chkconfig --add nmon service nmon start
The above script is specific to RedHat Linux variants. Modifications, especially the use of chkconfig and the reference scripts for chcon may be needed on other distributions.
With this setup nmon collects data every 30 seconds and 15 days of logs are retained in /var/log/nmon/old.
AIX
AIX supports daily nmon collection out of the box. Run smit topas to start smit.
- Select Start New Recording → Start Persistent local recording
- Select nmon as type
- Set the following options
- Recording interval in seconds: 30
- Number of Days to retain: 15
- Include Fiber Channel Section: yes (if applicable)
- Include Shared Ethernet Section: yes (on VIOS)
- Include Large Page Section: yes
- Include Asynchronus IO: yes
- Hit enter to run the command
- Esc 0 to exit smit
There should now be an nmon file in /etc/perf/daily.
To stop nmon collection, run smit topas. Then select Stop Recording → Stop Persistent Recording → Stop Persistent local nmon Record.