I get a lot of out-of-memory alerts on my agents because it all includes cached RAM. For example on this one server this is the RAM status:
As you can see there is actually 6562 MB of RAM available so no issue there. Here is a screenshot from the data in Pandora:
How could I resolve this so I don't get so many false positives?
Memory alerts because of cached ram
Murfy · 6 nov 2014, 20:51 · 10 mensajes · 98 visitas
- Inicio del debate
Hi, In / usr / share / pandora_server / util, there is a script called "pandora_db.pl". If you run it, the DB will be cleaned and you can free up memory. Also, in "Setup" - "Performance", you can set the number of days you want to have the files. I've attached a screenshot. regards
[

](//pandorafms.com/community/media/forum/0/17696=729-setup_performance.png)
I think you misunderstood. The issue is that Pandora agents check the RAM with 'vmstat -s'. This is not entirely correct because most of the allocated RAM memory is just cached and can be released when needed. See also http://www.linuxatemyram.com/. The problem is not that the Pandora Server is taking up too much memory. I have checked the source code of the pandora_mem plugin, and indeed it checks using vmstat: http://fossies.org/linux/pandorafms\_agent\_unix/plugins/pandora\_mem Which reports cached memory as "taken".
I totally agree with you. I try to submit a bug, but.. no luck. This is the change I made to the pandora_mem plugin and now its working fine. florida-proxy:/etc/pandora/plugins# cat pandora_mem #!/usr/bin/perl # Pandora FMS Plugin to get memory information on Linux # (c) 2014 Sancho Lerena <[email protected] use POSIX; my $TOTAL=`vmstat -s | grep "total memory" | awk '{ print $1 } '`; my $FREE=`vmstat -s | grep "free memory" | awk '{ print $1 } '`; [glow=red,2,300]my $CACHE=`vmstat -s | grep "swap cache" | awk '{ print $1 } '`; my $FREEP=(($FREE+$CACHE)*100)/$TOTAL; [/glow]my $STOTAL=`vmstat -s | grep "total swap" | awk '{ print $1 } '`; my $SUSED=`vmstat -s | grep "free swap" | awk '{ print $1 } '`; my $SFREE=($SUSED/$STOTAL)*100; $SFREE = floor($SFREE); $FREEP = floor($FREEP); print "n"; print "FreeMemoryn"; print "generic_datan"; print "Free memory %n"; print "%n"; print "0n"; print "5n"; print "$FREEPn"; print "n"; print "n"; print "FreeSwapn"; print "generic_datan"; print "Free Swapy %n"; print "%n"; print "0n"; print "10n"; print "$SFREEn"; print "n";
Hello, I'm the original author of the plugin :) first question. You said you try to submit a bug, but, where?, how?. We don't find it. Try methods proposed in our website: http://pandorafms.com/Community/report\_anything/en Or using github issue tracker. More, about the plugin itself: I do not consider swap cache as a real free memory, because could be dangerous to rely on pages are about to be written to disk but are currently on ram. You can consider adding buffer memory or either inactive memory, but the most safe concept here will be -for me- total memory - used memory, in any case, you can modify the plugin to adapt to your needs, thats good :)
I totally agree with you. I try to submit a bug, but.. no luck. This is the change I made to the pandora_mem plugin and now its working fine. florida-proxy:/etc/pandora/plugins# cat pandora_mem #!/usr/bin/perl # Pandora FMS Plugin to get memory information on Linux # (c) 2014 Sancho Lerena <[email protected] use POSIX; my $TOTAL=`vmstat -s | grep "total memory" | awk '{ print $1 } '`; my $FREE=`vmstat -s | grep "free memory" | awk '{ print $1 } '`; [glow=red,2,300]my $CACHE=`vmstat -s | grep "swap cache" | awk '{ print $1 } '`; my $FREEP=(($FREE+$CACHE)*100)/$TOTAL; [/glow]my $STOTAL=`vmstat -s | grep "total swap" | awk '{ print $1 } '`; my $SUSED=`vmstat -s | grep "free swap" | awk '{ print $1 } '`; my $SFREE=($SUSED/$STOTAL)*100; $SFREE = floor($SFREE); $FREEP = floor($FREEP); print "n"; print "FreeMemoryn"; print "generic_datan"; print "Free memory %n"; print "%n"; print "0n"; print "5n"; print "$FREEPn"; print "n"; print "n"; print "FreeSwapn"; print "generic_datan"; print "Free Swapy %n"; print "%n"; print "0n"; print "10n"; print "$SFREEn"; print "n";
Hi there! Tnxs for you reply. The thing is that I don't have a single server without a warning with the original way of the check. Every server that use mysql, apache, squid, samba uses all the ram. Even so, if I have a server that dosen't uses all the ram, and the "spare" is used on the cache, its because we did something wrong on the setup of the services to take full advantage of the ram. Maybe my approach is a bit extreme, and there is a better way. But considering the free ram this way, dosen't work, at least for me.
Sorry, I dindn't answer the thing about posting bugs. I will try this with a few things that I saw. Tnxs!
Hi again Just to follow this issue. Finally we added a new module called "Available" memory using your proposal. AND we alter the FreeMemory default thresholds to do not fire (WARNING) in most cases. This will be the default 5.2SP2 and 6.0. Thanks for the feedback!
great! the only thing I suggest, please don't rename the checks on future versions. if you do this, we lost the history and the old ones change the state to "unknown".
Hi, is good to know you keep the thread alive. The old module keeps the same, I've added a new check. Some people will continue using the old one and changing the behavior in an update can affect them, keeping old thresholds on new data ranges. Take a look on changes: https://github.com/pandorafms/pandorafms/commit/82b365996d07252c91ba9aecf8046e02eb2023e0#diff-1bd631711dac2f49030817be08732f34 Best regards,
Entra en tu cuenta para publicar.

