Solved

Sar error

Posted on 2011-02-11
13
1,305 Views
Last Modified: 2012-05-11
When trying to run Sar command error


 sar
Cannot open /var/log/sa/sa11: No such file or directory

Open in new window


Running:

cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)

Open in new window


How can I create all log files needed /var/log/sa/saXX - is a cron job required?


0
Comment
Question by:jaxstorm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34870320
Hi,

do you have the "sysstat" script in /etc/cron.d?

What's in /var/log/sa anyway?

wmp
0
 
LVL 12

Expert Comment

by:upanwar
ID: 34870345
If you just give the command 'sar' then sar searches for the current day's file in /var/adm/sa directory. If you want the current stats from sar, you have to provide the appropriate switch (such as -d for disk info, -u for cpu util and so on), the sampling interval and the number of samples.

Try:

sar -mu -P ALL <Intervals> <No. of samples>
0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870351
systat does exist in /etc/cron.d

ll /var/log/sa
total 16
-rw-r--r--  1 root root 528 Oct  3  2007 sa03
-rw-r--r--  1 root root 528 Feb 19  2008 sa19
-rw-r--r--  1 root root 528 Sep 24 15:30 sa24
-rw-r--r--  1 root root 816 May 25  2010 sa25

Open in new window



0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 21

Expert Comment

by:robocat
ID: 34870368


Put these into your crontab

*/10 * * * * root /usr/lib/sa/sa1 1 1
59 23 * * * root /usr/lib/sa/sa2 -A

They will collect the data in the sa directory, needed by sar.
 
0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870378
upanwar:

While I know you're correct, surely the /var/log/sa directory should be populated for for sa11 given that the cron job exists and the system has been up for 100+ days?

Fwiw, /var/adm/sa does not exist, would making that directory rectify the problem?
0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870390
robocat, they already exist in cron.d

cat /etc/cron.d/sysstat
# 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

Open in new window

0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 34870410
Afaik you don't need /var/adm/sa with RedHat. It's /var/log/sa

>> they already exist in cron.d <<

That's why I asked for sysstat.

You could add >/tmp/sa1.log 2>&1 at the end of the sa1 line to check for possible error messages.

wmp
0
 
LVL 21

Assisted Solution

by:robocat
robocat earned 250 total points
ID: 34870412

What happens if you run this manually ?


/usr/lib64/sa/sa1 1 1

Any errors ? Is sa11 being created in /var/log/sa ?

0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870427
Running /usr/lib64/sa/sa1 1 1 manually seems to have created the file correctly so I think the issue must be with the cron job. Any ideas?
0
 
LVL 21

Expert Comment

by:robocat
ID: 34870449

check /var/log/cron for errors ?
0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870471
This doesn't look good

less /var/log/cron | grep sysstat
Feb 11 06:53:01 ana0dl-a0018s00 crond[4831]: (*system*) BAD FILE MODE (/etc/cron.d/sysstat)

Open in new window

0
 
LVL 21

Expert Comment

by:robocat
ID: 34870495

Check for appropriate (execute) permissions on that file.
0
 
LVL 8

Author Comment

by:jaxstorm
ID: 34870505
Way ahead of you RC, thanks guys you all contributed :)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question