Shown below a script that can be used to create a simple comma separated values file (CSV) from NMON data.
If you wish to create a CSV file of the CPU usage on your system, you can grep for "CPU_ALL," in the nmon file. If you want to create a CSV file of the memory usage, grep for "MEM," in the nmon file. The script below creates a CSV file for the CPU usage.
#!/bin/ksh
node=`hostname`
rm -f /tmp/cpu_all.tmp /tmp/zzzz.tmp /tmp/${node}_nmon_cpu.csv
for nmon_file in `ls /var/msgs/nmon/*nmon`
do
datestamp=`echo ${nmon_file} | cut -f2 -d"_"`
grep CPU_ALL, $nmon_file > /tmp/cpu_all.tmp
grep ZZZZ $nmon_file > /tmp/zzzz.tmp
grep -v "CPU Total " /tmp/cpu_all.tmp | sed "s/,/ /g" | \
while read NAME TS USER SYS WAIT IDLE rest
do
timestamp=`grep ${TS} /tmp/zzzz.tmp | awk 'FS=","{print $4" "$3}'`
TOTAL=`echo "scale=1;${USER}+${SYS}" | bc`
echo $timestamp,$USER,$SYS,$WAIT,$IDLE,$TOTAL >> \
/tmp/${node}_nmon_cpu.csv
done
rm -f /tmp/cpu_all.tmp /tmp/zzzz.tmp
done
Note: the script assumes that you've stored the NMON output files in /var/msgs/nmon. Update the script to the folder you're using to store NMON files.If you found this useful, here's more on the same topic(s) in our blog:
- How to update the AIX-rpm virtual package
- Changing maxuproc requires a reboot?
- Export and import PuTTY sessions
- Korn Shell history
- PS1
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?




