add sqlserver input plugin
This commit is contained in:
27
plugins/inputs/sqlserver/README.md
Normal file
27
plugins/inputs/sqlserver/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# SQL Server plugin
|
||||
|
||||
This sqlserver plugin provides metrics for your SQL Server instance.
|
||||
It currently works with SQL Server versions 2008+.
|
||||
Recorded metrics are lightweight and use Dynamic Management Views supplied by SQL Server:
|
||||
```
|
||||
Performance counters : 1000+ metrics from sys.dm_os_performance_counters
|
||||
Performance metrics : some special performance metrics
|
||||
Wait stats : list of wait tasks categorized from sys.dm_os_wait_stats
|
||||
Memory clerk : memory breakdown from sys.dm_os_memory_clerks
|
||||
Database size : database size trend, data and log file from sys.dm_io_virtual_file_stats
|
||||
Database IO : database I/O from sys.dm_io_virtual_file_stats
|
||||
Database latency : database reads and writes latency from sys.dm_io_virtual_file_stats
|
||||
CPU : cpu usage from sys.dm_os_ring_buffers
|
||||
```
|
||||
|
||||
You must create a login on every instance you want to monitor, with following script:
|
||||
```SQL
|
||||
USE master;
|
||||
GO
|
||||
CREATE LOGIN [telegraf] WITH PASSWORD = N'mystrongpassword';
|
||||
GO
|
||||
GRANT VIEW SERVER STATE TO [telegraf];
|
||||
GO
|
||||
GRANT VIEW ANY DEFINITION TO [telegraf];
|
||||
GO
|
||||
```
|
||||
1150
plugins/inputs/sqlserver/sqlserver.go
Normal file
1150
plugins/inputs/sqlserver/sqlserver.go
Normal file
File diff suppressed because it is too large
Load Diff
22
plugins/inputs/sqlserver/sqlserver_test.go
Normal file
22
plugins/inputs/sqlserver/sqlserver_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package sqlserver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/influxdb/telegraf/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSqlServerGeneratesMetrics(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
|
||||
s := &SqlServer{}
|
||||
s.Servers = append(s.Servers, &Server{ConnectionString: "Server=192.168.1.30;User Id=linuxuser;Password=linuxuser;app name=telegraf;log=1;"})
|
||||
|
||||
var acc testutil.Accumulator
|
||||
|
||||
err := s.Gather(&acc)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user