Operating System - HP-UX
1752817 Members
5251 Online
108789 Solutions
New Discussion юеВ

Re: Running a sar script at scheduled intervals

 
SOLVED
Go to solution
Andrew Kaplan
Super Advisor

Running a sar script at scheduled intervals

Hi there --

I am writing a script that will include the sar command sending its output to a text file which, in turn, will be e-mailed to the system administrator. The command syntax that I had in mind for sar is the following:

/usr/sbin/sar -v 1 30 >> /tmp/output.txt

The idea here is to run the script every half hour on the hour in order to keep watch of the process, inode, and system file tables.

The server in question is running HP-UX 11.11, and it is part of a ServiceGuard cluster. It also runs NIS server, Samba, and Postgres daemons.

My question are the following:

1. Is running the script at the mentioned interval a good method of keeping track of the tables?
2. Is running sar for thirty seconds an adequate time, or should I adjust the time to something else?

Thanks.
A Journey In The Quest Of Knowledge
6 REPLIES 6
Tim Nelson
Honored Contributor
Solution

Re: Running a sar script at scheduled intervals

check out the man pages for sa1.

there is already something to do this for you, no need to reinvent the wheel.
Emil Velez
Honored Contributor

Re: Running a sar script at scheduled intervals

do a man sa1

It provides the cron jobs for collecting sar data via sa1 and creating a report with sa2 This is a well known feature of sar.

Andrew Kaplan
Super Advisor

Re: Running a sar script at scheduled intervals

Hi there --

Thanks for your reply. I did a check of the man page for sa1, and I will give it a try. My understanding is it can be configured to run once every hour using the following command syntax:

/usr/lbin/sa/sa1 -n 1 -t 3600

The output file can then be e-mailed to the administrator. What do you think?

Also, is there any advantage to my using sa2 as opposed to sa1?

Thanks.
A Journey In The Quest Of Knowledge
Tim Nelson
Honored Contributor

Re: Running a sar script at scheduled intervals

sa1 collects the binary info
sa2 converts to ascii to be viewed / emailed once daily.

there are perfect examples of usage in the manpage.
Andrew Kaplan
Super Advisor

Re: Running a sar script at scheduled intervals

Hi there --

I set up the cron job for sa1, and monitored the results. The scheduled task failed with a return code of 2.

When I checked root's mail, I came across the following message:

sadc: Can't create/open data file: No such file or directory

I checked the /usr/lbin/sa directory, and the sa1, sa2, and sadc files were there. The following is a listing of the folder:

total 44
-r-xr-xr-x 1 bin bin 205 Nov 7 1997 sa1
-r-xr-xr-x 1 bin bin 250 Nov 7 1997 sa2
-r-xr-xr-x 1 bin bin 20480 Dec 1 2000 sadc

What would cause the error message to occur even though it appears the sadc file is present? Thanks.



A Journey In The Quest Of Knowledge
Andrew Kaplan
Super Advisor

Re: Running a sar script at scheduled intervals

Hi there --

I was able to solve the problem with some additional help. It turns out the absence of the /var/adm/sa directory was the root cause of the problem. Once the directory was created, the sa1 and sa2 scripts ran without issue.

Thanks for the help anyway.
A Journey In The Quest Of Knowledge