Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multi instance sql server #30859

Merged
merged 8 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only.
- Errors should be thrown as errors. Metricsets inside Metricbeat will now throw errors as the `error` log level. {pull}27804[27804]
- Avoid panicking in `add_fields` processor when input event.Fields is a nil map. {pull}28219[28219]
- Drop event batch when get HTTP status 413 from Elasticsearch to avoid infinite loop {issue}14350[14350] {pull}29368[29368]
- Allow to use metricbeat for named mssql instances. {issue}24076[24076] {pull}30859[30859]

==== Added

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...main[Check the HEAD dif
- Fixed missing ZooKeeper metrics due compatibility issues with versions >= 3.6.0 {pull}30068[30068]
- Fix Docker module: rename fields on dashboards. {pull}30500[30500]
- Add back missing metrics to system/linux. {pull}30774[30774]
- Allow named instances in mssql module. {issue}24076[24076] {pull}30859[30859]
cwuethrich marked this conversation as resolved.
Show resolved Hide resolved
- GCP metrics query instances with aggregatedList API to improve efficiency. {pull}30154[#30153]
- Fix delay in perfmon counters collection {issue}30686[30686] {pull}30861[#30861]
- Fix Jolokia module to print URI for one of the debug logs. {pull}30943[#30943]
Expand Down
53 changes: 21 additions & 32 deletions x-pack/metricbeat/module/mssql/performance/performance.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,40 +69,29 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) {
var err error
var rows *sql.Rows
rows, err = m.db.Query(`SELECT object_name,
counter_name,
instance_name,
cntr_value
counter_name,
instance_name,
cntr_value
FROM sys.dm_os_performance_counters
WHERE counter_name = 'SQL Compilations/sec'
OR counter_name = 'SQL Re-Compilations/sec'
OR counter_name = 'User Connections'
OR counter_name = 'Page splits/sec'
OR ( counter_name = 'Lock Waits/sec'
AND instance_name = '_Total' )
OR counter_name = 'Page splits/sec'
OR ( object_name = 'SQLServer:Buffer Manager'
AND counter_name = 'Page life expectancy' )
OR counter_name = 'Batch Requests/sec'
OR ( counter_name = 'Buffer cache hit ratio'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Target pages'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Database pages'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Checkpoint pages/sec'
AND object_name = 'SQLServer:Buffer Manager' )
OR ( counter_name = 'Lock Waits/sec'
AND instance_name = '_Total' )
OR ( counter_name = 'Transactions'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Logins/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Logouts/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Connection Reset/sec'
AND object_name = 'SQLServer:General Statistics' )
OR ( counter_name = 'Active Temp Tables'
AND object_name = 'SQLServer:General Statistics' )`)
OR counter_name = 'SQL Re-Compilations/sec'
OR counter_name = 'User Connections'
OR counter_name = 'Page splits/sec'
OR counter_name = 'Page splits/sec'
OR counter_name = 'Batch Requests/sec'
OR ( counter_name = 'Lock Waits/sec'
AND instance_name = '_Total' )
OR ( counter_name IN ( 'Page life expectancy',
cwuethrich marked this conversation as resolved.
Show resolved Hide resolved
'Buffer cache hit ratio',
'Target pages', 'Database pages',
'Checkpoint pages/sec' )
AND object_name LIKE '%:Buffer Manager%' )
OR ( counter_name IN ( 'Transactions',
'Logins/sec',
'Logouts/sec',
'Connection Reset/sec',
'Active Temp Tables' )
AND object_name LIKE '%:General Statistics%' )`)
if err != nil {
reporter.Error(errors.Wrapf(err, "error closing rows"))
return
Expand Down