This template is designed for the effortless deployment of MSSQL monitoring by Zabbix via Zabbix agent 2 and uses a loadable plugin to run SQL queries.

Setup:

1. Deploy Zabbix agent 2 with the MSSQL plugin. You can use this template starting with Zabbix versions 6.0.27 / 6.4.12.

  For more information, see MSSQL plugin documentation: https://git.zabbix.com/projects/AP/repos/mssql/browse
  
  Loadable plugin requires installation of one of the following:

  - Separate package
  
  - Binary file
  
  - Compilation from sources: https://www.zabbix.com/documentation/7.2/manual/extensions/plugins/build

2. Create an MSSQL user for monitoring.

  View Server State and View Any Definition permissions should be granted to the user.
  Grant this user read permissions to the sysjobschedules, sysjobhistory, and sysjobs tables.

  For more information, see MSSQL documentation:
  
  - Create a database user: https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-database-user?view=sql-server-ver16
  
  - GRANT Server Permissions: https://docs.microsoft.com/en-us/sql/t-sql/statements/grant-server-permissions-transact-sql?view=sql-server-ver16
  
  - Configure a User to Create and Manage SQL Server Agent Jobs: https://docs.microsoft.com/en-us/sql/ssms/agent/configure-a-user-to-create-and-manage-sql-server-agent-jobs?view=sql-server-ver16

3. Set the user name and password in the host macros ({$MSSQL.USER} and {$MSSQL.PASSWORD}).

4. Set the connection string for the MSSQL instance in the {$MSSQL.URI} macro as a URI, such as <protocol://host:port>, or specify the named session - <sessionname>.

The "Service's TCP port state" item uses the {$MSSQL.HOST} and {$MSSQL.PORT} macros to check the availability of the MSSQL instance, change these if necessary. Keep in mind that if dynamic ports are used on the MSSQL server side, this check will not work correctly.

Note: You can use the context macros {$MSSQL.BACKUP_FULL.USED}, {$MSSQL.BACKUP_LOG.USED}, and {$MSSQL.BACKUP_DIFF.USED} to disable backup age triggers for a certain database. If set to a value other than "1", the trigger expression for the backup age will not fire.

Note: Since version 7.2.0, you can also connect to the MSSQL instance using its name. To do this, set the connection string in the {$MSSQL.URI} macro as <protocol://host/instance_name>.

Generated by official Zabbix template tool "Templator"