Plugin pandora_mem changed to avoid wrong values in AvailableMemory module
This commit is contained in:
parent
37b55517e1
commit
4303a99c5c
|
@ -20,36 +20,37 @@ $FREEP = floor($FREEP);
|
|||
my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
|
||||
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
|
||||
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
|
||||
my $total_meminfo=`cat /proc/meminfo | grep 'MemTotal:' | awk '{ print \$2 }'`;
|
||||
my $available=$freemem+$cached+$cachedwap;
|
||||
my $available_percent = floor(($available / $TOTAL)*100);
|
||||
my $available_percent = floor(($available / $total_meminfo)*100);
|
||||
|
||||
|
||||
print "<module>\n";
|
||||
print "<name>FreeMemory</name>\n";
|
||||
print "<type>generic_data</type>\n";
|
||||
print "<description>Free memory %. Note most linux use 99% of available memory by default, check Availablememory module for more accurate information on available physical memory on system</description>\n";
|
||||
print "<unit>%</unit>\n";
|
||||
print "<min_critical>0</min_critical>\n";
|
||||
print "<max_critical>2</max_critical>\n";
|
||||
print "<data>$FREEP</data>\n";
|
||||
print "<name><![CDATA[FreeMemory]]></name>\n";
|
||||
print "<type><![CDATA[generic_data]]></type>\n";
|
||||
print "<description><![CDATA[Free memory %. Note most linux use 99% of available memory by default, check Availablememory module for more accurate information on available physical memory on system]]></description>\n";
|
||||
print "<unit><![CDATA[%]]></unit>\n";
|
||||
print "<min_critical><![CDATA[0]]></min_critical>\n";
|
||||
print "<max_critical><![CDATA[2]]></max_critical>\n";
|
||||
print "<data><![CDATA[$FREEP]]></data>\n";
|
||||
print "</module>\n";
|
||||
|
||||
print "<module>\n";
|
||||
print "<name>FreeSwap</name>\n";
|
||||
print "<type>generic_data</type>\n";
|
||||
print "<description>Free Swap %</description>\n";
|
||||
print "<unit>%</unit>\n";
|
||||
print "<min_critical>0</min_critical>\n";
|
||||
print "<max_critical>5</max_critical>\n";
|
||||
print "<data>$SFREE</data>\n";
|
||||
print "<name><![CDATA[FreeSwap]]></name>\n";
|
||||
print "<type><![CDATA[generic_data]]></type>\n";
|
||||
print "<description><![CDATA[Free Swap %]]></description>\n";
|
||||
print "<unit><![CDATA[%]]></unit>\n";
|
||||
print "<min_critical><![CDATA[0]]></min_critical>\n";
|
||||
print "<max_critical><![CDATA[5]]></max_critical>\n";
|
||||
print "<data><![CDATA[$SFREE]]></data>\n";
|
||||
print "</module>\n";
|
||||
|
||||
print "<module>\n";
|
||||
print "<name>AvailableMemory</name>\n";
|
||||
print "<type>generic_data</type>\n";
|
||||
print "<description>Available Physical Memory % (Free+Cached+CachedSwap)</description>\n";
|
||||
print "<unit>%</unit>\n";
|
||||
print "<min_critical>0</min_critical>\n";
|
||||
print "<max_critical>10</max_critical>\n";
|
||||
print "<data>$available_percent</data>\n";
|
||||
print "<name><![CDATA[AvailableMemory]]></name>\n";
|
||||
print "<type><![CDATA[generic_data]]></type>\n";
|
||||
print "<description><![CDATA[Available Physical Memory % (Free+Cached+CachedSwap)]]></description>\n";
|
||||
print "<unit><![CDATA[%]]></unit>\n";
|
||||
print "<min_critical><![CDATA[0]]></min_critical>\n";
|
||||
print "<max_critical><![CDATA[10]]></max_critical>\n";
|
||||
print "<data><![CDATA[$available_percent]]></data>\n";
|
||||
print "</module>\n";
|
||||
|
|
Loading…
Reference in New Issue