Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to figure a way to get the CPU utilization for the past 2 months. I have tried to use sar. What I found with sar is that you can collect and report CPU utilization with it and it is installed through the sysstat utility. Once installed the /usr/lib64/sa/sa1 directory stores "historical" references in the /var/log/sa/sadd directory where dd = day in the month. You setup specified parameters in the cron.d/sysstat file. Which for me looks like this:

# run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

Then /usr/lib64/sa/sa2 creates a daily report in the /var/log/sa/sadd directory. Which for me sa2 looks like this:

#!/bin/sh
# /usr/lib64/sa/sa2.sh
# (C) 1999-2006 Sebastien Godard (sysstat <at> wanadoo.fr)
#
# Changes:
# - 2004-01-22 Nils Philippsen <nphilipp@redhat.com>
#   make history configurable
#
HISTORY=7
[ -r /etc/sysconfig/sysstat ] && . /etc/sysconfig/sysstat
[ ${HISTORY} -gt 25 ] && HISTORY=25
S_TIME_FORMAT=ISO ; export S_TIME_FORMAT
umask 0022
DATE=`date  +%d`
RPT=/var/log/sa/sar${DATE}
ENDIR=/usr/bin
DFILE=/var/log/sa/sa${DATE}
[ -f "$DFILE" ] || exit 0
cd ${ENDIR}
${ENDIR}/sar $* -f ${DFILE} > ${RPT}
find /var/log/sa \( -name 'sar??' -o -name 'sa??' \) -mtime +"${HISTORY}" -exec rm -f {} \;

This is only set to have the history of 7 days. I guess my question is: Is there a way to get the CPU stats for the past 2 months using sar or is there a better way? It seems to me I may only have access to the past 7 days of stats.

share|improve this question
    
I don't know about SAR, but a tool like munin can definitely keep stats for several months. –  Lucas Kauffman Sep 19 '12 at 14:38
add comment

1 Answer

up vote 0 down vote accepted

if you change to HISTORY=60, then it should keep 2 months worth, approximately.

share|improve this answer
    
Thanks for the response. That will be implemented. But is there a way to get the past 2 months without having this implemented before hand or are we SOL at this point? –  Bassler1988 Sep 19 '12 at 16:30
    
I guess not, at least for sar, as the files were cleaned up by the script, unless you have other external programs that generated and kept stats. If your server is in a datacenter, your provider might have some standard monitoring to capture that. cpu utilization is one of the most basic things to monitor so if there is any monitoring, it should be there. –  johnshen64 Sep 19 '12 at 17:57
    
Luckily you were right johnshen64. Just found out that we use TeamQuest. Nice little reporting tool. Thanks for all comments! –  Bassler1988 Sep 19 '12 at 18:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.