Solaris System Management Agent Administration Guide

Common Operations With the System Management Agent

ProcedureTo Check Whether Another Process Is Running on the SMA Port

Port 161 is reserved for the System Management Agent. For more information, see Managing Configuration With the Main Configuration File.

    Use the netstat command:


    # netstat -anv|grep 161
    

    If a value of 161 is returned, a process is already bound to port 161.

ProcedureTo View the Status of the Agent

    As root, get the service status.


    # svcs svc:/application/management/sma:default
    

    A typical response to this command is shown:


    STATE          STIME    FMRI
    online         Aug_24   svc:/application/management/sma:default

ProcedureTo See Which MIBs Are Initialized

    Use one of the following methods to list those MIBs that are initialized when the SMA is started.

    • Examine the debug trace that is produced by running the following command:


      # /usr/sfw/sbin/snmpd  -Dregister_mib -Dmib_init -L
      
    • Alternatively, use the net-snmp-config command to see a list of those modules that are compiled.


      # /usr/sfw/bin/net-snmp-config --snmpd-module-list
      

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

The snmpnetstat command

In the same way as you would use the netstat command, you can check the status of the network using the System Management Agent with the snmpnetstat command.

To show the state of all sockets, use the snmpnetstat command with the –a option. This option provides the default display, showing all active sockets, except those used by server processes.


# snmpnetstat -v 2c -c public -a testhost

The following information, including local and remote addresses, and protocols, is typically displayed:


Active Internet (tcp) Connections (including servers)
     Proto Local Address Foreign Address (state)
     tcp   *.echo        *.*             LISTEN
     tcp   *.discard     *.*             LISTEN
     tcp   *.daytime     *.*             LISTEN
     tcp   *.chargen     *.*             LISTEN
     tcp   *.ftp         *.*             LISTEN
     tcp   *.telnet      *.*             LISTEN
     tcp   *.smtp        *.*             LISTEN

     Active Internet (udp) Connections
     Proto Local Address
     udp   *.echo
     udp   *.discard
     udp   *.daytime
     udp   *.chargen
     udp   *.time

To show the state of network interfaces, use the snmpnetstat command with the –i option. This option provides a statistics table that shows packets transferred, errors, and collisions as well as network addresses of the interface and the maximum transmission units (MTU).


# snmpnetstat -v 2c -c public -i testhost

The following table, including local and remote addresses, and protocols, is typically displayed:


Name Mtu  Network   Address  Ipkts     Ierrs  Opkts  Oerrs Queue
     eri0 1500 10.6.9/24 testhost 170548881 245601 687976 0     0
     lo0  8232 127      localhost 7530982   0      7530982 0    0

Note –

The Ipkts, or incoming packets, value reported by the snmpnetstat command is not identical to that reported by the netstat command. The snmpnetstat command displays the total number of unicast, multicast and broadcast packets. The netstat command displays the total number of unicast and multicast packets, omitting broadcast packets.