# Modified zabbix proxy with MSSQL support [![Build Status](https://drone.asperti.com/api/badges/paspo/docker-zabbix-proxy-mssql/status.svg)](https://drone.asperti.com/paspo/docker-zabbix-proxy-mssql) ## Available tags Because of unavailability of the Microsoft ODBC driver for other architectures, only `amd64` is supported. We can easily expand that in the future. These are the supported upstream flavours: | flavour | image to use | |---------|-------------------------------------------------------| | sqlite3 | `docker.asperti.com/paspo/zabbix-proxy-sqlite3-mssql` | | mysql | `docker.asperti.com/paspo/zabbix-proxy-mysql-mssql` | These are the supported upstream versions: | version | |---------| | 6.4 | | 6.2 | | 6.0 | | 5.0 | | 4.0 | You can use the desired version as image tag (e.g. `docker.asperti.com/paspo/zabbix-proxy-sqlite3-mssql:5.0`), the correct arch will be used. If you prefer, you can also pin to a specific architecture: `docker.asperti.com/paspo/zabbix-proxy-sqlite3-mssql:5.0-amd64`. ## Usage with docker compose ```yaml version: '3.9' services: zabbix-proxy: image: docker.asperti.com/paspo/zabbix-proxy-mysql-mssql:6.0 restart: always ports: - '10051:10051' volumes: - ./zabbix-proxy.psk:/var/lib/zabbix/enc/zabbix-proxy.psk:ro - ./odbc.ini:/etc/odbc.ini:ro environment: ZBX_DATASENDERFREQUENCY: 20 ZBX_CONFIGFREQUENCY: 300 ZBX_STARTDISCOVERERS: 3 ZBX_TLSACCEPT: psk ZBX_TLSCONNECT: psk ZBX_TLSPSKFILE: zabbix-proxy.psk ZBX_TLSPSKIDENTITY: "PSK identity" ZBX_SERVER_HOST: zabbix.server.com:12345 ZBX_HOSTNAME: px_73271_example ``` ## Create the PSK file ```sh openssl rand -hex 32 | tee /zabbix-proxy.psk ``` ## Create the odbc.ini ```ini [server_dsn_123] Driver = ODBC Driver 17 for SQL Server DSN = MSSQL17 Server = tcp:192.168.12.34 Port = 1433 ``` ## Configuration in zabbix First, apply the `MSSQL by ODBC` template to an host. You can find it [here](https://www.zabbix.com/integrations/mssql). Then configure the following macros: | Macro | Value | |-------------------|--------------------------------------------------------------------------------------| | {$MSSQL.DSN} | This refers to the `odbc.ini` file. `server_dsn_123` in this example. | | {$MSSQL.INSTANCE} | If needed, you can put here the name of the instance, in the format `MSSQL$instance` | | {$MSSQL.USER} | No need to explain. | | {$MSSQL.PASSWORD} | Also, no need to explain. | ## Monitoring user It's always better to use a dedicated user for monitoring. Please don't use `sa`. ```sql USE [master]; CREATE LOGIN zbx_monitor WITH PASSWORD=N'superSecurePassword', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF GRANT VIEW SERVER STATE TO zbx_monitor; GRANT VIEW ANY DEFINITION TO zbx_monitor; USE msdb; CREATE USER zbx_monitor FOR LOGIN zbx_monitor; GRANT SELECT ON OBJECT::msdb.dbo.sysjobs TO zbx_monitor; GRANT SELECT ON OBJECT::msdb.dbo.sysjobservers TO zbx_monitor; GRANT SELECT ON OBJECT::msdb.dbo.sysjobactivity TO zbx_monitor; GRANT EXECUTE ON OBJECT::msdb.dbo.agent_datetime TO zbx_monitor; ```