LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-02-2010, 02:30 PM   #1
abhijeetdutta
Member
 
Registered: Aug 2009
Posts: 141

Rep: Reputation: 16
error while running sar command


Hi,
i am getting this error while running in rhel 5.3

-bash: sar: command not found

any idea how to resolve.

Thanks
Abhi
 
Old 07-02-2010, 02:41 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

This error tells you sar is probably not installed. So, install it

Hope this helps.
 
1 members found this post helpful.
Old 07-02-2010, 02:42 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It is telling you "sar" command is not found. This means:
1) It is not in your PATH (the variable that tells it where to look for commands).
2) The command isn't on your system.

You can find out what provides it by typing:
yum provides "*/sar".

That should show you it is provided by the sysstat package.

You can then run "yum list sysstat". If it is installed you'll see the package marked as "Installed". You may also see newer packages marked as "Available".

If you only see "Available" then it isn't installed. You need to run "yum install sysstat" to install it in that case.

If it IS already installed if you type "rpm -ql sysstat" it will give you a list of all the files from that package. You need to make sure the path to sar command is in your PATH variable.
 
1 members found this post helpful.
Old 07-02-2010, 03:17 PM   #4
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Quote:
Originally Posted by abhijeetdutta View Post
Hi,
i am getting this error while running in rhel 5.3

-bash: sar: command not found

any idea how to resolve.

Thanks
Abhi
Probably the same as I have:

Code:
jan@Beryllium:~/internet/fruttenboel$ sar
Cannot open /var/log/sa/sa02: No such file or directory
jan@Beryllium:~/internet/fruttenboel$ locate sar | grep bin
/sbin/lvmsar
/usr/bin/sar
jan@Beryllium:~/internet/fruttenboel$ /usr/bin/sar
Cannot open /var/log/sa/sa02: No such file or directory
jan@Beryllium:~/internet/fruttenboel$ ls -l /usr/bin/sar
-rwxr-xr-x 1 root root 42852 2006-08-15 05:15 /usr/bin/sar*
jan@Beryllium:~/internet/fruttenboel$
It's a root process that is not in an 'sbin' directory.... become root en rerun:

Code:
jan@Beryllium:~/internet/fruttenboel$ su
Password:
root@Beryllium:/home/jan/internet/fruttenboel# sar
Cannot open /var/log/sa/sa02: No such file or directory
root@Beryllium:/home/jan/internet/fruttenboel# man sar
root@Beryllium:/home/jan/internet/fruttenboel# sar -r runq-sz
Usage: sar [ options... ] [ <interval> [ <count> ] ]
Options are:
[ -A ] [ -b ] [ -B ] [ -c ] [ -d ] [ -i <interval> ] [ -p ] [ -q ]
[ -r ] [ -R ] [ -t ] [ -u ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ]
[ -I { <irq> | SUM | ALL | XALL } ] [ -P { <cpu> | ALL } ]
[ -n { DEV | EDEV | NFS | NFSD | SOCK | ALL } ]
[ -x { <pid> | SELF | ALL } ] [ -X { <pid> | SELF | ALL } ]
[ -o [ <filename> ] | -f [ <filename> ] ]
[ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]
root@Beryllium:/home/jan/internet/fruttenboel# man sar
root@Beryllium:/home/jan/internet/fruttenboel# sar -q runq-sz
Usage: sar [ options... ] [ <interval> [ <count> ] ]
Options are:
[ -A ] [ -b ] [ -B ] [ -c ] [ -d ] [ -i <interval> ] [ -p ] [ -q ]
[ -r ] [ -R ] [ -t ] [ -u ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ]
[ -I { <irq> | SUM | ALL | XALL } ] [ -P { <cpu> | ALL } ]
[ -n { DEV | EDEV | NFS | NFSD | SOCK | ALL } ]
[ -x { <pid> | SELF | ALL } ] [ -X { <pid> | SELF | ALL } ]
[ -o [ <filename> ] | -f [ <filename> ] ]
[ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]
root@Beryllium:/home/jan/internet/fruttenboel# sar -A
Cannot open /var/log/sa/sa02: No such file or directory
root@Beryllium:/home/jan/internet/fruttenboel#
It's a difficult command. Not for a newcomer like me.
 
Old 07-02-2010, 03:41 PM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
SAR is designed to gather activity over time but can be used at command line - you're misunderstanding the man page in two regards:

1) runq-sz is shown by "sar -q" NOT "sar -r".
2) You don't specify runq-sz on the command line with "sar -r" - it is just one of the things "sar -r" will show you (first line of output is the headings.) This shows you historical information.

You can also see current information by specifying number of iterations and time between them. e.g.

Code:
# sar -r 5 5
Linux 2.6.18-128.4.1.el5xen (hostname.domain.com)        07/02/2010

04:39:44 PM kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
04:39:49 PM     96328    690104     87.75    144124    367736   4194100       196      0.00         0
04:39:54 PM     96328    690104     87.75    144124    367752   4194100       196      0.00         0
04:39:59 PM     96328    690104     87.75    144124    367752   4194100       196      0.00         0
04:40:04 PM     95788    690644     87.82    144152    367760   4194100       196      0.00         0
04:40:09 PM     95788    690644     87.82    144176    367760   4194100       196      0.00         0
Average:        96112    690320     87.78    144140    367752   4194100       196      0.00         0
For sar -q you see different output:
Code:
# sar -q 5 5
Linux 2.6.18-128.4.1.el5xen (hostname.domain.com)        07/02/2010

04:42:10 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
04:42:15 PM         0       170      0.02      0.02      0.00
04:42:20 PM         0       170      0.02      0.02      0.00
04:42:25 PM         0       170      0.02      0.02      0.00
04:42:30 PM         0       170      0.02      0.02      0.00
04:42:35 PM         0       170      0.02      0.02      0.00
Average:            0       170      0.02      0.02      0.00

Last edited by MensaWater; 07-02-2010 at 03:44 PM.
 
Old 01-09-2012, 05:37 AM   #6
qweeak
LQ Newbie
 
Registered: Jan 2012
Posts: 24

Rep: Reputation: 2
still why the error

Hello,

But still why does this don't work ? i know if you give the it iterations and time between them, it works perfectly.
---
root@Beryllium:/home/jan/internet/fruttenboel# sar -q
Cannot open /var/log/sa/sa02: No such file or directory
--
 
Old 01-09-2012, 02:04 PM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It told you why:

Quote:
Cannot open /var/log/sa/sa02: No such file or directory
That is saying there is no such file as "/var/log/sa/sa02". If you do "ls -l /var/log/sa/sa02" from command line does it tell you the same thing? If so the file doesn't exist. You could then try "ls -l /var/log/sa" to see if the directory exists and "ls -l /var/log" to verify the parent directoy exits. (We can assume /var exists or your computer wouldn't be working.)

The data in the file is created only when the sa2 command is run via cron to gather statistics for each day. Type "man sa2" for more details.

On RedHat/CentOS the cron job is /etc/cron.d/sysstat. Not sure what it would be on your distro.

P.S. When you have a new question it is best to open a new thread. You can put a link to old thread if necessary. When you append to an old thread instead of opening a new one then only the users that subscribed at the time it was created will see it. With a new one everyone sees it when looking for zero reply threads so you're more likely to get a quick answer.
 
Old 01-13-2012, 01:15 PM   #8
qweeak
LQ Newbie
 
Registered: Jan 2012
Posts: 24

Rep: Reputation: 2
Hi,

Thnks MensaWater for the suggestion. Funny i touched that file in question still the error is present. So cron is needed for this to work right ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why sar command not running? your_shadow03 Linux - Newbie 2 02-05-2009 12:29 AM
sar command option -H lensem Linux - Software 1 12-16-2008 02:53 PM
sar command maooah Solaris / OpenSolaris 16 08-12-2008 05:16 AM
sar command rsuks Linux - General 2 03-25-2006 03:53 AM
monitoring I/O with sar command juanb Linux - Hardware 1 04-13-2005 11:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration