xp_snmp_getstate (version 6.5)

Returns the state of the SQL Server Simple Network Management Protocol (SNMP) agent. The state of the SNMP agent indicates whether the agent is available to have the Microsoft SQL Server server queried by an SNMP client.

For more information about Simple Network Management Protocol (SNMP), consult your Microsoft Windows NT operating-system documentation.

Syntax

xp_snmp_getstate [return_status OUTPUT]

where

return_status OUTPUT
Specifies the status returned from the SNMP agent. The return status must have an int datatype. Executing the procedure with no parameters returns a results set that indicates the status and the definition of the SNMP agent's state.

Remarks

The SQL Server SNMP agent interacts between SQL Server and SNMP clients that are running an operating system, including Windows NT, UNIX®, or another mainframe computer operating system. Stored procedures that depend upon the SNMP agent can query the SNMP agent to make sure it is available and in a normal state before proceeding.

For more information about SNMP agents, see, What's New for Administrators earlier in this document.

If xp_snmp_getstate is executed with no parameters (for example, EXECUTE xp_snmp_getstate), a status and its meaning are returned. Status indicates the status code integer and meaning explains the status code. For a complete list of all statuses, see xp_snmp_raisetrap later in this document.

Examples

A.    Return SNMP Agent Status

This example returns the state of the SNMP agent.

DECLARE @retval INT
EXECUTE xp_snmp_getstate @retval OUTPUT
SELECT 'status'=@retval
  
B.    Return SNMP Agent Status and Meaning

This example returns status and status meaning for the current SNMP agent.

EXECUTE xp_snmp_getstate
  
Status            Meaning
--------------     --------------------------------
3                The network has not been started.
  

Permission

The system administrator and users granted execute permission by the system administrator can execute this procedure.