<html><body bgcolor="#FFFFFF"><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">On 2 Aug 2011, at 15:58, "Wenig, Michael (IT/I4Z)" <<a href="mailto:michael.wenig@ww-informatik.de">michael.wenig@ww-informatik.de</a>> wrote:</span><br>
</div><div><br></div><div></div><blockquote type="cite"><div>



<p><font size="2" face="Arial">Hi all,</font>
</p>

<p><font size="2" face="Arial">We want to know when one of our servers is swapping as a swapping server is a normally dead server :-)</font>
</p>

<p><font size="2" face="Arial">Currently we have the "normal" swap checks which generates a warning when more than 5% swap are used and a critical when more than 10% are used. </font></p>

<p><font size="2" face="Arial">This works ok until one time someone needs a little bit of swap. The swap gets used but never unused (as linux does not remove something as long it is not needed). So we get warnings and criticals while just some parts of swap are used but not "active" (in terms of it is actively read from).</font></p>


<p><font size="2" face="Arial">I think it would be more sufficient to not monitor how much swap is in use but to check if pages are read from swap in some period of time. Such as</font></p>

<p><font size="2" face="Arial">warning: if some pages were read out of swap</font>

<br><font size="2" face="Arial">critical: if in all of the last three measurement-periods pages were read</font>
</p>

<p><font size="2" face="Arial">I can acces the "absolute" swap out-page count by e.g. </font>
</p>

<p><font size="2" face="Arial">cat /proc/vmstat | grep pswpout | cut -d " " -f2</font>
</p>

<p><font size="2" face="Arial">which gives me the number of pages swapped out since the last boot. So I would need to save this to some file and read it back.</font></p>

<p><font size="2" face="Arial">I searched for a plugin which already does this (or a similar) kind of check but I did not found anything.</font>
</p>

<p><font size="2" face="Arial">So now I am wondering:</font>
</p>

<p><font size="2" face="Arial">- did I just miss a plugin</font>

<br><font size="2" face="Arial">- do I think completely wrong and my opinion is bullshit?</font>
</p>
<br>

<p><font size="2" face="Arial">So the questions:</font>
</p>

<p><font size="2" face="Arial">- does this kind of check make sense?</font>

<br><font size="2" face="Arial">- is there any plugin which does this already?</font></p></div></blockquote><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><div>
Apologies if you're already doing/aware of this:</div>Most Linux distros tend to have a default kernel swappiness setting of between 40-60%. This is fine for a desktop, but for servers I tend to set this to 0 - basically telling the kernel to only use swap if it really has to. </span><div>
<span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">another option (slightly hacky imo) is to periodically empty the swap in times where free RAM is plentiful by using swapon/swapoff.</span></div>
<div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><br>
<br>--<div>Richard Clark</div><div><a href="mailto:richard@fohnet.co.uk">richard@fohnet.co.uk</a></div></span></div></body></html>