Configuring the SQL Anywhere SNMP Extension Agent

The SQL Anywhere Extension Agent can monitor one or more databases. The databases to be monitored are stored in the sasnmp.ini file with the following format:

[SAAgent]
TrapPollTime=time-in-seconds

[DBn]
ConnStr=connection-string
UtilDbPwd=utility-database-password
CacheTime=time-in-seconds
DBSpaceCacheTime=time-in-seconds
Trapt=trap-information
Disabled=1 or 0

By default, your SQL Anywhere installation places the sasnmp.ini file in the install-dir\bin32 directory.

The SAAgent section

The SAAgent section of the sasnmp.ini file contains information about the SQL Anywhere Extension Agent. If the TrapPollTime field is not required, you can omit the entire section.

TrapPollTime   This value specifies the poll frequency for dynamic traps if they are specified. The SQL Anywhere SNMP Extension Agent polls the values every 5 seconds by default. Setting this value to 0 disables dynamic traps. This field is optional.

The DBn section

Each DBn section of the sasnmp.ini file describes a database, how to connect to it, and any dynamic traps that exist for the database. The fields in this section are case sensitive.

The value for n is a number that identifies the database. The numbers must start with 1, and numbers cannot be skipped. For example, if the sasnmp.ini file contained entries for [DB1], [DB2], and [DB4], the [DB4] entry would be ignored because the file is missing the entry for [DB3].

ConnStr   The connection string used to connect to the database. You must supply enough information to be able to connect to the database. This field is required.

  • If you want to use an ODBC data source to connect to the database, it must be a system data source, not a user data source.

  • If you want to use an integrated login, you must map to the SYSTEM account because the SNMP Agent runs as a service. However, this means that anything that runs as a service can then connect to the database without a password. Alternatively, you can change the account that the service runs under and then create an integrated login for that account.

  • The string ASTART=NO;IDLE=0;CON=SNMP;ASTOP=NO is prepended to the connection string. This string does the following:

    • prevents the SQL Anywhere SNMP Extension Agent from trying to autostart a database server

    • disables idle timeout since it is likely that the SQL Anywhere SNMP Extension Agent will sit idle for some time

    • names the connection so it can be identified

    • prevents the database from being shut down when the SQL Anywhere SNMP Extension Agent disconnects

    If you specify any of these values in the connection string in the sasnmp.ini file, the values in the sasnmp.ini file will override the default settings.

UtilDbPwd   When setting sa.agent.saStarted to start a database, the SQL Anywhere SNMP Extension Agent attempts to connect to the database with the DBF parameter, which tells the database server where to find the database file. However, if the permission required to start the database is DBA (the default for the network server, which can also be set using the -gd dba option for both the personal and network servers), then the server will not allow the connection.

To start a database on such a server, the SQL Anywhere SNMP Extension Agent must connect as a user with DBA authority to a database already running on the same server. This can be done by connecting to the utility database. If you specify the utility database password (specified by the -su server option) in the sasnmp.ini file, then to start a database, the SQL Anywhere Extension Agent connects to the utility database on the same server, executes the START DATABASE statement, and then disconnects. This field is optional.

CacheTime   When data is retrieved from the database, it can be cached inside the SQL Anywhere SNMP Extension Agent, so that subsequent retrievals of the same type of data (for example, server properties or database statistics) do not require communication with the database. While caching the data means that you can obtain the data more quickly on subsequent retrievals, the data may be out of date. The CacheTime field can be used to change the cache time, or disable the cache by setting the value to 0. By default, the cache time is 0 seconds. When the CacheTime parameter is set to 0, the data retrieved is always up-to-date because data is retrieved from the database for every request. This field is optional.

DBSpaceCacheTime   The rdbmsDbLimitedResourceTable in the RDBMS MIB contains information about dbspaces. When this information is retrieved from the database, it can also be cached inside the SQL Anywhere Extension Agent. The default cache time for dbspace information is 600 seconds (10 minutes). This field can be used to change the cache time (or disable the cache by setting the value to 0). This field is optional. See rdbmsDbLimitedResourceTable.

Trapt   Creates a dynamic trap. The value t must be a positive integer starting at 1. Skipping numbers is not allowed. This field is optional. See Creating dynamic traps.

Disabled   If set to 1, this database entry is skipped by the SQL Anywhere SNMP Extension Agent. This is useful for temporarily removing one database from the list of databases managed by the SQL Anywhere SNMP Extension Agent, without renumbering the rest. This field is optional.

Once you edit this file, you must restart the SNMP service or reset the SQL Anywhere SNMP Extension Agent so that the new settings are used by the Agent.

To restart the SNMP service (Command line)
  1. Run the following command:

    net stop snmp

    This stops the SNMP service.

  2. Execute the following command:

    net start snmp

    This starts the SNMP service.

To restart the SQL Anywhere SNMP Extension Agent

You can obfuscate the contents of the sasnmp.ini file with simple encryption using the File Hiding utility (dbfhide). See Hiding the contents of .ini files.

Sample sasnmp.ini file

The following is a sample sasnmp.ini file for the SQL Anywhere SNMP Extension Agent.

[SAAgent]
[DB1]
ConnStr=UID=DBA;PWD=sql;ENG=server1;DBN=sales;DBF=sales.db
Trap1=1.1.5 > 50000
UtilDbPwd=test
[DB2]
ConnStr=UID=DBA;PWD=sql;ENG=server1;DBN=field;DBF=field.db
UtilDbPwd=test
Disabled=1
[DB3]
ConnStr=UID=DBA;PWD=sql;LINKS=tcpip;ENG=server2;DBN=hq;DBF=hq.db
UtilDbPwd=test

Because there are no parameters specified in the SAAgent section, the SQL Anywhere SNMP Extension Agent will poll values every 5 seconds.

The SQL Anywhere SNMP Extension Agent is monitoring 3 different databases running on two different servers. Database 3 is running on a different computer, so the LINKS connection parameter is required to specify the protocol. A trap is specified for DB1, which fires when the number of bytes sent by the database server is greater than 50000.