On 6/13/06, <b class="gmail_sendername">Thomas Sluyter</b> <<a href="mailto:tsluyter@kilala.nl">tsluyter@kilala.nl</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 13 Jun, 2006, at 10:27, Ben O'Hara wrote:<br><br>> db5# swap -l<br>> swapfile             dev  swaplo blocks   free<br>> /dev/md/dsk/d20     85,20     16 2097392      0<br>><br>> db5# swap -s<br>> total: 3431360k bytes allocated + 34488k reserved = 3465848k used,
<br>> 820608k available<br><br> From the man-page of "swap":<br>> The blocks column from swap -l reports:<br>> The swaplen  value  for  the  area  in  512-byte blocks.<br><br>Also from that man-page:<br>
> The allocated column from swap -s reports:<br>> The  total  amount  of  swap  space in   bytes currently allocated<br>> for use as backing store.<br><br>So there's a discrepancy right there.<br><br>How could your swap partition be 
2.097.392 * 512 (about 1G) in size,<br>when you have a total of over 3.4G in use? Swap -l does indeed report<br>that there are zero blocks free... Odd.<br><br>Could it be that you defined a non-default block size when creating
<br>the swap space? Something like ~2048 per block? Could be that "swap -<br>l" doesn't actually report the size in 512 blocks, but in the -real-<br>size blocks. If check_swap was relying on swap -l , then the<br>
calculation would be off as well... Seems like this might be a bit of<br>a bug in Solaris' "swap -l" command?<br><br>Anywho, looking at my own systems the combination of "df -k" and<br>"swap -s" seems to be the more reliable way of telling the real swap
<br>usage.<br><br>So instead of the output of "metastat" I'm more curious about the<br>output of "df -k". This should show the size for your swap device in<br>kB (look for /var/run)...<br><br>Now, if "df -k" supports your claim that swap space is 4G in size I'd
<br>wager that check_swap was using the "swap -l" approach, while it<br>could be making better use of the "swap -s" way.</blockquote><div><br><br>Hi Thomas, thanks for the detailed reply.<br><br>df -k is showing
<br><br>Filesystem            kbytes    used   avail capacity  Mounted on<br>swap                  810152      24  810128     1%    /var/run<br><br>Which seems to suggest swap is only 800MB with 1% used?<br><br>The source for check_swap has the following
<br><br>#   ifdef sun<br>        if (!allswaps) {<br>                asprintf(&swap_command, "%s", "/usr/sbin/swap -s");<br>                asprintf(&swap_format, "%s", "%*s %*dk %*s %*s + %*dk %*s = %dk
<br>%*s %dk %*s");<br>                conv_factor = 2048;<br>        }<br>#   endif<br><br><br>Which to me suggests that its using swap -s for its calculations?<br><br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There's more buginess in check_swap anyway... See below:<br>> JST $ ./check_swap -w 85% -c 95%<br>> Warning percentage should be more than critical percentage<br>> Usage:<br>> check_swap [-a] -w <used_percentage>% -c <used_percentage>%
<br>> check_swap [-a] -w <bytes_free> -c <bytes_free><br>> check_swap (-h | --help) for detailed help<br>> check_swap (-V | --version) for version information<br>><br>> JST $ ./check_swap -w 15% -c 5%
<br>> SWAP OK: 98% free (1360 MB out of 1391 MB) |swap=1360MB;208;69;0;1391<br>Meaning that the author got "used_percentage" mixed up with<br>"free_percentage"</blockquote><div><br><br>Hmm, maybe worth not using check_swap then!
<br><br>Cheers<br><br>Ben <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Cheers!<br><br><br>Thomas<br><br><br>_______________________________________________________
<br>Nagios Plugin Development Mailing List <a href="mailto:Nagiosplug-devel@lists.sourceforge.net">Nagiosplug-devel@lists.sourceforge.net</a><br>Unsubscribe at <a href="https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel">
https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel</a><br>::: Please include plugins version (-v) and OS when reporting any issue.<br>::: Messages without supporting info will risk being sent to /dev/null<br></blockquote>
</div><br><br clear="all"><br>-- <br>"A Scientist will earn a living by taking a really difficult problem and spends many years solving it, an engineer earns a living by finding really difficult problems and side stepping them"