Ad Widget

Collapse

MSSQL: Service is unavailable

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DaLoZ
    Junior Member
    • Aug 2022
    • 25

    #1

    MSSQL: Service is unavailable

    I'm whipping up a demo of Zabbix in our environment and have some trouble monitoring a SQL server.

    The error: 'MSSQL: Service is unavailable' > 'The TCP port of the MS SQL Server service is currently unavailable.'

    Things we need to monitor:
    • SVRDBS118 (database server itself) => Works fine with the Zabbix agent
    • SVRDBS118\TST01 (database instance)
    • SVRDBS118\TST02 (database instance)

    I have applied the 'MSSQL by ODBC' template to the server and set the following macro's:
    {$MSSQL.DSN} svrdbs118
    {$MSSQL.INSTANCE} MSSQL$TST01
    {$MSSQL.PORT} 57003


    In the template itself I have changed
    • {$MSSQL.PASSWORD}
    • {$MSSQL.USER}

    On the Zabbix server I installed the ODBC driver and configured the .ini-files as follows:

    /ect/odbcinst.ini
    [ODBC Driver 18 for SQL Server]
    Description=Microsoft ODBC Driver 18 for SQL Server
    Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1
    UsageCount=1


    /etc/odbc.ini
    [svrdbs118]
    Driver = ODBC Driver 18 for SQL Server
    Server = SVRDBS118\TST01


    The SQL server does not listen on TCP/1433 but on dedicated ports per instance and named pipes for the instances are enabled.

    NMAP confirms the port 1433 is closed but the dedicated ports are open & sqlcmd confirms the credentials work.

    The nature of the error has me thinking Zabbix keeps trying to connect on TCP/1433...

    Any help getting me past this error and suggestions on how to monitor multiple instances are greatly appreciated
  • Answer selected by DaLoZ at 04-08-2022, 13:23.
    DaLoZ
    Junior Member
    • Aug 2022
    • 25

    I disabled SELinux and it started working...

    Code:
    sudo setenforce 0

    Comment

    • DaLoZ
      Junior Member
      • Aug 2022
      • 25

      #2
      Strange thing is I can connect with the command below:

      Code:
      sqlcmd -S tcp:<servername>,<dynamic port> -U <SQL username> -P <SQL user password>
      but not

      Code:
      sqlcmd -D -S example
      with

      Code:
      [example]
      Driver = ODBC Driver 17 for SQL Server
      Server = <servername>
      Port = <dynamic port>
      User = <SQL username>
      Password = <SQL user password>
      Last edited by DaLoZ; 03-08-2022, 15:21.

      Comment

      • vladimir_lv
        Senior Member
        • May 2022
        • 240

        #3
        Check if the DSN registered:

        Code:
        # odbcinst -q -s

        Comment


        • DaLoZ
          DaLoZ commented
          Editing a comment
          DSN is registered.

          Code:
          [user@server ~]$ odbcinst -q -s
          [example]
      • vladimir_lv
        Senior Member
        • May 2022
        • 240

        #4
        I don't know if this helps you, but here is written that some problems were solved by reverting to ODBC driver version 17.

        Comment


        • DaLoZ
          DaLoZ commented
          Editing a comment
          Thanks I did get the DSN working changing the server like so:

          Code:
          [svrdbs118]
          Driver = ODBC Driver 17 for SQL Server 
          Server = tcp:svrdbs118,57003
          However, Zabbix still thinks the port is closed... "MSSQL: Service's TCP port state" => Down (0) which is very odd since when I run the command below it returns 1 => Open

          Code:
          [user@server ~]$ zabbix_get -s svrdbs118 -k net.tcp.service[tcp,svrdbs118,57003]
          1
          Last edited by DaLoZ; 03-08-2022, 17:00.
      • vladimir_lv
        Senior Member
        • May 2022
        • 240

        #5
        Check connection under zabbix user

        Code:
        su - zabbix -c 'isql -vvv example <user> <password>' -s '/bin/bash'
        is it works?

        Comment

        • DaLoZ
          Junior Member
          • Aug 2022
          • 25

          #6
          The command works

          Click image for larger version

Name:	image.png
Views:	4179
Size:	12.6 KB
ID:	449261

          Comment

          • DaLoZ
            Junior Member
            • Aug 2022
            • 25

            #7
            I disabled SELinux and it started working...

            Code:
            sudo setenforce 0

            Comment

            Working...