- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Reading SAR output
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2000 01:38 AM
тАО10-17-2000 01:38 AM
Reading SAR output
as a cronjob I have sar write a record every 10 mins. during office hours to be later inspected for system stats.
I know there are much fancier tools such as perfview, but I wanted to collect the data numerically first before polishing it up by charts or so.
Because it has been quite some time since I've coded anything in C, and meanwhile I'm spoiled by the ease to do things in Perl, I found it somewhat difficult to sift through all the system header files.
At the moment I'm simply parsing the output from sar in a loop like this:
open SAR, "/usr/sbin/sar -$SARFMT{saropt}->{FLAG} -f $LOGDIR/$safile |"
|| die "couldn't pipe to sar:$!n";
while (
# do anything
}
close SAR;
Although this approach works satisfactorily I don't want to rely on the external sar command to read sar's binary data.
So I had a look at the sa1 manpage which contains a rough description of the sa struct.
The problem to me is the deep nesting of other structs in it, and to find all the dependant header files in order to form a template for Perl's pack function which would give me a chance to read sar's binary data files.
(e.g. the mentioned sysinfo.h in the manpage doesn't contain a definition of the struct sysinfo, but instead of the structs ksysinfo and ksysinfo32, so which one to use?).
Has anyone written a script/prog to read sar's binary data who could give me a description of the required data types?
Many thanks for your attention
Ralph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2000 04:06 AM
тАО10-17-2000 04:06 AM
Re: Reading SAR output
I've do somethig like that, but finaly i used sar -f and get data in ascii.
Why? Maybe sar structures may change and all my code must be revised.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2000 04:57 AM
тАО10-17-2000 04:57 AM
Re: Reading SAR output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2000 05:19 AM
тАО10-17-2000 05:19 AM
Re: Reading SAR output
about the possible changes of data structure in future OS releases you are probably right.
And by now the whole subject doesn't seem to me to be worth the effort of delving in sar's binary data format since my script is working with sar itself fine.
So why bother?
Rick,
thanks for the hint.
I had a short glance in /usr/lbin/sa/sa2 but I cannot see much difference to my solution because this script is also relying on the sar command itself to retrieve the stored binary data.
Thank you to both of you for your assistance.
Regards
Ralph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2000 03:54 AM
тАО10-18-2000 03:54 AM
Re: Reading SAR output
Well, you can write a program to read and translate binary data form /var/adm/sa/sa files, and you create your own output; but what are you really doing? ... using my_sar -f program, after more or less effort.
Then why dont use sar -f ? piped to awk ( program lenguage ).
What i do finally is run some sar -f -$option | awk > /tmp/file_x, to format my output and then paste all file_x's > all_my_sar_data. It is too much easy.
Ok? Now i get my own output and i can use EXCEL to get grafics. See http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x96046d96588ad4118fef0090279cd0f9,00.html
System integration? will run this in other system ? is it easy portable ?
But this was not your question. I think you must use ksysinfo struct because _KERNEL_BUILD directive needs include ../h/types.h, and that directory does not exist in ny box.
Perhaps man 2 pstat will be of your interest. See also http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x89677e990647d4118fee0090279cd0f9,00.html
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2000 11:52 PM
тАО10-19-2000 11:52 PM
Re: Reading SAR output
I have to apologize for the late response, but I didn't find time lately to pop in to the ITRC forum.
Since I'm not too interested in MS Excel I haven't spent much time to acquire Excel-literacy.
But if I were into Excel I think I knew how to convert my raw data because I know there are some excellent (no pun intended) Win32::OLE Modules in the CPAN that could do most of the job.
Actually, for me there is no need for any spreadsheet program because I learned the fundamentals of matrix algebra and would alway prefer an individual solution where I weren't forced to waste most of the time with formatting issues and daft menu structures.
Anyway, thank you for the hint.
I hope you aren't dissapointed if I only assign you 3 points, just to show that I appreciate your effort.
Regards
Ralph