Ad Widget

Collapse

installation and configuration of MSSQL by ODBC docker

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Eric25
    Junior Member
    • Nov 2020
    • 16

    #1

    installation and configuration of MSSQL by ODBC docker

    Hi.
    I have zabbix server installed in the docker. I wanted to monitor the MS SQL server on a host with an agent installed.
    At the very beginning I added the required MSSQL by ODBC template, but the next step is to install the Microsoft ODBC driver on the server (in my case, the container) zabbix. I am using this guide: https://www.zabbix.com/integrations/microsoft_sql
    The question is whether it is possible to install a new program in an existing container? how can I do this? I tried to enter the container with the docker exec -it [container-id] bash command and manually install the driver there, but using sudo command there returns an error.
  • julio@dobkovski.com
    Junior Member
    • Nov 2020
    • 2

    #2
    Hey Eric!

    I am also struggling to resolve this doubt. Unfortunately the Zabbix documentation is not so clear in this case, perhaps this are not ready to receive this monitoring if Zabbix Proxy is a Docker.

    I'll try to fix this situation and I'll let you know if I resolve

    Comment

    • julio@dobkovski.com
      Junior Member
      • Nov 2020
      • 2

      #3
      Hey Eric!

      Proxy Docker still doesn't really support connecting natively.

      But you can access the Proxy / Server container and install the ODBC driver inside the Container (or make a dockerfile for that)

      Here is what I did:

      Enter the container as root:

      Code:
      docker exec -it -u root container-name /bin/bash
      Then:

      Code:
      apt update
      Code:
      apt install gpg curl
      Code:
      curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
      Code:
      curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
      Code:
      apt update
      Code:
      ACCEPT_EULA=Y apt-get install msodbcsql17
      Code:
      ACCEPT_EULA=Y apt-get install mssql-tools
      Code:
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
      Code:
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
      Code:
      source ~/.bashrc
      then I edited the /etc/odbc.ini as:

      [DSNNAME]
      Driver = ODBC Driver 17 for SQL Server
      Server= SERVERNAME
      Port = 1433
      User = user

      And tested the connection with the:
      Code:
      isql DSNNAME user password
      This shall be the result:

      Click image for larger version  Name:	sql_odbc.png Views:	0 Size:	4.1 KB ID:	413840

      Then go back to Host in the Zabbix conf and set the macro parameters:

      Click image for larger version  Name:	sql_odbc2.png Views:	0 Size:	13.0 KB ID:	413841

      Hope this helps for a while
      Last edited by [email protected]; 25-11-2020, 05:04.

      Comment

      • mmalex
        Junior Member
        • Aug 2021
        • 4

        #4
        Thank you Julio very much for your answer ,it worked for me

        Comment

        • PiotrJ
          Junior Member
          • May 2023
          • 26

          #5
          Hi​
          I need help with the install odbc on docker compose.
          I actually instaled odbc on the first container(screenshot) but in frontend i get error.
          Should I instal odbc i second conrtainer or what please help.
          Attached Files

          Comment

          Working...