Solaris System Management Agent Administration Guide

ProcedureTo Check the Disk Space on a Local or Remote Machine

First find the total disk space of the disk, then find how much of this space is used. The difference between these two totals is the available disk space.

  1. Find the number of disks that are available on a given host.


    # snmpwalk -v1 -c public hostname HOST-RESOURCES-MIB::hrStorageIndex
    

    This command returns a list of disks on the host, hostname:


    HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
    HOST-RESOURCES-MIB::hrStorageIndex.2 = INTEGER: 2
    HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3
    HOST-RESOURCES-MIB::hrStorageIndex.4 = INTEGER: 4
    HOST-RESOURCES-MIB::hrStorageIndex.5 = INTEGER: 5
    HOST-RESOURCES-MIB::hrStorageIndex.6 = INTEGER: 6
    HOST-RESOURCES-MIB::hrStorageIndex.7 = INTEGER: 7
    HOST-RESOURCES-MIB::hrStorageIndex.8 = INTEGER: 8
    HOST-RESOURCES-MIB::hrStorageIndex.9 = INTEGER: 9
    HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10
    HOST-RESOURCES-MIB::hrStorageIndex.101 = INTEGER: 101
    HOST-RESOURCES-MIB::hrStorageIndex.102 = INTEGER: 102

    The disk is indicated by the index number:


    HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1

    This output represents disk 1, /dev/dsk/c0t0d0s0

  2. Use the snmpget command to retrieve the total storage space for that disk.

    The following command would retrieve the total storage space for disk 1:


    # snmpget -v1 -c public hostname HOST-RESOURCES-MIB::hrStorageSize.1
    

    This command returns the total disk space at the end of the line:


    HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 2561695
  3. View a list of the disk space used by each disk.


    # snmpwalk -v1 -c public hostname HOST-RESOURCES-MIB::hrStorageUsed
    

    HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 2121747
    HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 0
    HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 0
    HOST-RESOURCES-MIB::hrStorageUsed.4 = INTEGER: 0
    HOST-RESOURCES-MIB::hrStorageUsed.5 = INTEGER: 11
    HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 48
    HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 1892576
    HOST-RESOURCES-MIB::hrStorageUsed.8 = INTEGER: 0
    HOST-RESOURCES-MIB::hrStorageUsed.9 = INTEGER: 130565552
    HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 26036932
    HOST-RESOURCES-MIB::hrStorageUsed.101 = INTEGER: 55995
    HOST-RESOURCES-MIB::hrStorageUsed.102 = INTEGER: 17171 
  4. Use the snmpget command to view the storage used by the disk in question.


    # snmpget -v1 -c public hostname HOST-RESOURCES-MIB::hrStorageUsed.1
    

    This command returns the disk space used on disk 1:


    HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 2121747
  5. Subtract this figure from the total disk space to find the available disk space:

    2561695 – 2121747 = 439948