<?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 Is *nix sourcetype=ps' pctCPU really suitable for charting OOTB? in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40198#M444</link>
    <description>&lt;P&gt;Hi all, I am reasoning about the *nix app sourcetype=ps' pctCPU metric and how to plot it correctly.&lt;/P&gt;

&lt;P&gt;I see Splunk's &lt;EM&gt;nix app generally plots it by doing *&lt;/EM&gt;... | timechart avg(pctCPU) by ...**. This would be perfectly fine if pctCPU expressed the instantaneous usage of cpu (as top does). Instead, per "man ps" definition (RHEL 5.5): &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; %cpu       %CPU     cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu).
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;pctCPU&lt;/EM&gt; expresses the average cpu used by the process since its startup (cpu time / total run time)!&lt;/P&gt;

&lt;P&gt;Say the process has long been running with low usage, then it has a burst for some minutes,  then usage drops again. Ps' pctCPU would not reflect this behaviour as the total cpu time over which it has been computed did not increment that much with respect to total runtime. pctCPU is smoothed in this case.&lt;/P&gt;

&lt;P&gt;Does my reasoning make any sense to you? &lt;/P&gt;

&lt;P&gt;I have a quite complex solution under work which involves computing deltas of CPUTIME and ELAPSED (splunk's ps.sh definitions) for any multikv'ed ps execution, then compute "instantaneous" pctCPU, then average and plot it. &lt;BR /&gt;
However, this is a fairly slow (requires to use &lt;EM&gt;| sort +host +PID +COMMAND +_time&lt;/EM&gt; with all its limits) and complex solution. &lt;/P&gt;

&lt;P&gt;Has anybody came up with something better?&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2011 15:11:27 GMT</pubDate>
    <dc:creator>Paolo_Prigione</dc:creator>
    <dc:date>2011-07-08T15:11:27Z</dc:date>
    <item>
      <title>Is *nix sourcetype=ps' pctCPU really suitable for charting OOTB?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40198#M444</link>
      <description>&lt;P&gt;Hi all, I am reasoning about the *nix app sourcetype=ps' pctCPU metric and how to plot it correctly.&lt;/P&gt;

&lt;P&gt;I see Splunk's &lt;EM&gt;nix app generally plots it by doing *&lt;/EM&gt;... | timechart avg(pctCPU) by ...**. This would be perfectly fine if pctCPU expressed the instantaneous usage of cpu (as top does). Instead, per "man ps" definition (RHEL 5.5): &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; %cpu       %CPU     cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu).
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;pctCPU&lt;/EM&gt; expresses the average cpu used by the process since its startup (cpu time / total run time)!&lt;/P&gt;

&lt;P&gt;Say the process has long been running with low usage, then it has a burst for some minutes,  then usage drops again. Ps' pctCPU would not reflect this behaviour as the total cpu time over which it has been computed did not increment that much with respect to total runtime. pctCPU is smoothed in this case.&lt;/P&gt;

&lt;P&gt;Does my reasoning make any sense to you? &lt;/P&gt;

&lt;P&gt;I have a quite complex solution under work which involves computing deltas of CPUTIME and ELAPSED (splunk's ps.sh definitions) for any multikv'ed ps execution, then compute "instantaneous" pctCPU, then average and plot it. &lt;BR /&gt;
However, this is a fairly slow (requires to use &lt;EM&gt;| sort +host +PID +COMMAND +_time&lt;/EM&gt; with all its limits) and complex solution. &lt;/P&gt;

&lt;P&gt;Has anybody came up with something better?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2011 15:11:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40198#M444</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2011-07-08T15:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is *nix sourcetype=ps' pctCPU really suitable for charting OOTB?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40199#M445</link>
      <description>&lt;P&gt;A simplistic answer would be to use &lt;CODE&gt;sourcetype=top&lt;/CODE&gt; instead.  I have the same problem, but my use case requires stats by fields only available in &lt;CODE&gt;sourcetype=ps&lt;/CODE&gt;.  Therefore the simplistic answer wouldn't suffice.  The unfortunate use of the same field name &lt;CODE&gt;pctCPU&lt;/CODE&gt; in these two sources to mean very different things has prompted my new question &lt;A href="https://answers.splunk.com/answers/318807/how-to-cherry-pick-values-from-different-sources.html"&gt;https://answers.splunk.com/answers/318807/how-to-cherry-pick-values-from-different-sources.html&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 06:01:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40199#M445</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-10-21T06:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is *nix sourcetype=ps' pctCPU really suitable for charting OOTB?</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40200#M446</link>
      <description>&lt;P&gt;A more sophisticated solution to this problem is posted in the above question.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2015 18:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Is-nix-sourcetype-ps-pctCPU-really-suitable-for-charting-OOTB/m-p/40200#M446</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2015-10-21T18:32:03Z</dc:date>
    </item>
  </channel>
</rss>

