influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.67k stars 5.59k forks source link

sqlserver "panic: Not implemented" #9266

Closed biohazardxxx closed 3 years ago

biohazardxxx commented 3 years ago

Relevant telegraf.conf:

[[inputs.sqlserver]]
  ## Specify instances to monitor with a list of connection strings.
  ## All connection parameters are optional.
  ## By default, the host is localhost, listening on default port, TCP 1433.
  ##   for Windows, the user is the currently running AD user (SSO).
  ##   See https://github.com/denisenkom/go-mssqldb for detailed connection
  ##   parameters.
  servers = [
    "Server=xxxxx.database.windows.net;Port=1433;User Id=telegraf;Password=xxxx;app name=telegraf;log=1;",      
   ]

  ## This enables a specific set of queries depending on the database type. If specified, it replaces azuredb = true/false and query_version = 2
  ## In the config file, the sql server plugin section should be repeated  each with a set of servers for a specific database_type.
  ## Possible values for database_type are  
  ## "AzureSQLDB" 
  ## "SQLServer"
  ## "AzureSQLManagedInstance"
  database_type = "AzureSQLManagedInstance"

  ## Optional parameter, setting this to 2 will use a new version
  ## of the collection queries that break compatibility with the original
  ## dashboards.
  ## query_version = 2

  ## If you are using AzureDB, setting this to true will gather resource utilization metrics
  ## azuredb = true

  ## If you would like to exclude some of the metrics queries, list them here
  ## Possible choices:
  ## - PerformanceCounters
  ## - WaitStatsCategorized
  ## - DatabaseIO
  ## - DatabaseProperties
  ## - CPUHistory
  ## - DatabaseSize
  ## - DatabaseStats
  ## - MemoryClerk
  ## - VolumeSpace
  # exclude_query = [ 'DatabaseIO' ]

System info:

Actual behavior:

D:\telegraf>D:\telegraf\telegraf.exe --console --config D:\
telegraf\telegrafSQL.conf 
2021-05-12T11:40:24Z I! Starting Telegraf 1.18.2
panic: Not implemented

goroutine 59 [running]:
github.com/denisenkom/go-mssqldb.timeoutConn.SetWriteDeadline(...)
        /go/pkg/mod/github.com/denisenkom/go-mssqldb@v0.0.0-20190707035753-2be1a
a521ff4/net.go:102
crypto/tls.(*Conn).SetWriteDeadline(...)
        /usr/local/go/src/crypto/tls/conn.go:150
crypto/tls.(*Conn).closeNotify(0xc00010f880, 0x0, 0x0)
        /usr/local/go/src/crypto/tls/conn.go:1360 +0x10d
crypto/tls.(*Conn).Close(0xc00010f880, 0x0, 0x0)
        /usr/local/go/src/crypto/tls/conn.go:1330 +0xe5
github.com/denisenkom/go-mssqldb.(*Conn).Close(0xc000314cc0, 0x0, 0x0)
        /go/pkg/mod/github.com/denisenkom/go-mssqldb@v0.0.0-20190707035753-2be1a
a521ff4/mssql.go:359 +0x42
database/sql.(*driverConn).finalClose.func2()
        /usr/local/go/src/database/sql/sql.go:592 +0x50
database/sql.withLock(0x409ee50, 0xc000188870, 0xc0009e5c80)
        /usr/local/go/src/database/sql/sql.go:3294 +0x70
database/sql.(*driverConn).finalClose(0xc000188870, 0xc000188890, 0x3b68a38)
        /usr/local/go/src/database/sql/sql.go:590 +0x145
database/sql.(*DB).Close(0xc0001132b0, 0x0, 0x0)
        /usr/local/go/src/database/sql/sql.go:847 +0x288
github.com/influxdata/telegraf/plugins/inputs/sqlserver.(*SQLServer).gatherServe
r(0xc000258180, 0xc00027a631, 0x85, 0x398c53b, 0x14, 0x3ae7c73, 0x3e7, 0x0, 0xc0
004e5540, 0x13, ...)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/sqlserver/sqlserve
r.go:268 +0x3e5
github.com/influxdata/telegraf/plugins/inputs/sqlserver.(*SQLServer).Gather.func
1(0xc0005e8030, 0x40fa718, 0xc0002e4a60, 0xc000258180, 0xc00027a631, 0x85, 0x398
c53b, 0x14, 0x3ae7c73, 0x3e7, ...)
        /go/src/github.com/influxdata/telegraf/plugins/inputs/sqlserver/sqlserve
r.go:231 +0xe5
created by github.com/influxdata/telegraf/plugins/inputs/sqlserver.(*SQLServer).
Gather
        /go/src/github.com/influxdata/telegraf/plugins/inputs/sqlserver/sqlserve
r.go:229 +0x186

Additional info:

It works ok with telegraf-1.16.1_windows_amd64

Same error with the new type of config as described on current README

  database_type = "AzureSQLManagedInstance"

  include_query = []
  exclude_query = ["SQLServerAvailabilityReplicaStates", "SQLServerDatabaseReplicaStates"]
  azuredb = true
jjh74 commented 3 years ago

Recent go-mssqldb(v0.10.0) might have a fix for this(https://github.com/denisenkom/go-mssqldb/pull/642)

ghost commented 3 years ago

This issue is reproduced at the SQL server with a self-signed certificate. As jjh75 mentions this issue could be fixed with an update to go-mssqldb(v0.10.0), it there any chances to have this fix in the next release?

Purneau commented 3 years ago

I can confirm this issue is also present on linux and also solved for linux in the nightly build.