<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading SAR output in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454395#M12042</link>
    <description>&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then why dont use sar -f ? piped to awk ( program lenguage ).&lt;BR /&gt;&lt;BR /&gt;What i do finally is run some sar -f -$option | awk &amp;gt; /tmp/file_x, to format my output and then paste all file_x's &amp;gt; all_my_sar_data. It is too much easy.  &lt;BR /&gt;&lt;BR /&gt;Ok? Now i get my own output and i can use EXCEL to get grafics. See &lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x96046d96588ad4118fef0090279cd0f9,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x96046d96588ad4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;System integration? will run this in other system ? is it easy  portable ?&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;                                                                                                                             &lt;BR /&gt;Perhaps man 2 pstat will be of your interest. See also &lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x89677e990647d4118fee0090279cd0f9,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x89677e990647d4118fee0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 18 Oct 2000 10:54:40 GMT</pubDate>
    <dc:creator>Carlos Fernandez Riera</dc:creator>
    <dc:date>2000-10-18T10:54:40Z</dc:date>
    <item>
      <title>Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454391#M12038</link>
      <description>Here's a question for C system hackers,&lt;BR /&gt;&lt;BR /&gt;as a cronjob I have sar write a record every 10 mins. during office hours to be later inspected for system stats.&lt;BR /&gt;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.&lt;BR /&gt;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.&lt;BR /&gt;At the moment I'm simply parsing the output from sar in a loop like this:&lt;BR /&gt;&lt;BR /&gt;open SAR, "/usr/sbin/sar -$SARFMT{saropt}-&amp;gt;{FLAG} -f $LOGDIR/$safile |"&lt;BR /&gt;   || die "couldn't pipe to sar:$!n";&lt;BR /&gt;while (&lt;SAR&gt;) {&lt;BR /&gt;   # do anything&lt;BR /&gt;}&lt;BR /&gt;close SAR;&lt;BR /&gt;&lt;BR /&gt;Although this approach works satisfactorily I don't want to rely on the external sar command to read sar's binary data.&lt;BR /&gt;So I had a look at the sa1 manpage which contains a rough description of the sa struct.&lt;BR /&gt;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.&lt;BR /&gt;(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?).&lt;BR /&gt;Has anyone written a script/prog to read sar's binary data who could give me a description of the required data types?&lt;BR /&gt;&lt;BR /&gt;Many thanks for your attention&lt;BR /&gt;Ralph&lt;BR /&gt;&lt;/SAR&gt;</description>
      <pubDate>Tue, 17 Oct 2000 08:38:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454391#M12038</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2000-10-17T08:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454392#M12039</link>
      <description>&lt;BR /&gt;I've do somethig like that, but finaly i used sar -f and get data in ascii.&lt;BR /&gt;&lt;BR /&gt;Why?  Maybe sar structures may change and all my code must be revised.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Oct 2000 11:06:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454392#M12039</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2000-10-17T11:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454393#M12040</link>
      <description>The tool sa2 to convert the binary sar data to ascii is already present on the system. The output will include the numerical data with the date and time it was collected. &lt;BR /&gt;</description>
      <pubDate>Tue, 17 Oct 2000 11:57:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454393#M12040</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2000-10-17T11:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454394#M12041</link>
      <description>Carlos,&lt;BR /&gt;&lt;BR /&gt;about the possible changes of data structure in future OS releases you are probably right.&lt;BR /&gt;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.&lt;BR /&gt;So why bother?&lt;BR /&gt;&lt;BR /&gt;Rick,&lt;BR /&gt;&lt;BR /&gt;thanks for the hint.&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Thank you to both of you for your assistance.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ralph&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Oct 2000 12:19:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454394#M12041</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2000-10-17T12:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454395#M12042</link>
      <description>&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then why dont use sar -f ? piped to awk ( program lenguage ).&lt;BR /&gt;&lt;BR /&gt;What i do finally is run some sar -f -$option | awk &amp;gt; /tmp/file_x, to format my output and then paste all file_x's &amp;gt; all_my_sar_data. It is too much easy.  &lt;BR /&gt;&lt;BR /&gt;Ok? Now i get my own output and i can use EXCEL to get grafics. See &lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x96046d96588ad4118fef0090279cd0f9,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x96046d96588ad4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;System integration? will run this in other system ? is it easy  portable ?&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;                                                                                                                             &lt;BR /&gt;Perhaps man 2 pstat will be of your interest. See also &lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x89677e990647d4118fee0090279cd0f9,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x89677e990647d4118fee0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Oct 2000 10:54:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454395#M12042</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2000-10-18T10:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SAR output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454396#M12043</link>
      <description>Hello Carlos,&lt;BR /&gt;&lt;BR /&gt;I have to apologize for the late response, but I didn't find time lately to pop in to the ITRC forum.&lt;BR /&gt;Since I'm not too interested in MS Excel I haven't spent much time to acquire Excel-literacy.&lt;BR /&gt;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.&lt;BR /&gt;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.&lt;BR /&gt;Anyway, thank you for the hint.&lt;BR /&gt;I hope you aren't dissapointed if I only assign you 3 points, just to show that I appreciate your effort.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Ralph</description>
      <pubDate>Fri, 20 Oct 2000 06:52:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reading-sar-output/m-p/2454396#M12043</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2000-10-20T06:52:09Z</dc:date>
    </item>
  </channel>
</rss>

