iSeries Disk USage

Posted on 2009-07-14
Last Modified: 2013-12-06
I was wondering if there was a way that I could obtain the disk usage of my iSeries servers via some kind of script. We have over 50 servers and I do not want to have to log into each one of them and do a WRKSYSSTS to figure out how much disk is available.  Is there an easy way around this?
Question by:Matthew Roessner

Expert Comment

ID: 24852148
Hi hfcsp,

WRKSYSSTS or WRKDSKSTS has the OUTPUT parameter customizable. You can generate a spoulefile and configure the 'output' queue to redirect it to an e-mail. So you'll receive the information in your e-mail.

Otherwise, there might be software customizable for that. We use What's up software in here. There's many stuff that we already check. Never tried to go deeper like this. Might be possible.

But my first suggestion could help you... Let me know if you need more info about it.

LVL 35

Expert Comment

by:Gary Patterson
ID: 24853242
Lots of options, but SNMP is probably the best overall.  SNMP will give you much, much more than just disk usage.

SNMP is part of the base OS, and provides a great interface for centralized reporting.  Plus it is an industry standard, and you can use any of thousands of free or commercial utilities and Network Management Systems to query via SNMP and report various information.  If you aren't familiar with SNMP and the associated tools, start with this IBM Redbook (old, but it still applies), and then check out some of the other links.  Note that SNMP grew up in a Unix environment, and most of the best tools are deployed under Unix or Linux, though lots of Windows ports exist, too.

If you manage a lot of servers, routers, and desktopps, you probably already have some sort of NMS in house that you can integrate with.  Ask your LAN/WAN team what they use for network monitoring and management.

You can also use a Management Central System Monitor:

- Gary Patterson

LVL 27

Accepted Solution

tliotta earned 250 total points
ID: 24853422

You might be looking for the Retrieve System Status (QWCRSSTS) API. See here for V5R4 docs:

And see the attached for a trivial example of calling the API in CL. The example extracts a few varied items from the API receiver variable -- system ASP size, system ASP percentage used and total auxiliary storage, plus the LPAR number and the number of LPARs along with the extract date/time in CYYMMDDHHMMSS format.

The example simply does a DMPCLPGM at the end to show the extracted values. You'd likely want to replace that command with code to store the extracted values somewhere. You might prefer writing the same function in a HLL that supports database I/O, or you could call this program and pass the extracted values back as return parms.

It should be possible to copy the sample in a CL source member, compile it and run it as is, to see the dumped results. Additional error handling may be necessary.


/* The API parms...                                                 */
/*   For Retrieve System Status...                                  */
   dcl   &sts_DATA    *char  148
   dcl   &sts_LEN     *char    4     value( x'00000094' )
   dcl   &sts_FORMAT  *char    8     value( 'SSTS0200' )
   dcl   &RESET_IND   *char   10     value( '*NO' )
/*   For number of LPARs and LPAR number...                         */
   dcl   &N_LPAR      *dec (   3 0 ) value( 0 )
   dcl   &LPAR_N      *dec (   3 0 ) value( 0 )
/*   For system ASP and total AUX storage...                        */
   dcl   &ASPSIZ      *dec (   9 0 ) value( 0 )
   dcl   &ASPPCT      *dec (   7 4 ) value( 0 )
   dcl   &TOTAUX      *dec (   9 0 ) value( 0 )
/*   For Convert Date & Time...                                     */
   dcl   &CDT_I_FORM  *char   10     value( *DTS )
   dcl   &CDT_I_VAR   *char    8
   dcl   &CDT_O_FORM  *char   10     value( *YMD )
   dcl   &CDT_O_VAR   *char   16
/* And we'll need to specify an errcode receiver at some points...  */
   dcl   &ERRCODE     *char  116     value( x'00000074' )
   dcl   &ERRLEN      *dec (   3 0 ) value( 0 ) /* +
                Will tell us how long any exception data +
                is... */
/* This is a *char version of the date var....                      */
   dcl   &DATTIM      *char   16
   call         QWCRSSTS        ( +
                                  &sts_DATA +
                                  &sts_LEN +
                                  &sts_FORMAT +
                                  &RESET_IND +
                                  &ERRCODE +
   chgvar      &ERRLEN        %bin( &ERRCODE 5 4 )
/* Test for any error...                                            */
   if ( &ERRLEN *gt 0 )  do
      sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                   msgdta( +
                           %sst(&ERRCODE 9 7) *bcat  +
                           'error exception'  +
                         ) +
                   msgtype( *ESCAPE )
   chgvar      &CDT_I_VAR     %sst( &sts_DATA 9 8 )
   call         QWCCVTDT        ( +
                                  &CDT_I_FORM +
                                  &CDT_I_VAR +
                                  &CDT_O_FORM +
                                  &CDT_O_VAR +
                                  &ERRCODE +
   chgvar      &ERRLEN        %bin( &ERRCODE 5 4 )
/* Test for any error...                                            */
   if ( &ERRLEN *gt 0 )  do
      sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                   msgdta( +
                           %sst(&ERRCODE 9 7) *bcat  +
                           'error exception'  +
                         ) +
                   msgtype( *ESCAPE )
   chgvar      &DATTIM              &CDT_O_VAR
   chgvar      &N_LPAR        %bin( &sts_DATA 77 4 )
   chgvar      &LPAR_N        %bin( &sts_DATA 81 4 )
   chgvar      &ASPSIZ        %bin( &sts_DATA 49 4 )       /* In MB */
   chgvar      &ASPPCT      ( %bin( &sts_DATA 53 4 ) / 10000 )
   chgvar      &TOTAUX        %bin( &sts_DATA 57 4 )       /* In MB */

Open in new window


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lets start to have a small explanation what is VAAI(vStorage API for Array Integration ) and what are the benefits using it. VAAI is an API framework in VMware that enable some Storage tasks. It first presented in ESXi 4.1, but only after 5.x sup…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question