cancel
Showing results for 
Search instead for 
Did you mean: 

PSTAT - Swap info

 
SOLVED
Go to solution
Przemyslaw Fafara
Occasional Advisor

PSTAT - Swap info

Hello

I'm writing simple monitoring tool using pstat interface. How to obtain information how much swap space on disk dev is used? When I'm using pstat_getvminfo I get sum of reserved swap on device and used space:

total_sw_dev = vbuf.psv_swapspc_max;
avail_sw_dev = vbuf.psv_swapspc_cnt;

I've looked through forum and I can't find the answer.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: PSTAT - Swap info

Shalom,

I usually use vmstat or swapinfo -tam

You can parse the output any way you want to get data back into your program.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Don Morris_1
Honored Contributor
Solution

Re: PSTAT - Swap info

You have to use pstat_getswap() to interate through the swap devices/FS's for that information.
Court Campbell
Honored Contributor

Re: PSTAT - Swap info

http://www.docs.hp.com/en/1216/pstat_whitepaper.pdf
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Przemyslaw Fafara
Occasional Advisor

Re: PSTAT - Swap info

I've checked pstat_getswap() but I can't find where this function return's used blocks on swap device.

struct __pss_blk {
struct __psdev Pss_dev; /* Device specification */
_T_ULONG_T Pss_start; /* For 300,700: starting blk */
_T_ULONG_T Pss_nblks; /* OBSOLETE, was total # of blocks */
_T_ULONG_T Pss_nblksavail; /* # of blocks available */
};

This struct returns info only about available blocks, not used blocks.
Don Morris_1
Honored Contributor

Re: PSTAT - Swap info

Look lower in vm_pstat_body.h --

#define pss_nblksenabled pss_un.Pss_blk.Pss_nblks

That's what you want, total blocks enabled on the device (for the Device case). pss_nfpgs is then pages free, pss_nblksavail is available blocks [this is usually when maxswapchunks or swchunk is too small and the system has to consider some of the possible blocks as unusable].
Sandman!
Honored Contributor

Re: PSTAT - Swap info

Look at the declaration of struct __pst_swapinfo in the vm_pstat_body.h file.