iSeries Disk USage

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?
Matthew RoessnerSenior Systems ProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Gary PattersonVP Technology / Senior Consultant Commented:
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


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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.