Sei sulla pagina 1di 9

Customizing End-to-End SQL Server Monitoring

in Solution Manger 7.1


Applies to:
Solution Manger 7.1 SPS 10 and higher

Summary
This document describes the current capabilities to monitor a Microsoft SQL Server database within a
Solution Manager 7.1 system and shows examples of how to modify the standard delivered SAP template to
create alerts on other metrics associated with a SQL Server database.

Author:
Dale Adams

Company:
SAP SE

Created on: 15 January 2015

Author Bio
Dale Adams is a Senior Developer at SAP SE, and has been working since 1998 at the Microsoft Platforms
team. He is based in Redmond Washington USA.

Table of Contents
Overview ............................................................................................................................................................. 3
Default SQL Server Monitor ............................................................................................................................ 3
Customizing or Removing Portions of the Delivered Monitor ......................................................................... 5
Creating New Metrics ...................................................................................................................................... 5
Customized Use of a Single Message from SAP SQL Setup ...................................................................................... 5
Customized use of ABAP function MSS_COLL_LIST .................................................................................................. 6
Customized Use of Output From a Stored Procedure .................................................................................................. 7

Related Content .................................................................................................................................................. 8


Copyright............................................................................................................................................................. 9

Overview
This document describes the current capabilities to monitor a Microsoft SQL Server database within a
Solution Manager 7.1 system and shows examples of how to modify the standard delivered SAP template to
create alerts on other metrics associated with a SQL Server database.

Default SQL Server Monitor


The standard, SAP-delivered monitor is shown in the figure below:

1. Database Configuration ->SQL Setup Check Messages


A separate message is presented for each check that reports a yellow or red status. For an
explanation of properties available, see SAP Note 1609057.
For information on creating a metric to check only one of the properties, see section Creating New
Metrics, item Customized Use of a Single Message from SAP SQL Setup in this document. Creating
a metric to check only one property allows the creation of an automatic notification.
2. Database Availability is checked by the monitoring infrastructure and is not SQL Server-specific. This
metric, and all the monitoring metrics described in this document require the definition of a valid and
usable DBCON to the system to be monitored.
3. Database Exceptions contains two metrics.
The first is the MS SQL Backup -> Days since last backup for the msdb and the main SAP database.
For more information on backup strategies, see SAP Note 44449. The second metric is a check of
the MS SQL Error Log. If an error of severity 20 or higher is present in the error log, or has occurred
in the last 24 hours, a red message is displayed.
4. Database Performance contains the following metrics related to file management: Autogrowth
Status, Free Disk Space, Free Space in File and Percent of Transaction Log Used. For more
information on file management in SQL Server, see SAP Note 1238993.
Section Customizing or Removing Portions of the Delivered Monitor of this document provides
information on how to eliminate some of the files that are presented in these metrics.
5. Database Performance also contains metrics for Buffer Cache Hit Ratio and Page Life Expectancy.
These metrics are an example of the technique presented in section Creating New Metrics, item
Customized Use of ABAP function MSS_COLL_LIST B.

6. Database Performance also contains metrics for the performance on the storage system as
measured through SQL Server. For more information, see SAP Note 987961.

For more information on the latest changes and the required fixes for the SQL Server monitor, see SAP Note
2006729.

Customizing or Removing Portions of the Delivered Monitor


Some customers have requested that some of the files be eliminated from the display of the file management
metrics. This is possible using regular expressions if the naming of the files that make up the database
follows a standard pattern. Any metric with metric type PATH= can be modified to eliminate the display of files
that do not use a regular expression. A couple of examples of this technique follow.
If data on tempdb is not required, the regular expression PATH=*$DBMS_ID$* can be used. If data on the
LOG files and tempdb files are not desired, the regular expression PATH=*$DBMS_ID$DATA* can be used.
Any regular expression pattern can be used that matches the file names for which monitoring is required.
If metrics are eliminated, you have to apply SAP Note 2089683.

Creating New Metrics


There are three prerequisites for using the methods discussed below. The first is that you apply SAP Note
2054273. The second is that when defining the data collector settings for the metric, you make sure that the
collector named MSS Database Alerts Generic is used. The third prerequisite is to make sure the PATH
parameter is set to the appropriate value as discussed in each section below.

Customized Use of a Single Message from SAP SQL Setup


Under the Database Configuration area is a metric for SQL Server setup messages. This metric checks all
the conditions in the MSSPROCS item sap_mon_sqlsetup. Currently there are approximately 60
conditions checked. Any yellow or red condition results in a message being presented.
There have been nine checks in sap_mon_sqlsetup that have been identified as metrics that might be
useful to have standalone, on their own, as separate checks. This would allow automatic emailing or
notification to occur for these conditions as individual items.
These nine checks are:
Flag
1
2
3
4
5
6
7
8
9

Condition to Check
Locked pages in memory
Trace flag status
SQL Agent running
Read committed snapshots
Snapshot isolation state
SAP SQL Agent job steps failures
Last SAP CCMS Check Database appears to be clean
Auto create statistics, update statistics
SQL Server Memory optimized table exists

To create a metric checking only one of these conditions, copy the standard template and define a new
metric with the following input values used. Most of the following settings are used for the metric Buffer
Cache Hit Ratio so that metric can be copied as a baseline. Most parameters are copied also, except
MSS_CNTR_NAME and MSS_OBJ_NAME. The PATH parameter is left blank and an = is used in the
parameter value column.

Data Collector Setting


Data Collector Type
Data Collector Name
Collection Interval

Value
RFC (pull)
MSS Database Alerts Generic
Once a day or whatever

Parameter Name
MSS_OBJ_NAME
MSS_CNTR_NAME
PATH
RDI_DDIC_FIELD
RDI_DDIC_STRUCTURE
RDI_TIME_RANGE
DBCNAME
DBMC_ID

Value
sap_mon_sqlsetup
Number 1-9 from table above
=
NONE
NONE
CURRENT
$DBCNAME$
$DBMS_ID$

As an example, if your requirement is to have an alert whenever a job step failed for a job name SAP_*, you
need to create a new metric as shown above with the MSS_CNTR_NAME set to sap_mon_sqlsetup and
the MSS_OBJ_NAME set to 6. Then you can configure an email or other notification for that single alert.
The most recent version of the MSSPROCS item sap_mon_sqlsetup is required for this type of custom
metric to work. This version is in 702 Basis Support Package 17.

Customized Use of ABAP function MSS_COLL_LIST


Another way to create a customer metric can be seen by again copying the Buffer Cache Hit Ratio. But now
instead of setting the MSS_CNTR_NAME, MSS_OBJ_NAME to sap_mon_sqlsetup and an integer 1-9,
any valid MSS_CNTR_NAME, MSS_OBJ_NAME and MSS_INST_NAME can be used. The valid values for
these 3 parameters can be seen by running the transaction se37 and testing the function MSS_COLL_LIST,
and viewing columns OBJ_NAME, CNTR_NAME, and INST_NAME. The other parameters must remain the
same. This function returns all the metrics that are collected by the SAP SQL Agent job sap_dbcoll. For
most metrics, MSS_VAL_SLOPE should be set to SLOPE, which means report the value observed during
the last measurement period, as opposed to VAL, which is be the value since startup of the SQL Server.
MSS_CNTR_NAME, MSS_OBJ_NAME, and MSS_INST_NAME must appear exactly as seen in the function
output, including spaces and case. The PATH parameter must be set to the entered MSS_OBJ_NAME and
MSS_CNTR_NAME values separated by a | ( vertical bar).
The example below is for a metric that is excellent for monitoring the performance of an AlwaysOn
environment.
Parameter Name
MSS_OB J_NAME
MSS_CNTR_NAME
MSS_INST_NAME
MSS_VAL_SLOPE
PATH
RDI_DDIC_FIELD
RDI_DDIC_STRUCTURE
RDI_TIME_RANGE
DBCNAME
DBMC_ID

Value
I/O counters (Overview)
HADR_SYNC_COMMIT [ms] / request
SLOPE
I/O counters (Overview)| HADR_SYNC_COMMIT [ms] / request
NONE
NONE
CURRENT
$DBCNAME$
$DBMS_ID$

Other metrics to consider are:


MSS_OBJ_NAME
I/O counters (Overview)
I/O counters (Overview)
sp_monitor

MSS_CNTR_NAME
CXPACKET [ms] / request
WRITELOG [ms] / request
@@CPU_BUSY

Purpose
Monitor parallelism
Monitor performance of transaction log
Monitor cpu utilization. Note that this metric is
based on sys.dm_os_sys_info data, not
@@cpu_busy

Customized Use of Output from a Stored Procedure


The final method of creating a custom metric is to create a stored procedure with the name sap_*, which
returns the data of interest in the structure specified below. That is, the name of the stored procedure follows
the pattern where the first 4 characters are sap_, and returns a table with the following definition.

declare @returndata table


(
item
nvarchar(10), -- block or trx
seconds int,
descr
nvarchar(100)
)

An example of an MSSPROCS item that follows these constraints is sap_rz20_opentrx, originally


developed for the RZ20 transaction. This procedure returns two rows. The first row has the item field equal to
block and the seconds field equal to the number of seconds that the longest blocked spid has been
blocked. If there is no blocked spid, 0 is in the seconds field and No blocking is returned in the descr field.
The second row shows the number of seconds that the longest running transaction has been opened. This
metric can be used to monitor applications for missing commit or rollback commands. For the second row,
the item field equals trx. The PATH parameter must be set to the entered MSS_OBJ_NAME and
MSS_CNTR_NAME values separated by a | ( vertical bar).Therefore, to get an alert on blocking, you can
create a metric based on the following table. Then you can set the thresholds in the template for whatever
values are deemed appropriate.
Parameter Name
MSS_OBJ_NAME
MSS_CNTR_NAME
PATH
RDI_DDIC_FIELD
RDI_DDIC_STRUCTURE
RDI_TIME_RANGE
DBCNAME
DBMC_ID

Value
sap_rz20_opentrx
block
sap_rz20_opentrx|block
NONE
NONE
CURRENT
$DBCNAME$
$DBMS_ID$

Related Content
SAP Note 1609057 - Server Setup Check Overview and Explanation
SAP Note 44449 - Backup strategies with the SQL server
SAP Note 1238993 - Data File Management for SQL Server
SAP Note 987961 - FAQ: SQL Server I/O performance
SAP Note 2006729 - E2E alerting for SQL Server
SAP Note 2089683 - Can't change standard SQL Server template to exclude file
SAP Note 2054273 Required changes to class CL_MSS_ALERTING_EXTRACTOR to process BTCH
providers or single setup messages from the SQL Server template

Copyright
2015 SAP SE SE or an SAP SE affiliate company. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the
express permission of SAP SE.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP SE and its distributors contain proprietary software components
of other software vendors. National product specifications may vary.
These materials are provided by SAP SE and its affiliated companies (SAP SE Group) for informational
purposes only, without representation or warranty of any kind, and SAP SE Group shall not be liable for
errors or omissions with respect to the materials. The only warranties for SAP SE Group products and
services are those that are set forth in the express warranty statements accompanying such products and
services, if any. Nothing herein should be construed as constituting an additional warranty.
SAP SE and other SAP SE products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP SE in Germany and other countries.
Please see
http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark
for additional trademark information and notices.

Potrebbero piacerti anche