Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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
--
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.