[Nagiosplug-devel] check_swap on solaris with metadisk

Thomas Sluyter nagios at kilala.nl
Tue Jun 13 11:47:51 CEST 2006


Heya...

It seems I can answer my own question :)

> On 6/13/06, Thomas Sluyter <tsluyter at kilala.nl> wrote:
>> db5# swap -l
>> swapfile             dev  swaplo blocks   free
>> /dev/md/dsk/d20     85,20     16 2097392      0
>>
>> db5# swap -s
>> total: 3431360k bytes allocated + 34488k reserved = 3465848k used,
>> 820608k available
> From the man-page of "swap":
> > The blocks column from swap -l reports:
> > The swaplen  value  for  the  area  in  512-byte blocks.
>
> Also from that man-page:
> > The allocated column from swap -s reports:
> > The  total  amount  of  swap  space in   bytes currently allocated
> > for use as backing store.
>
> So there's a discrepancy right there.

I found the following which provides an answer for the discrepancy  
between "swap -l" and "swap -s"...

(from http://www.softpanorama.org/Solaris/Processes_and_memory/ 
swap_space_management.shtml)
=========
The virtual memory system maps physical copies of files on disk to  
virtual addresses in memory. Physical memory pages which contain the  
data for these mappings can be backed by regular files in the file  
system, or by swap space. If the memory is backed by swap space it is  
referred to as anonymous memory because there is no identity assigned  
to the disk space backing the memory.
=========
Note - The swap -l command displays swap space in 512-byte blocks and  
the swap -s command displays swap space in 1024-byte blocks. If you  
add up the blocks from swap -l and convert them to Kbytes, it will be  
less than used + available (in the swap -s output) because swap -l  
does not include physical memory in its calculation of swap space.
=========

Tricky :) It's something you just -have- to know :)

> df -k is showing
>
> Filesystem            kbytes    used   avail capacity  Mounted on
> swap                  810152      24  810128     1%    /var/run
>
> Which seems to suggest swap is only 800MB with 1% used?
Which in turn is quite odd since "swap -s" reports something  
completely different. Any chance of you throwing the full "df -k"  
output over here?

> The source for check_swap has the following
> ...
> Which to me suggests that its using swap -s for its calculations?
Yep... Seems that you're right...

>> There's more buginess in check_swap anyway... See below:
> Hmm, maybe worth not using check_swap then!
Yeah,maybe... It would be trivial to write your own shell script  
version of check_swap for Solaris :) That way you're 100% sure that  
you can trust the incoming data...

Cheers!


Thomas




More information about the Devel mailing list