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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configuring Apache Camel to send and recieive from QPID Broker 2 34
space utilisation on Netapp Volume 5 50
Uniden UDW20055 3 77
Extending VM Disk to be larger than 2 TB ? 11 110
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

726 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