<?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 Query to get average memory usage in linux in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/Query-to-get-average-memory-usage-in-linux/m-p/542430#M4804</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need help in finding the average memory usage of 100+ linux server. we dont have permon in splunk so i cant use that to get the memory data.&lt;/P&gt;&lt;P&gt;We have 1000s of server. For CPU , I somehow found below queries . But couldn't get one for memory usage.&lt;/P&gt;&lt;P&gt;Average CPU :&lt;/P&gt;&lt;P&gt;index=os host=hostname sourcetype=cpu | multikv | search CPU="all" | eval pctCPU=100-pctIdle | stats avg(pctCPU) by host&lt;/P&gt;&lt;P&gt;For max CPU :&lt;/P&gt;&lt;P&gt;index=os sourcetype=top host=hostname |stats max(pctCPU) AS maxCPU by _time, PID, COMMAND|sort -maxCPU&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 01:10:27 GMT</pubDate>
    <dc:creator>AbdurRasheed</dc:creator>
    <dc:date>2021-03-05T01:10:27Z</dc:date>
    <item>
      <title>Query to get average memory usage in linux</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Query-to-get-average-memory-usage-in-linux/m-p/542430#M4804</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need help in finding the average memory usage of 100+ linux server. we dont have permon in splunk so i cant use that to get the memory data.&lt;/P&gt;&lt;P&gt;We have 1000s of server. For CPU , I somehow found below queries . But couldn't get one for memory usage.&lt;/P&gt;&lt;P&gt;Average CPU :&lt;/P&gt;&lt;P&gt;index=os host=hostname sourcetype=cpu | multikv | search CPU="all" | eval pctCPU=100-pctIdle | stats avg(pctCPU) by host&lt;/P&gt;&lt;P&gt;For max CPU :&lt;/P&gt;&lt;P&gt;index=os sourcetype=top host=hostname |stats max(pctCPU) AS maxCPU by _time, PID, COMMAND|sort -maxCPU&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 01:10:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Query-to-get-average-memory-usage-in-linux/m-p/542430#M4804</guid>
      <dc:creator>AbdurRasheed</dc:creator>
      <dc:date>2021-03-05T01:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get average memory usage in linux</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/Query-to-get-average-memory-usage-in-linux/m-p/542471#M4814</link>
      <description>&lt;P&gt;Ultimately you need the memory usage information to appear in a log on the server so that Splunk can work with it. If you don't have a log with this information, then you will have to generate it yourself, either by installing a monitoring software or by running a scripted input.&lt;/P&gt;&lt;P&gt;One potential solution would be to run a scripted input on each linux server, which indexes the result of the "free -m" command. (perhaps with a grep to get a single line)&lt;/P&gt;&lt;P&gt;To do this, make an app or modify an app that is deployed to your linux servers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the stanza for the inputs.conf of the app: (insert app name, index, interval, and sourcetype name below)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[script://$SPLUNK_HOME/etc/apps/&amp;lt;appName&amp;gt;/bin/getmem.sh]
disabled = false
index = ????
interval = 60
sourcetype = ????&lt;/LI-CODE&gt;&lt;P&gt;Here is the code for the script: (save to $SPLUNK_HOME/etc/apps/&amp;lt;appname&amp;gt;/bin/getmem.sh&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
free -m | grep "Mem"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 07:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/Query-to-get-average-memory-usage-in-linux/m-p/542471#M4814</guid>
      <dc:creator>dave_null</dc:creator>
      <dc:date>2021-03-05T07:29:38Z</dc:date>
    </item>
  </channel>
</rss>

