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.
xp_snmp_getstate [return_status OUTPUT]
where
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.
This example returns the state of the SNMP agent.
DECLARE @retval INT EXECUTE xp_snmp_getstate @retval OUTPUT SELECT 'status'=@retval
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.
The system administrator and users granted execute permission by the system administrator can execute this procedure.