App Manager For Microsoft SQ L Server

Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

NetIQ® AppManager® for Microsoft

SQL Server
Management Guide
March 2020
Legal Notice
For information about NetIQ legal notices, disclaimers, warranties, export and other use restrictions, U.S. Government
restricted rights, patent policy, and FIPS compliance, see https://www.netiq.com/company/legal/.

© 2020 NetIQ Corporation. All Rights Reserved.

For information about NetIQ trademarks, see https://www.netiq.com/company/legal/. All third-party trademarks are the
property of their respective owners.
Contents

About this Book and the Library 5


About NetIQ Corporation 7

1 Introducing AppManager for Microsoft SQL Server 9

2 Installing AppManager for Microsoft SQL Server 11


2.1 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2 Installing the Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Deploying the Module with Control Center. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 Silently Installing the Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.5 Discovering SQL Server Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.6 Discovering AlwaysOn Availability Group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.7 Configuring SQL Server User in Security Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.8 Upgrading Knowledge Script Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3 SQL Server Knowledge Scripts 27


3.1 Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2 AvailabilityGroupHealth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.3 AvailabilityGroupOwner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.4 BackupJob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.5 BlockedProcesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.6 CacheHitRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.7 Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.8 CPUUtil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.9 DataSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.10 DBLocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.11 DBMirrorStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.12 DBStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.13 ErrorLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.14 LogShipping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.15 LogSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.16 MemUtil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.17 MonitorJobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
3.18 NearMaxConnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.19 NearMaxLocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.20 RunSql . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.21 ServerDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.22 SQLClusterOwner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3.23 TopResourceUsers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.24 UserConnections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.25 Recommended Knowledge Script Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

4 Troubleshooting AppManager for Microsoft SQL Server 83


4.1 Enabling dynamic logging for a Knowledge Script job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Contents 3
4.2 Determining the non-default port for SQL Server or Availability Group Listener . . . . . . . . . . . . . . . . 84

4
About this Book and the Library

The NetIQ AppManager product (AppManager) is a comprehensive solution for managing,


diagnosing, and analyzing performance, availability, and health for a broad spectrum of operating
environments, applications, services, and server hardware.

AppManager provides system administrators with a central, easy-to-use console to view critical
server and application resources across the enterprise. With AppManager, administrative staff can
monitor computer and application resources, check for potential problems, initiate responsive actions,
automate routine tasks, and gather performance data for real-time and historical reporting and
analysis.

Intended Audience
This guide provides information for individuals responsible for installing an AppManager module and
monitoring specific applications with AppManager.

Other Information in the Library


The library provides the following information resources:

Installation Guide for AppManager


Provides complete information about AppManager pre-installation requirements and step-by-
step installation procedures for all AppManager components.

User Guide for AppManager Control Center


Provides complete information about managing groups of computers, including running jobs,
responding to events, creating reports, and working with Control Center. A separate guide is
available for the AppManager Operator Console.

Administrator Guide for AppManager


Provides information about maintaining an AppManager management site, managing security,
using scripts to handle AppManager tasks, and leveraging advanced configuration options.

Upgrade and Migration Guide for AppManager


Provides complete information about how to upgrade from a previous version of AppManager.

Management guides
Provide information about installing and monitoring specific applications with AppManager.

Help
Provides context-sensitive information and step-by-step guidance for common tasks, as well as
definitions for each field on each window.

The AppManager library is available in Adobe Acrobat (PDF) format from the AppManager
Documentation page of the NetIQ website.

About this Book and the Library 5


6 About this Book and the Library
About NetIQ Corporation

We are a global, enterprise software company, with a focus on the three persistent challenges in your
environment: Change, complexity and risk—and how we can help you control them.

Our Viewpoint
Adapting to change and managing complexity and risk are nothing new
In fact, of all the challenges you face, these are perhaps the most prominent variables that deny
you the control you need to securely measure, monitor, and manage your physical, virtual, and
cloud computing environments.

Enabling critical business services, better and faster


We believe that providing as much control as possible to IT organizations is the only way to
enable timelier and cost effective delivery of services. Persistent pressures like change and
complexity will only continue to increase as organizations continue to change and the
technologies needed to manage them become inherently more complex.

Our Philosophy
Selling intelligent solutions, not just software
In order to provide reliable control, we first make sure we understand the real-world scenarios in
which IT organizations like yours operate — day in and day out. That's the only way we can
develop practical, intelligent IT solutions that successfully yield proven, measurable results. And
that's so much more rewarding than simply selling software.

Driving your success is our passion


We place your success at the heart of how we do business. From product inception to
deployment, we understand that you need IT solutions that work well and integrate seamlessly
with your existing investments; you need ongoing support and training post-deployment; and you
need someone that is truly easy to work with — for a change. Ultimately, when you succeed, we
all succeed.

Our Solutions
 Identity & Access Governance
 Access Management
 Security Management
 Systems & Application Management
 Workload Management
 Service Management

About NetIQ Corporation 7


Contacting Sales Support
For questions about products, pricing, and capabilities, contact your local partner. If you cannot
contact your partner, contact our Sales Support team.

Worldwide: www.netiq.com/about_netiq/officelocations.asp

United States and Canada: 1-888-323-6768

Email: info@netiq.com

Web Site: www.netiq.com

Contacting Technical Support


For specific product issues, contact our Technical Support team.

Worldwide: www.netiq.com/support/contactinfo.asp

North and South America: 1-713-418-5555

Europe, Middle East, and Africa: +353 (0) 91-782 677

Email: support@netiq.com

Web Site: www.netiq.com/support

Contacting Documentation Support


Our goal is to provide documentation that meets your needs. The documentation for this product is
available on the NetIQ web site in HTML and PDF formats on a page that does not require you to log
in. If you have suggestions for documentation improvements, click comment on this topic at the
bottom of any page in the HTML version of the documentation posted at www.netiq.com/
documentation. You can also email Documentation-Feedback@netiq.com. We value your input and
look forward to hearing from you.

Contacting the Online User Community


NetIQ Communities, the NetIQ online community, is a collaborative network connecting you to your
peers and NetIQ experts. By providing more immediate information, useful links to helpful resources,
and access to NetIQ experts, NetIQ Communities helps ensure you are mastering the knowledge you
need to realize the full potential of IT investments upon which you rely. For more information, visit
http://community.netiq.com.

8 About NetIQ Corporation


1 Introducing AppManager for Microsoft
1

SQL Server

AppManager for Microsoft SQL Server provides a comprehensive solution for monitoring the
performance and availability of your SQL Server environment.

With AppManager for Microsoft SQL Server, you can:

 Quickly identify fault lines or factors that might adversely impact performance and take
preventive action
 Plan and schedule timely upgrades
 Isolate the causes of server performance problems and address them on time, ensuring better
performance for your enterprise
 Run Knowledge Script jobs on SQL Server components
 Run Knowledge Script jobs directly on SQL Server virtual servers in a clustered environment

AppManager for Microsoft SQL Server provides Knowledge Scripts designed to give you a
comprehensive view of how SQL Server performs on your servers. The Knowledge Scripts in the
SQL Server category monitor the following:

 SQL Server accessibility and connectivity


 Blocked SQL Server processes
 Frequency at which pages are retrieved from SQL Server cache
 SQL Server data space and log space
 Locked databases
 SQL Server Error logs
 SQL Server and reports on jobs that have not completed successfully
 SQL Server services
 SQL Server user connections
 Total CPU time used by SQL Server users and their connections
 Number of read and write operations
 Total number of locks held by SQL Server users and their connections
 Number of memory pages allocated to by SQL Server users and their connections
 Mirrored database status
 CPU percentage used by SQL Server processes
 Memory used by SQL Server processes
 Log shipping status
 Node ownership of a SQL Server failover cluster instance or Always On Availability Group

You can set thresholds that specify the boundaries of optimal performance. You can also configure
AppManager to raise events when those thresholds are crossed.

Introducing AppManager for Microsoft SQL Server 9


In addition to monitoring, you can use SQL Server Knowledge Scripts to collect performance data for
use in reports. AppManager lets you generate reports that range in scope from minute-by-minute
values to monthly values over a period of years. These reports range in purpose from evaluating a
narrow window of performance data to illustrating trends that aid in effective planning.

10 Introducing AppManager for Microsoft SQL Server


2 Installing AppManager for Microsoft SQL
2

Server

This chapter provides installation instructions and describes system requirements for AppManager for
Microsoft SQL Server.

This chapter assumes you have AppManager installed. For more information about installing
AppManager or about AppManager system requirements, see the Installation Guide for AppManager,
which is available on the AppManager Documentation page.

NOTE

 AppManager for Microsoft SQL Server 8.x cannot be upgraded from AppManager for Microsoft
SQL Server module 7.x.
 This module has a new set of Knowledge Scripts and managed objects. It has a new approach to
monitor SQL Server than earlier versions (7.x) of the SQL module.

2.1 System Requirements


For the latest information about supported software versions and the availability of module updates,
visit the AppManager Supported Products page. Unless noted otherwise, this module supports all
updates, hotfixes, and service packs for the releases listed below.

AppManager for Microsoft SQL Server has the following system requirements:

Software/Hardware Version

NetIQ AppManager installed on the 8.0.3, 8.2, 9.1, 9.2, 9.5, or later
AppManager repository (QDB) computers, on
the SQL Server computers you want to One of the following AppManager agents are required:
monitor (agents), and on all console
computers
 AppManager agent 7.0.4 with hotfix 72616 or later
 AppManager agent 8.0.3, 8.2, 9.1, 9.2, 9.5 or later
Microsoft Windows operating system on the One of the following:
agent computers
 Windows Server 2019
 Windows Server 2016
 Windows Server 2012 R2
 Windows Server 2012
 Windows Server 2008 R2
 Windows Server 2008 (32-bit or 64-bit)

Installing AppManager for Microsoft SQL Server 11


Software/Hardware Version

SQL Server on the agent computers One of the following:

 SQL Server 2019


 SQL Server 2017
 SQL Server 2016
 SQL Server 2014 (32-bit or 64-bit)
 SQL Server 2012 (32-bit or 64-bit)
 SQL Server 2008 R2 (32-bit or 64-bit)
 SQL Server 2008 (32-bit or 64-bit)
 SQL Server 2005 Service Pack 2 (32-bit or 64-bit)
Microsoft .NET Framework on the agent 3.5 and 4.0 or later
computer where you want to install the
managed objects of AppManager for
Microsoft SQL Server

Microsoft .NET Framework on the computer 3.5


where you want to install the repository,
Knowledge Scripts, help files and console
extensions of AppManager for Microsoft SQL
Server

AppManager for Microsoft Windows module 7.6.170.0 or later


installed on the AppManager repository
(QDB) computer and on all console NOTE: For clustered SQL Server monitoring on Windows
computers Server 2012 and later, you must ensure that AppManager for
Microsoft Windows 7.8 or later is installed on the agent and on
all console computers.

Microsoft SQL Server Native Client 11.0 11.3.6538.0 or later

(for TLS 1.2 support) NOTE: The SQL Server Native client can be installed from this
Microsoft download link.

NOTE: If you want TLS 1.2 support and are running AppManager 9.1 or 9.2, then you are required to
perform some additional steps. To know about the steps, see the article.

2.2 Installing the Module


Run the module installer on the SQL Server computers you want to monitor (agents) to install the
agent components, and run the module installer on all console computers to install the Help and
console extensions.

NOTE

 Install Microsoft .NET Framework 3.5 and .NET Framework 4.0 or later on the agent computer
where you want to install the managed objects of AppManager for Microsoft SQL Server. To
install .NET 4.0 with the Add Roles and Features wizard in Windows Server Manager, refer the
Microsoft article.
 Install Microsoft .NET Framework 3.5 on the computer where you want to install the repository,
Knowledge Scripts, help files and console extensions of AppManager for Microsoft SQL Server.

12 Installing AppManager for Microsoft SQL Server


Access the AM70-SQLServer-8.x.x.0.msi module installer from the AM70_SQLServer_8.x.x.0.
self-extracting installation package on the AppManager Module Upgrades & Trials page.

For Windows environments where User Account Control (UAC) is enabled, install the module using
an account with administrative privileges. Use one of the following methods:

 Log in to the server using the account named Administrator. Then run the module installer .msi
file from a command prompt or by double-clicking it.
 Log in to the server as a user with administrative privileges and run the module installer .msi file
as an administrator from a command prompt. To open a command-prompt window at the
administrative level, right-click a command-prompt icon or a Windows menu item and select Run
as administrator.

You can install the Knowledge Scripts and the Analysis Center reports into local or remote
AppManager repositories (QDBs). The module installer installs Knowledge Scripts for each module
directly into the QDB instead of installing the scripts in the \AppManager\qdb\kp folder as in previous
releases of AppManager.

You can install the module manually, or you can use Control Center to deploy the module on a remote
computer where an agent is installed. For more information, see Section 2.3, “Deploying the Module
with Control Center,” on page 14. However, if you do use Control Center to deploy the module,
Control Center only installs the agent components of the module. The module installer installs the
QDB and console components as well as the agent components on the agent computer.

To install the module manually:

1 Double-click the module installer .msi file.


2 Accept the license agreement.
3 Review the results of the pre-installation check. You can expect one of the following three
scenarios:
 No AppManager agent is present: In this scenario, the pre-installation check fails, and the
installer does not install agent components.
 An AppManager agent is present, but some other prerequisite fails: In this scenario,
the default is to not install agent components because of one or more missing prerequisites.
However, you can override the default by selecting Install agent component locally. A
missing application server for this particular module often causes this scenario. For
example, installing the AppManager for Microsoft SharePoint module requires the presence
of a Microsoft SharePoint server on the selected computer.
 All prerequisites are met: In this scenario, the installer installs the agent components.
4 To install the Knowledge Scripts into the QDB:
4a Select Install Knowledge Scripts to install the repository components, including the
Knowledge Scripts, object types, and SQL stored procedures.
4b Specify the SQL Server name of the server hosting the QDB, as well as the case-sensitive
QDB name.

NOTE: Microsoft .NET Framework 3.5 is required on the computer where you run the
installation program for the QDB portion of the module. For computers running more recent
versions of Windows operating systems that use a newer version of .NET, install .NET 3.5
with the Add Roles and Features wizard in Windows Server Manager, as described in this
Microsoft article.

5 (Conditional) If you use Control Center 7.x, run the module installer for each QDB attached to
Control Center.

Installing AppManager for Microsoft SQL Server 13


6 (Conditional) If you use Control Center 8.x or later, run the module installer only for the primary
QDB. Control Center automatically replicates this module to secondary QDBs.
7 Run the module installer on all console computers to install the Help and console extensions.
8 Run the module installer on the SQL Server computers you want to monitor (agents) to install
agent components.
9 (Conditional) If you have not discovered SQL Server resources, run the Discovery_SQLServer
Knowledge Script on all agent computers where you installed the module. For more information,
see Section 2.5, “Discovering SQL Server Resources,” on page 15.
10 To get the updates provided in this release, upgrade any running Knowledge Script jobs. For
more information, see Section 2.8, “Upgrading Knowledge Script Jobs,” on page 24.

After the installation has completed, the SQLserver_Install.log file, located in the
\NetIQ\Temp\NetIQ_Debug\ServerName folder, lists any problems that occurred.

2.3 Deploying the Module with Control Center


You can use Control Center to deploy the module on a remote computer where an agent is installed.
This topic briefly describes the steps involved in deploying a module and provides instructions for
checking in the module installation package. For more information, see the Control Center User
Guide for AppManager, which is available on the AppManager Documentation page.

2.3.1 Deployment Overview


This section describes the tasks required to deploy the module on an agent computer.

To deploy the module on an agent computer:

1 Verify the default deployment credentials.


2 Check in an installation package. For more information, see Section 2.3.2, “Checking In the
Installation Package,” on page 14.
3 Configure an e-mail address to receive notification of a deployment.
4 Create a deployment rule or modify an out-of-the-box deployment rule.
5 Approve the deployment task.
6 View the results.

2.3.2 Checking In the Installation Package


You must check in the installation package, AM70-SQLServer-8.x.x.0.xml, before you can deploy
the module on an agent computer.

To check in a module installation package:

1 Log on to Control Center using an account that is a member of a user group with deployment
permissions.
2 Navigate to the Deployment tab (for AppManager 8.x or later) or Administration tab (for
AppManager 7.x).
3 In the Deployment folder, select Packages.
4 On the Tasks pane, click Check in Deployment Packages (for AppManager 8.x or later) or Check
in Packages (for AppManager 7.x).

14 Installing AppManager for Microsoft SQL Server


5 Navigate to the folder where you saved AM70-SQLServer-8.x.x.0.xml and select the file.
6 Click Open. The Deployment Package Check in Status dialog box displays the status of the
package check in.
7 To get the updates provided in this release, upgrade any running Knowledge Script jobs. For
more information, see Section 2.8, “Upgrading Knowledge Script Jobs,” on page 24.

2.4 Silently Installing the Module


To silently (without user intervention) install the module on a local machine using the default settings,
run the following command from the folder in which you saved the module installer:

msiexec.exe /i "AM70-SQLServer-8.x.x.0.msi" /qn

where x.x is the actual version number of the module installer.

NOTE: To perform a silent install on an AppManager agent running Windows 2008 R2, open a
command prompt at the administrative level and select Run as administrator before you run the
silent install command listed above.

To silently install the module on a local machine (on an Agent) and to check in the Knowledge Scripts
on a remote AppManager repository, you can use either Windows authentication or SQL
authentication.

Windows authentication:

AM70-SQLServer-8.x.x.0.msi /qn MO_B_QDBINSTALL=1 MO_B_MOINSTALL=1


MO_B_SQLSVR_WINAUTH=1 MO_SQLSVR_NAME=SQL_Server_Name MO_QDBNAME=AM-Repository Name

SQL authentication:

AM70-SQLServer-8.x.x.0.msi /qn MO_B_QDBINSTALL=1 MO_B_MOINSTALL=1


MO_B_SQLSVR_WINAUTH=0 MO_SQLSVR_USER=SQL login MO_SQLSVR_PWD=SQL Login Password
MO_SQLSVR_NAME=SQL Server Name MO_QDBNAME=AM-Repository Name

To create a log file that describes the operations of the module installer, add the following flag to the
command above:

/L* "AM70-SQLServer-8.x.x.0.msi.log"

The log file is created in the folder in which you saved the module installer.

2.5 Discovering SQL Server Resources


Use the Discovery_SQLServer Knowledge Script to discover SQL Server configurations and
resources. This script raises an event if discovery fails or succeeds.

By default, this script runs once for each computer.

NOTE: To run this Knowledge Script, you need public and read-only SQL Server permission.

To discover AlwaysOn availability group databases under SQL Server instance that is on the
secondary replica, ensure that the Readable Secondary option is configured as Yes.

Installing AppManager for Microsoft SQL Server 15


If you delete or add a resource object, or if you make any other kind of change that might affect the
monitoring of your resources, run the Discovery_SQLServer Knowledge Script again to update your
list of resource objects. In addition, if you are running this module on AppManager 8 or later, you can
use the delta discovery feature in Control Center to run discovery on a schedule to more quickly
detect changes to your environment.

When you run Discovery_SQLServer Knowledge Script, SQL Server Cluster Instances are
discovered under SQL Server Virtual folder and SQL Server Instances (non-clustered) are
discovered under NT machine folder. Therefore, you can monitor clustered instances only through
the SQL Server Virtual folder.

Resource Object
NT machine

Setting Parameter Values


Set the Values tab parameters as needed:

Description How to Set It

Job Failure Notification

Raise event if job fails Select Yes to raise an event if discovery job fails unexpectedly. The default is
unexpectedly Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use for SQL Server discovery.
You can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

Username Specify the Windows or SQL Server user name that you want to use for SQL
Server discovery. If you are a Windows user, specify the user name in the
DomainName\User format. You can specify multiple users separated by commas.
This field is optional.

For more information on specifying the user name, see Section 2.7.3, “Specifying
the User Name in the Knowledge Script,” on page 21.

Exclude server list (comma- Specify the list of SQL server instances that you do not want to discover,
separated list) separated by commas.

16 Installing AppManager for Microsoft SQL Server


Description How to Set It

Specify list of databases to Specify the name of the databases you want to exclude from discovery,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from discovery.

NOTE: Enter each database on a separate line.

You can use standard pattern-matching characters when specifying database


names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Exclude discovering Select Yes to exclude discovery of availability group databases under SQL
availability group databases Server instance.
under SQL Server instance
NOTE: This parameter does not apply when you run this discovery job on a
availability group listener node.

Exclude discovering the Select Yes to exclude discovery of the data space and the log space information
data and log space for a database if auto growth is enabled. The default is unselected.
information for a database if
auto growth is enabled?

Raise event if discovery Select Yes to raise an event if discovery succeeds. The default is Yes.
succeeds?

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery succeeds which discovery succeeds. The default is 25.

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery is not applicable which discovery is not applicable. The default is 15.

Raise event if discovery Select Yes to raise an event if discovery succeeds partially. The default is Yes.
partially succeeds?
NOTE: The event displays the list of databases that are not discovered.

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery partially succeeds which discovery partially succeeds. The default is 15.

Raise event if discovery Select Yes to raise an event if discovery fails. The default is Yes
fails?

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery fails which discovery fails. The default is 5.

Installing AppManager for Microsoft SQL Server 17


2.6 Discovering AlwaysOn Availability Group
To discover the resources of AlwaysOn availability group, you must run the following Knowledge
Scripts:

1. Discovery_SQLServerAlwaysOnCluster: Discovers the availability group listeners on an


AlwaysOn cluster.
2. Discovery_SQLServer: Discovers the availability group resources under the listener nodes.

2.6.1 Discovering Availability Group Listeners


AppManager for SQL Server 8.1 or later release includes a new discovery script,
Discovery_SQLServerAlwaysOnCluster that you can use to discover the availability group listeners
on a cluster. An availability group listener is a virtual network name (VNN) to which clients can
connect to the AlwaysOn availability group. This script only discovers the listener nodes.

NOTE: The Discovery_SQLServerAlwaysOnCluster Knowledge Script does not discover and monitor
cluster shared disks through listener node.

You can discover AlwaysOn Availability Groups only on AppManager version 8.0.x or later.

In AppManager 8.0.2, NetIQ recommends that you use the Control Center Console to view the
objects under the availability group.

By default, this script runs once for each computer.

Security Rights
To correctly discover and monitor a Microsoft AlwaysOn cluster, this Knowledge Script requires local
Administrator access to each node of the Microsoft cluster. To do this, run the netiq service as a
domain user account and a member of the local Administrator group on each member of the cluster.
Without this access, the discovery fails because it relies on the Microsoft Cluster API to properly
access cluster resources.

Administering a Cluster
The Cluster Administrator can be used to administer a cluster, provided the account you are using
has the required permissions and group memberships. The local Administrator account and local
system account always have access to the cluster. You can use another account to administer a
cluster with Cluster Administrator if the following requirements are true:

 The account has permission to administer the cluster. You must use Cluster Administrator to
assign permissions, not Windows Group Administrator.
 The account is a domain account, which is a member of the local Administrators group.
 The account is a member of the local Administrators group on each node of the cluster.

The account can be a member of other groups, such as global groups, as long as it is a domain
account.

By default, this Knowledge Script raises an event when discovery fails.

18 Installing AppManager for Microsoft SQL Server


NOTE: AlwaysOn availability group does not support delta discovery. If you add or remove a cluster
node (availability group replica), you must first delete the listener node objects and run both
Discovery_SQLServerAlwaysOnCluster and Discovery_SQLServer Knowledge Scripts again to
discover the listener nodes and the resources.

Resource Object
NT Machine Folder

Setting Parameter Values


Set the Values tab parameters as needed:

Description How to Set It

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the discovery job fails unexpectedly. The default is
unexpectedly Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Raise event if discovery Select Yes to raise an event if discovery succeeds. The default is unselected.
succeeds?

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery succeeds which discovery succeeds. The default is 25.

Raise event if discovery is Select Yes to raise an event if discovery is not applicable. For example, if you run
not applicable? this Knowledge Script other than an cluster instance, discovery is not applicable.

The default is Yes.

Event severity when Set the event severity level, from 1 to 40, to reflect the importance of an event in
discovery is not applicable which discovery is not applicable. The default is 15.

2.6.2 Discovering Availability Group Resources


Run the Discovery_SQLServer Knowledge Script on the discovered listener nodes to discover the
availability group resources under the listener nodes.

NOTE:

To run this Knowledge Script on availability group listeners, you need public, read-only, view
server state, and view any definition SQL Server permission.

You must configure the users in security manager before running this script. For more information
about configuring users in security manager, see Section 2.7, “Configuring SQL Server User in
Security Manager,” on page 20.

Installing AppManager for Microsoft SQL Server 19


For more information on Discovery_SQLServer script, see Section 2.5, “Discovering SQL Server
Resources,” on page 15

2.7 Configuring SQL Server User in Security Manager


To run the Discovery_SQLServer Knowledge Script with a specific SQL/Windows authentication user,
you must configure your user login and password information in the Custom tab of AppManager
Security Manager. This is the user that AppManager will use to login to SQL Server instances. You
can either configure a default user for all the instances, or a specific user for specific SQL Server
instances. You can also use a non-default TCP port for SQL Server instance or Availability Group
Listener by configuring the AppManager Security Manager.

NOTE: This module does not use the user specifications configured in Security Manager for the
earlier versions of SQL module.

2.7.1 Configuring SQL Server User


To use a specific SQL/Windows authentication user account, use the following configuration:

Field Description

Label SQLServer

Sub-label Do one of the following:

 For SQL Server Instance: UserName or


UserName$InstanceName.

For example: Type sa, sa$sqlserverinst1, or


amdom001\user1$sqlserverinst1
 For AlwaysOn Availability Group Listener Node: Specify the
availability group listener node name as the instance name,
UserName or
UserName$AvailabilityGroupListenerNode.
For example: Type sa, sa$aglistener1, or
amdom001\user1$aglistener1

NOTE: For Windows user, specify the username in the


DomainName\UserName format.

For example: amdom001\user1$sqlserverinst1

A user without any specific instance is the default user.

For Windows Authentication, if you leave this field blank,


AppManager uses the NetIQ service account to log in to the SQL
Server.

Value 1 Password for the user.

Value 2 Leave this field blank.

NOTE: Type blank in this field if the password in the Value 1 field is
left empty, that is, the user account does not have a password.

Value 3 Leave this field blank.

20 Installing AppManager for Microsoft SQL Server


Field Description

Extended application support Required field. Encrypts the user name and password in Security
Manager. Do not leave this option unselected.

2.7.2 Configuring non-default TCP port


You can specify the non-default TCP port that is used by a SQL Server or an Availability Group
Listener in the AppManager Security Manager.

NOTE: This feature is only supported on AppManager for Microsoft SQL Server 8.2 or later.

To use a non-default TCP port for the SQL Server or the Availability Group Listener, use the following
configuration:

Field Description

Label SQLServer

Sub-label Specify the username in the InstanceName_TCPPort format.

For example: sqlserverinst1_TCPPort.

NOTE: The InstanceName must be the Virtual node name.

Value 1 Specify the TCP port. For example: 1469, where 1469 is the TCP
port used by the SQL Server or the Availability Group Listener.

Value 2 Leave this field blank.

Value 3 Leave this field blank.

Extended application support Required field. Encrypts the user name and password in Security
Manager. Do not leave this option unselected.

2.7.3 Specifying the User Name in the Knowledge Script


To run a SQL Server Knowledge Script with a specific Windows/SQL authentication user, you must
specify a user name to access the SQL Server instances. You can specify a default user name (a
user without any instance), a user name with specific instances, or a combination of both. You can
specify multiple user names separated by a comma.

The users that you specify in the Knowledge Script must be configured in Security Manager before
running the script. For more information, see Section 2.7.1, “Configuring SQL Server User,” on
page 20.

NOTE: When running a Knowledge Script, you can specify only one default user in the User name
parameter.

The different use cases below provide examples of different types of authentication. All the users in
the examples are already configured in Security Manager.

Installing AppManager for Microsoft SQL Server 21


Windows Authentication

Use Case 1 - User Name with Default User


Use amdom001\user1 for User name in a Knowledge Script. When you run this script on three
instances, SQLServerInst1, SQLServerInst2, and SQLServerInst3, the script runs on all the
instances successfully. On all the instances, this script uses the default amdom001\user1 user
configuration.

The user name without any instance name is used as the default user for all instances.

Use Case 2 - User Name with Specific Instances


Use amdom001\user2$SQLServerInst1 for User name in a Knowledge Script. When you run this
script on two instances, SQLServerInst1 and SQLServerInst2, this script runs successfully on the
SQLServerInst1 instance with this amdom001\user2$SQLServerInst1 user configuration. On
SQLServerInst2, this script fails, because there is no specific or default user available for this
instance.

Use Case 3 - User Name with Specific Instances and Default User
Use amdom001\user1,amdom001\user2$SQLServerInst1 for User name in a Knowledge Script.
When you run this script on three instances, SQLServerInst1, SQLServerInst2, and
SQLServerInst3, this script runs on all the instances successfully. On SQLServerInst1 instance, this
script uses this amdom001\user2$SQLServerInst1 user configuration and on SQLServerInst2, and
SQLServerInst3, this script uses the amdom001\user1 user configuration.

The user name without any instance name is used as the default user for all instances.

NOTE: User with a specific instance takes precedence over the default user.

Use Case 4 - User Name with Specific Instances and Default User in Incorrect
Format
Use amdom001\user2$SQLServerInst1,user1 for User name in a Knowledge Script. When you run
this script on three instances, SQLServerInst1, SQLServerInst2, and SQLServerInst3, this script
runs properly on SQLServerInst1 instance. This script fails on SQLServerInst2, and
SQLServerInst3, because the user name is not formatted properly in the DomainName\UserName
format.

Use Case 5 - User Name Field as Blank


If you select Windows Authentication in the Authentication field and leave the User name field blank
in the Knowledge Script, then the script uses the default NetIQ service account user to login to the
SQL Server.

SQL Server Authentication

Use Case 1 - User Name with Default User


Use sa for User name in a Knowledge Script. When you run this script on three instances,
SQLServerInst1, SQLServerInst2, and SQLServerInst3, this script runs on all the instances
successfully. On all the instances, this script uses the default sa user configuration.

22 Installing AppManager for Microsoft SQL Server


The user name without any instance name is used as the default user for all instances.

Use Case 2 - User Name with Specific Instances


Use sa1$SQLServerInst1 for User name in a Knowledge Script. When you run this script on two
instances, SQLServerInst1 and SQLServerInst2, this script runs successfully on SQLServerInst1
instance with this sa1$SQLServerInst1 user configuration. On SQLServerInst2, this script fails,
because there is no specific or default user available for this instance.

Use Case 3 - User Name with Specific Instances and Default User
Use sa,sa1$SQLServerInst1 for User name in a Knowledge Script. When you run this script on three
instances, SQLServerInst1, SQLServerInst2, and SQLServerInst3, this script runs on all the
instances successfully. On SQLServerInst1 instance, this script uses this sa1$SQLServerInst1 user
configuration and on SQLServerInst2, and SQLServerInst3, this script uses the sa user
configuration.

The user name without any instance name is used as the default user for all instances.

NOTE: User with a specific instance takes precedence over the default user.

Use Case 4 - User Name Field as Blank


If you select SQL Server Authentication and leave the User name field blank in the Knowledge Script,
then the script raises an error event.

The figure below displays the user specifications that is used by SQL Server instances while running
a knowledge script.

Knowledge Script

User Specifications User Account used on Instances

Instance0 Instance1 Instance2 Instance3

username

username username$inst1

username$inst1 username$inst2

username$inst1 username$inst2 username

username$inst2 username$inst3 username

username$inst2 username$inst3

Installing AppManager for Microsoft SQL Server 23


2.8 Upgrading Knowledge Script Jobs
If you are using AppManager 8.x or later, the module upgrade process now retains any changes you
might have made to the parameter settings for the Knowledge Scripts in the previous version of this
module. Before AppManager 8.x, the module upgrade process overwrote any settings you might
have made, changing the settings back to the module defaults.

As a result, if this module includes any changes to the default values for any Knowledge Script
parameter, the module upgrade process ignores those changes and retains all parameter values that
you updated. Unless you review the management guide or the online Help for that Knowledge Script,
you will not know about any changes to default parameter values that came with this release.

You can push the changes for updated scripts to running Knowledge Script jobs in one of the
following ways:

 Use the AMAdmin_UpgradeJobs Knowledge Script.


 Use the Properties Propagation feature.

2.8.1 Running AMAdmin_UpgradeJobs


The AMAdmin_UpgradeJobs Knowledge Script can push changes to running Knowledge Script jobs.
Your AppManager repository (QDB) must be at version 7.0 or later. Upgrading jobs to use the most
recent script version allows the jobs to take advantage of the latest script logic while maintaining
existing parameter values for the job.

For more information, see the Help for the AMAdmin_UpgradeJobs Knowledge Script.

2.8.2 Propagating Knowledge Script Changes


You can propagate script changes to jobs that are running and to Knowledge Script Groups, including
recommended Knowledge Script Groups and renamed Knowledge Scripts.

Before propagating script changes, verify that the script parameters are set to your specifications.
You might need to appropriately set new parameters for your environment or application.

If you are not using AppManager 8.x or later, customized script parameters might have reverted to
default parameters during the installation of the module.

You can choose to propagate only properties (specified in the Schedule and Values tabs), only the
script (which is the logic of the Knowledge Script), or both. Unless you know specifically that changes
affect only the script logic, you should propagate the properties and the script.

For more information about propagating Knowledge Script changes, see the “Running Monitoring
Jobs” chapter of the Control Center User Guide for AppManager.

24 Installing AppManager for Microsoft SQL Server


2.8.3 Propagating Changes to Ad Hoc Jobs or Knowledge Script
Groups
You can propagate the properties and the logic (script) of a Knowledge Script to ad hoc jobs started
by that Knowledge Script. Corresponding jobs are stopped and restarted with the Knowledge Script
changes.

You can also propagate the properties and logic of a Knowledge Script to corresponding Knowledge
Script Group members. After you propagate script changes to Knowledge Script Group members,
you can propagate the updated Knowledge Script Group members to associated running jobs. Any
monitoring jobs started by a Knowledge Script Group member are restarted with the job properties of
the Knowledge Script Group member.

To propagate changes to ad hoc Knowledge Script jobs or Knowledge Script Groups:

1 In the Knowledge Script view, select the Knowledge Script or Knowledge Script Group for which
you want to propagate changes.
2 Right-click the script or group and select Properties propagation > Ad Hoc Jobs.
3 Select the components of the Knowledge Script that you want to propagate to associated ad hoc
jobs or groups and click OK:

Select To propagate

Script The logic of the Knowledge Script.

Properties Values from the Knowledge Script Schedule and Values tabs, such as schedule,
monitoring values, actions, and advanced options. If you are using AppManager
8.x or later, the module upgrade process now retains any changes you might have
made to the parameter settings for the Knowledge Scripts in the previous version
of this module.

Installing AppManager for Microsoft SQL Server 25


26 Installing AppManager for Microsoft SQL Server
3 SQL Server Knowledge Scripts
3

AppManager provides the following Knowledge Scripts for monitoring SQL Server version 2005 and
later. The SQLServer category of Knowledge Scripts is supported for SQL Server resources installed
in clustered and non-clustered environments.

When deciding which Knowledge Scripts to run and the appropriate threshold values to use, consider
how other applications you manage are dependent on SQL Server.

To run these Knowledge Scripts, you must require a minimum of Public and read-only SQL Server
permissions. There are few Knowledge Scripts that require specific SQL Server permission. The
following graphic displays the permissions required to run the Knowledge Scripts.x

SQL Server Knowledge Scripts 27


Knowledge Scripts SQL Server Permissions

Discovery_SQLServer

Accessibility Public, read-only


permissions on all
databases
LogSpace to be monitored or
discovered
DataSpace

DBMirrorStatus

DBStats
Select permission on
msdb..sysjobs,
msdb..sysjobservers
MonitorJobs

Blocked Processes

DBLocks

NearMaxConnect
View Server State
NearMaxLocks

TopResourceUsers

Discovering and Monitoring Through


AlwaysOn Listener

Discovery_SQLServer

Accessibility Read-only,
View Server State,
DataSpace View Any Definitions
permissions on
DBLocks AlwaysOn Availability
Group Databases
DBStats

LogSpace

28 SQL Server Knowledge Scripts


From the Knowledge Script view of Control Center, you can access more information about any
NetIQ-supported Knowledge Script by selecting it and clicking Help. In the Operator Console, click
any Knowledge Script in the Knowledge Script pane and press F1.

Knowledge Script What It Does

Accessibility Monitors SQL Server database accessibility and raises an event if specified
database is not accessible.

AvailabilityGroupHealth Monitors the AlwaysOn Availability Group health status, replica


synchronization status, replica failover readiness, and operational status.

AvailabilityGroupOwner Determines the node ownership of a SQL Server AlwaysOn Availability Group.

BackupJob Monitors SQL Server backup jobs to track data backup activities optimally.

BlockedProcesses Monitors the number of SQL Server processes that have been queued for
longer than the period of time you specify.

CacheHitRatio Monitors the percentage at which the requested data page is retrieved from
the SQL Server cache without performing physical reads from disk.

Connectivity Monitors SQL Server connectivity and raises an event if the server is not
available during the monitoring interval.

CPUUtil Monitors the percentage of CPU used by SQL Server processes.

DataSpace Monitors the available data space and the percentage of data space used by
each database.

DBLocks Monitors the number of locks per SQL Server database and raises an event if
the number of locks exceeds the threshold you specify.

DBMirrorStatus Monitors the status of each mirrored database.

DBStats Monitors the percentage of used space for data and log files.

ErrorLog Monitors the SQL Server error logs and looks for any error log entries that
have appeared since the last monitoring interval. This script also scans the
error log entries for any new entries created since the last time it checked.

LogShipping Monitors log shipping status.

LogSpace Monitors the available log space and used log space of a database and raises
an event if the available log space falls below the threshold, or if the
percentage of log space used exceeds the threshold you specify.

MemUtil Monitors the amount of memory used by SQL Server processes.

MonitorJobs Reports on any scheduled jobs that have not completed successfully.

NearMaxConnect Monitors the number of used connections compared to the maximum


concurrent connections configured for the SQL Server

NearMaxLocks Monitors the used number of locks compared to the maximum available locks
configured for the SQL Server.

RunSql Runs T-SQL statements or stored procedures.

ServerDown Monitors the up or down status of SQL Server and also identifies the downtime
of the SQL Server since the server was started.

SQLClusterOwner Determines the node ownership of a SQL Server failover cluster instance.

SQL Server Knowledge Scripts 29


Knowledge Script What It Does

TopResourceUsers Monitors the total CPU time used by SQL Server users, the number of IO
operations performed, the total number of locks held by all SQL Server users
and their connections, and the number of memory pages that can be allocated
to all SQL Server users and their connections.

UserConnections Monitors the total number of user connections currently connected to SQL
Server and raises an event if the total number of user connections exceeds the
threshold you specify.

3.1 Accessibility
Use this Knowledge Script to monitor SQL Server database accessibility. This script raises an event if
a specified database is not accessible. In addition, this script generates data streams for database
accessibility.

You can set a timeout to determine how many times the Knowledge Script attempts to connect to a
database.

NOTE: To run this Knowledge Script, you need public and read-only permission on all the
databases that are to be monitored.

You can monitor availability group databases on secondary replica only if the Readable Secondary
option is configured as Yes for secondary replica.

Resource Object
SQL Server instance

AlwaysOn availability group listener

Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_Accessibility job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

30 SQL Server Knowledge Scripts


Description How to Set It

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Server Accessibility

Timeout Specify the number of seconds to wait for a response before retrying or
determining the database is inaccessible. The default is 30 seconds.

When specifying a timeout, the Knowledge Script continues to wait until it


receives a response or the timeout is reached. Limit your use of this parameter or
keep the timeout period to a minimum for regular monitoring jobs.

When running this script to troubleshoot a particular problem and not on a


regularly scheduled interval, adjust this parameter to allow a longer timeout
period.

Number of retries Specify the number of times this script should retry connecting to the database
before determining the database is inaccessible. The default is 0 (no retry
attempts).

This Knowledge Script continues waiting until it receives a response or has made
the specified number of retry attempts. Limit your use of this parameter or keep
retry attempts to a minimum for regular monitoring jobs.

When you are running this script to troubleshoot a particular problem and not on a
regularly scheduled interval, you might want to adjust this parameter to allow
more retry attempts.

Specify list of databases to Specify the name of the databases you want to exclude from monitoring,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

SQL Server Knowledge Scripts 31


Description How to Set It

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from monitoring.

NOTE: Enter each database on a separate line.

You can use standard pattern-matching characters when specifying database


names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Include detail report in data Select Yes to include a detail report in the data points collected for charts and
points reports. The default is unselected.

Exclude monitoring Select Yes to exclude the monitoring of the availability group databases that are
availability group databases under the SQL Server instance. The default is unselected.
under SQL Server
instance?

Exclude monitoring loading Select Yes to exclude the monitoring of the SQL Server databases that are in
or restoring databases loading or restoring state under the SQL Server instance. The default is
under SQL Server unselected.
instance?

Event Notification

Raise event if database Select Yes to raise an event if database accessibility is below the threshold you
accessibility is below specify. The default is Yes.
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
database accessibility is which the database is not accessible. The default is 5.
below threshold

Threshold - Minimum Specify the minimum percentage of database accessibility that should be reached
accessibility before generating an event. The default is 100 percent.

If the percentage of accessibility request falls below the threshold, AppManager


raises an event.

Data Collection

Collect data for database Select Yes to collect data for charts and reports. If enabled, data collection
accessibility? returns the following:

 100--all specified databases are accessible


 50--some of the specified databases are accessible and some are not
 0--none of the specified databases is accessible.
The default is unselected.

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

32 SQL Server Knowledge Scripts


Description How to Set It

Collect data for each Select Yes to collect data for each database for charts and reports. If enabled,
database accessibility? data collection returns the data for each database. The default is unselected.

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

3.2 AvailabilityGroupHealth
Use this Knowledge Script to monitor the AlwaysOn availability group health status, replica
synchronization status, replica failover readiness, and operational status.

This script raises an event if the availability group status is not healthy, replica databases are not
synchronized properly, there is a potential data loss during a failover, or operational state is offline/
failed.

Resource Object
Availability Groups

Default Schedule
The default interval for this script is Every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_AvailabilityGroupHealth job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

SQL Server Knowledge Scripts 33


Description How to Set It

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor SQL Server Availability Group Health

Include results in data Select Yes to include the results in the data detail message.
details?
By default, query results are not included.

Event Notification

Raise event if availability Select Yes to raise an event if the availability group status is not healthy. The
group state is not default is Yes.
healthy?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
availability group state is which the availability group status is not healthy. The default is 5.
not healthy

Raise event if availability Select Yes to raise an event if the availability group replica is not synchronized
replica is not properly. The default is Yes.
synchronized?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
availability replica is not that is raised when the availability group replica is not synchronized. The default
synchronized is 5.

Raise event if availability Select Yes to raise an event if the availability group replica failed over with
replica failed over with potential data loss. The default is Yes.
potential data loss?

Event severity when the Set the event severity level, from 1 to 40, to indicate the importance of an event
availability replica failed that is raised when the availability group replica failed over with potential data
over with potential data loss loss. The default is 5.

Raise event if operational Select Yes to raise an event if the operational state of the availability group
state of the availability replica is offline or failed. The default is Yes.
replica is offline/failed?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
operational state of the that is raised when the operational state of the availability group replica is offline
availability replica is offline/ or failed. The default is 5.
failed

Data Collection

Collect data for availability Select Yes to collect data for the availability group health status for charts and
group health status? reports. The default is unselected.

Collect data for availability Select Yes to collect data for the availability group replica synchronization status
replica synchronization for charts and reports. The default is unselected.
state?

Collect data for availability Select Yes to collect data for the potential data loss when the availability group
replica failed over with replica failed over, for charts and reports. The default is unselected.
potential data loss?

34 SQL Server Knowledge Scripts


Description How to Set It

Collect data for availability Select Yes to collect data for the availability group replica operational state for
group replica operational charts and reports. The default is unselected.
state?

3.3 AvailabilityGroupOwner
Use this Knowledge Script to determine the node ownership of SQL Server AlwaysOn Availability
Group. This script raises an event if the availability group owner node is changed. The script
generates data streams for ownership status.

Resource Object
Availability Groups

Default Schedule
The default interval for this script is Every 5 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_AvailabilityGroupOwner job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL server fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method to access SQL Server. You can either select
Windows Authentication or SQL Server Authentication. The default is Windows
Authentication.

User name Specify the Windows or SQL Server user name to access SQL Server. You can
specify multiple users separated by a comma. The default is none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

SQL Server Knowledge Scripts 35


Description How to Set It

Monitor Failover Availability Group

Timeout Specify the number of seconds that the Knowledge Script should wait to obtain
the owner node state before raising a timeout exception. The default is 30
seconds.

Event Notification

Raise event if owner node Select Yes to raise an event if the availability group owner is changed. The
is changed? default is Yes.

Event severity when owner Set the event severity level, from 1 to 40, to indicate the importance of an event
node is changed that is raised when the availability group owner has changed. The default is 5.

Raise event to show the Select Yes to raise an event to display the availability group owner in the first
owner node in first iteration. The default is unselected.
iteration?

Event severity to show the Set the event severity level, from 1 to 40, to indicate the importance of an event to
owner node in first iteration display the availability group owner in the first iteration. The default is 25.

Data Collection

Collect data for owner node Select Yes to collect availability group owner node status data for charts and
state? reports. The default is unselected.

3.4 BackupJob
Use this Knowledge Script to monitor SQL Server backup jobs. Using this script, administrators can
track data backup activities optimally.

This Knowledge Script uses the SQL Server error logs (Errorlog, Errorlog.* in the SQL Server log
folder). Ensure that the user has read permission to this files/folders.

On the first job iteration, this script sets a starting point for future log scanning and does not scan the
existing entries in the logs. Therefore, it does not return any results on the first iteration. As it
continues to run at the interval specified in the Schedule tab, this script scans the logs for any new
entries created since the last time it checked.

This script raises an event if the number of successful backup records exceeds the threshold you
specify, and if the backup fails for any reason.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Every hour.

36 SQL Server Knowledge Scripts


Setting Parameter Values
Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_BackupJob fails unexpectedly. The
unexpectedly? default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor Backup Jobs

Event Notification

Raise event if backup job Select Yes to raise an event if a backup job fails. The default is Yes.
fails?

Event severity when backup Set the event severity level, from 1 to 40, to indicate the importance of an event
job fails that is raised when the backup job fails. The default is 5.

Threshold -- Maximum Specify the number of backup jobs that should get failed before raising an event.
failed backup jobs The default is 0.

Raise event if successful Select Yes to raise an event if the number of successful backup jobs exceeds the
backup jobs exceed threshold. The default is unselected.
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
successful backup jobs which the number of successful backup jobs exceeds the threshold. The default
exceed threshold is 15.

Threshold -- Maximum Specify the number of backup jobs that should be successful before raising an
successful backup jobs event. The default is 10.

Data Collection

Collect data for failed Select Yes to collect backup jobs data for charts and reports. If enabled, data
backup jobs? collection returns the number of failed backup jobs. The default is unselected.

Collect data for successful Select Yes to collect backup jobs data for charts and reports. If enabled, data
backup jobs? collection returns the number of successful backup jobs. The default is
unselected.

3.5 BlockedProcesses
Use this Knowledge Script to monitor the number of SQL Server processes that are queued for longer
than the period of time you specify. You can set a threshold to determine how long a process can be
in queue before it is considered blocked. This script raises an event when the number of blocked
processes exceeds a threshold you specify.

SQL Server Knowledge Scripts 37


NOTE: To run this Knowledge Script, you need public and view server state SQL Server
permissions. If you do not have these permissions, the Knowledge Script does not display any error,
but the data returned is not complete. To get complete data, you must have these permissions.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_BlockedProcess job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Blocked Process

Include detail report in data Select Yes to include a detail report in the data points collected for charts and
points? reports. The default is unselected.

Number of blocked Specify the number of processes to display in the report pane of the console. The
processes to include in default is 20 blocked processes. Enter 0 to display all blocked processes.
report

38 SQL Server Knowledge Scripts


Description How to Set It

Include the T-SQL Select Yes to include the T-SQL statement associated with each blocked
statement for each blocked process. The default is unselected.
process?

Timeout Specify the number of seconds that the Knowledge Script should wait to get the
T-SQL statement before raising a timeout exception. The default is 30 seconds.

Event Notification

Raise event if number of Select Yes to raise an event if the number of blocked processes exceeds the
blocked processes threshold. The default is Yes.
exceeds threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
number of blocked which the number of blocked processes exceeds the threshold. The default is 5.
processes exceeds
threshold

Threshold -- Maximum Specify the maximum number of processes that can be blocked before an event
number of blocked is raised. The default is 5 blocked processes.
processes

Threshold -- Maximum Specify the maximum length of time a process can be queued before it is
waiting time in queue considered a blocked process. The default is 500 milliseconds.

Data Collection

Collect data for total Select Yes to collect data for charts and reports. If enabled, data collection
number of blocked returns the total number of blocked processes. The default is unselected.
processes?

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

3.6 CacheHitRatio
Use this Knowledge Script to monitor the percentage at which a requested data page is retrieved
from the SQL Server data cache without performing physical reads from disk. This script raises an
event if the cache hit ratio falls below the threshold you specify.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Once every hour.

SQL Server Knowledge Scripts 39


Setting Parameter Values
Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_CacheHitRatio job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor Cache Hit Ratio

Event Notification

Raise event if cache hit Select Yes to raise an event when the cache hit ratio falls below the threshold.
ratio is below threshold? The default is Yes.

Event severity if cache hit Set the event severity level, from 1 to 40, to indicate the importance of an event in
ratio is below threshold which the cache hit ratio falls below the threshold. The default is 5.

Threshold -- Minimum Specify the minimum percentage that requested data pages can be retrieved in
cache hit ratio the data cache before an event is raised.

Ideally this percentage should be set relatively high, because the more frequently
SQL Server uses the data cache, the better your database performance. When
SQL Server accesses information in the data cache less frequently than the
threshold you specify, for example only 50% of the time, an event informs you
that database performance has deteriorated. The default is 90%.

Data Collection

Collect data for cache hit Select Yes to collect data for charts and reports. If enabled, data collection
ratio? returns the cache hit percentage. The default is unselected.

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

3.7 Connectivity
Use this Knowledge Script to monitor SQL Server connectivity. You can set a timeout to determine the
number of times the script should attempt to contact the server.

This script raises an event if, during any monitoring interval, the number of times the server is not
available exceeds the number of retries you specify.

NOTE: To run this Knowledge Script, you need public and read-only SQL Server permission.

40 SQL Server Knowledge Scripts


Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Every five minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_Connectivity job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Server Connectivity

Timeout Specify the maximum number of seconds the Connectivity script should wait for a
response from server before retrying. The default is 30 seconds.

Number of retries Specify the number of times the Connectivity script must retry connecting to the
SQL Server before determining that the server is inaccessible. The default is 0.

Event Notification

Raise event if connection Select Yes to raise an event if the connection to a server or an instance fails. The
with SQL server fails? default is Yes.

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
connection with SQL server which the connection with a server fails. The default is 5.
fails

Data Collection

Collect data for server Select Yes to collect server connectivity data for charts and reports. The default is
connectivity? unselected.

SQL Server Knowledge Scripts 41


Description How to Set It

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

3.8 CPUUtil
Use this Knowledge Script to monitor the percentage of CPU resources used by the sqlservr,
sqlagent, and sqlexec processes. This script raises an event if the CPU usage for SQL Server
processes exceeds the threshold you set.

Resource Object
Microsoft SQL Server

Default Schedule
The default schedule for this script is Every 10 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_CPUUtil job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor CPU utilization

Include detail report in data Select Yes to include a detail report in the data points collected for charts and
point? reports. The default is unselected.

Event Notification

Raise event if CPU Select Yes to raise an event if a process uses CPU more than the threshold. The
utilization for a process default is Yes.
exceeds threshold?

Event severity when CPU Set the event severity level, from 1 to 40, to indicate the importance of an event in
utilization for a process which a process uses CPU more than the threshold. The default is 5.
exceeds threshold

42 SQL Server Knowledge Scripts


Description How to Set It

Threshold- Maximum CPU Specify the maximum CPU usage for a process that can be in use before an
utilization for a process event is raised. The default is 55%.

Raise event if total CPU Select Yes to raise an event if the total CPU usage for all the processes exceeds
utilization for all the the threshold. The default is Yes.
processes exceeds
threshold?

Event severity when total Set the event severity level, from 1 to 40, to indicate the importance of an event in
CPU utilization for all which the total CPU usage for all the processes exceeds the threshold. The
processes exceeds default is 5.
threshold

Threshold- Maximum CPU Specify the maximum CPU usage for all processes that can be in use before an
utilization for all processes event is raised. The default is 90%.

Data Collection

Collect data for CPU Select Yes to collect data for charts and reports. If enabled, data collection
utilization for each process? returns the percentage of CPU utilization for a process. The default is unselected.

Collect data for CPU Select Yes to collect data for charts and reports. If enabled, data collection
utilization for all processes? returns the percentage of total CPU utilization for all process. The default is
unselected.

3.9 DataSpace
Use this Knowledge Script to monitor available data space and the percentage of data space used by
each database. This script raises an event if the amount of available data space, in MB, is lower than
the threshold you specify. This script also raises an event if the percentage of used data space is
higher than the threshold you specify.

You can set this script to observe new databases dynamically each time it runs. Observing databases
dynamically allows you to monitor data space for newly created SQL Server databases since you ran
the Discovery_SQLServer Knowledge Script and prevents you from attempting to monitor databases
that have been dropped since discovery.

NOTE

 Although this script can observe databases each time it runs, the new databases are not
reflected in the Operator Console or Control Center.
 To run this Knowledge Script, you need public and read-only permissions on all the databases
that are to be monitored.
 You can monitor availability group databases on secondary replica only if the Readable
Secondary option is configured as Yes for secondary replica.

Resource Objects
System or User Databases

If you are not observing databases dynamically, you can run this script on a Database folder or
individual database objects. Dynamic observation monitors all databases regardless of target
resource object.

SQL Server Knowledge Scripts 43


Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_DataSpace job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Raise event if database is Select Yes to raise an event if a database is offline. The default is unselected.
offline?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is offline that is raised when a database is offline. The default is 15.

Raise event if database is Select Yes to raise an event if a database is deleted. The default is unselected.
deleted?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is deleted that is raised when a database is deleted. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Data Space

Dynamically observe Select Yes to dynamically observe databases at each monitoring interval. The
databases at each interval? default is unselected.

NOTE: Dynamic observation monitors all databases regardless of target


resource object.

44 SQL Server Knowledge Scripts


Description How to Set It

Exclude monitoring loading Select Yes to exclude the monitoring of the SQL Server databases that are in
or restoring databases loading or restoring state under the SQL Server instance. The default is
under SQL Server unselected.
instance?

Specify list of databases to Specify the name of the databases you want to exclude from monitoring,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from monitoring.

NOTE: Enter each database on a separate line.

The databases specified in the file are excluded even if dynamic monitoring is not
enabled.

You can use standard pattern-matching characters when specifying data space
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Exclude monitoring Select Yes to exclude the monitoring of the availability group databases that are
availability group databases under the SQL Server instance. The default is unselected.
under SQL Server
instance?

Event Notification

Raise event if used data Select Yes to raise an event if the percentage of used data space exceeds the
space exceeds threshold you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
data space exceeds which the percentage of used data space exceeds the threshold. The default is 5.
threshold

Threshold - Maximum Specify the maximum percentage of data space that can be in use before an
percentage of used data event is raised. The default is 90%.
space

Raise event if available Select Yes to raise an event if the available data space falls below the threshold
data space falls below you specify. The default is Yes.
threshold?

SQL Server Knowledge Scripts 45


Description How to Set It

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
available data space falls which the amount of available data space falls below the threshold. The default is
below threshold 5.

Threshold - Minimum Specify the minimum amount of data space that is required to be available before
available data space an event is raised. If the amount of available data space falls below this threshold,
an event is raised. The default is 0 MB.

Data Collection

Collect data for used data Select Yes to collect data for charts and reports. If enabled, data collection
space? returns the percentage of data space used for each database. The default is
unselected.

Collect data for available Select Yes to collect data for charts and reports. If enabled, data collection
data space? returns the available data space (in MB) for each database. The default is
unselected.

3.10 DBLocks
Use this Knowledge Script to monitor the number of locks per SQL Server database. This script
raises an event if the number of locks exceeds the threshold. In addition, this script generates data
streams for the number of locks, and you can include a report of locks in the events and data for this
script. All the databases in the SQL Server are monitored if dynamic observation of databases is
enabled, unless you exclude them.

You can set this script to observe new databases dynamically each time it runs. Observing databases
dynamically allows you to monitor locks for newly created SQL Server databases since you ran the
Discovery_SQLServer Knowledge Script and prevents you from attempting to monitor databases that
have been dropped since discovery.

NOTE

 Although this script can observe databases each time it runs, the new databases are not
reflected in the Operator Console or Control Center.
 To run this Knowledge Script, you need public and view server state SQL Server
permissions.
 This Knowledge Script monitors the availability group databases in both primary and secondary
replica irrespective of the configuration of the Readable Secondary option of the secondary
replica, because this Knowledge Script retrieves the lock information from system.master
database.

Resource Objects
System or User Databases

If you are not observing databases dynamically, you can run this script on a Database folder or
individual database objects. Dynamic observation monitors all databases regardless of target
resource object.

Default Schedule
The default interval for this script is Every 30 minutes.

46 SQL Server Knowledge Scripts


Setting Parameter Values
Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_DBLocks job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL server fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Raise event if database is Select Yes to raise an event if a database is offline. The default is unselected.
offline?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is offline that is raised when a database is offline. The default is 15.

Raise event if database is Select Yes to raise an event if a database is deleted. The default is unselected.
deleted?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is deleted that is raised when a database is deleted. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Database Locks

Dynamically observe Select Yes to dynamically observe databases at each monitoring interval. The
databases at each interval? default is unselected.

NOTE: Dynamic observation monitors all databases regardless of target resource


object.

SQL Server Knowledge Scripts 47


Description How to Set It

Specify list of databases to Specify the name of the databases you want to exclude from monitoring,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from monitoring.

NOTE: Enter each database on a separate line.

The databases specified in the file are excluded even if dynamic monitoring is not
enabled.

You can use standard pattern-matching characters when specifying database


names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Include database locks Select to Yes to include a report of the number of database locks in the events
report in events? generated for this script. The default is Yes.

Include database locks Select Yes to include a report of the number of database locks in the data for
report in data? charts and reports. The default is Yes.

Maximum locks to report (0 Set the maximum number of locks you want the script to report on for events and
for maximum) data. The default is 0.

Exclude monitoring Select Yes to exclude monitoring the availability group databases that are under
availability group databases the SQL Server instance. The default is unselected.
under SQL Server
instance?

Event Notification

Raise event if locks Select Yes to raise an event when the number of locks for a database exceeds
exceed threshold? the threshold. The default is Yes.

Event severity when locks Set the event severity level, from 1 to 40, to indicate the importance of an event in
exceed threshold which the number of locks held exceeds the threshold. The default is 5.

Threshold -- Maximum Specify the maximum number of locks that can be held on a database before an
number of database locks event is raised. The default is 10 locks.

Data Collection

Collect data for number of Select Yes to collect data for charts and reports. If enabled, data collection returns
database locks? the number of locks held on a database, and identifies the application and user
holding each lock. The default is unselected.

48 SQL Server Knowledge Scripts


3.11 DBMirrorStatus
Use this Knowledge Script to monitor the status of each mirrored database. This script raises an
event if one of the selected factors associated with the mirrored database changes, such as the
mirror state, mirror role, or mirror partner, or if a new database is added or removed from mirroring.

Resource Objects
Microsoft SQL Server

Default Schedule
The default interval for this script is Every 10 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise events if job fails Select Yes to raise an event if the SQLServer_DBMirrorStatus job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise events if SQL Select Yes to raise an event if login to SQL Server fails. The default is Yes.
Server login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor DB Mirroring

Event Notification

Raise an event if Mirror Set to Yes to raise an event if the Mirror State changes. The default is Yes.
State changes?

SQL Server Knowledge Scripts 49


Description How to Set It

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
State changes the Mirror State changes. The default severity level is 5 (red event indicator).

Raise an event if Mirror Set to Yes to raise an event if the Mirror Role or the Mirror Role Sequence
Role or Sequence changes. The default is Yes.
changes?

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Role or Sequence changes the Mirror Role or the Mirror Role Sequence changes. The default severity level is
5 (red event indicator).

Raise an event if Mirror Set to Yes to raise an event if the Mirror Safety Level changes. The default is Yes.
Safety Level changes?

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Safety Level changes the Mirror Safety Level changes. The default severity level is 5 (red event
indicator).

Raise an event if Mirror Set to Yes to raise an event if the Mirror Safety Sequence changes. The default is
Safety Sequence Yes.
changes?

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Safety Sequence changes the Mirror Safety Sequence changes. The default severity level is 5 (red event
indicator)

Raise an event if Mirror Set to Yes to raise an event if the Mirror Partner changes. The default is Yes.
Partner changes?

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Partner changes the Mirror Partner changes. The default severity level is 5 (red event indicator).

Raise an event if Mirror Set to Yes to raise an event if the Mirror Witness changes. The default is Yes.
Witness changes?

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Witness changes the Mirror Witness changes. The default severity level is 5 (red event indicator).

Raise an event if Mirror Set to Yes to raise an event if the Mirror Witness State changes. The default is
Witness State changes? Yes.

Event severity when Mirror Set the event severity level, from 1 to 40, to indicate the importance of the event if
Witness State changes the Mirror Witness State changes. The default severity level is 5 (red event
indicator)

Raise an event if no Set to Yes to raise an event if no mirrored databases are found. The default is No.
mirrored databases
found?

Event severity when no Set the event severity level, from 1 to 40, to indicate the importance of the event if
mirrored databases found no mirrored databases are found. The default severity level is 25 (blue level
indicator).

Raise an event if a new Set to Yes to raise an event if a new database is mirrored. The default is Yes.
database is Mirrored?

Event severity when a new Set the event severity level, from 1 to 40, to indicate the importance of the event if
database is Mirrored a new database is mirrored. The default severity level is 25 (blue level indicator).

Raise an event if a Set to Yes to raise an event if a database is removed from mirroring. The default
database is removed from is Yes.
Mirroring?

50 SQL Server Knowledge Scripts


Description How to Set It

Event severity when a Set the event severity level, from 1 to 40, to indicate the importance of the event if
database is removed from a database is removed from mirroring. The default severity level is 5 (red event
Mirroring indicator).

Data Collection

Collect data for Database Select Yes to collect data for the role of a Mirrored database. If selected, data
Mirroring Role? collection returns the following:

 100-- if the database is principal


 0-- if the database is mirror
The default is unselected.

Custom data stream legend Specify a custom data stream legend to append with the default data legend for
the job that is visible in the console. You can specify a maximum of 128
alphanumeric characters in a string, including special characters. The default is
none.

3.12 DBStats
Use this Knowledge Script to monitor the amount of allocated space used by the data and the log
files. Separate thresholds are available for the files whose size is set as auto-grow and for those
whose size is not set as auto-grow.

If a file is not set as auto-grow, the percentage of used space is compared to the total space allocated
for the file. This script then raises an event if the percentage of used space exceeds the threshold you
specify.

If a file is set as auto-grow and a maximum file size is specified in the SQL Server, the percentage of
used space is compared to the maximum file size is specified in the SQL Server. This script then
raises an event if the percentage of used space exceeds the threshold you specify.

If a file is set to auto-grow and maximum file size is configured as 'Unrestricted File Growth' in SQL
Server, then no event is raised. However, data collection collects the details for the file size compared
to the total database file size allocated.

NOTE: .

To run this Knowledge Script, you need public and read-only permissions on all the databases that
are to be monitored.

You can monitor availability group databases on secondary replica only if the Readable Secondary
option is configured as Yes for secondary replica.

Resource Objects
SQL Server instance or Database folder, if dynamically observing databases. If you are not observing
databases dynamically, you can run this script on the Database folder or on individual database
objects.

If you run the script on a individual database object, only that object is monitored regardless of how
you set the Dynamically observe databases at each interval? parameter.

SQL Server Knowledge Scripts 51


Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_DBStats job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Raise event if database is Select Yes to raise an event if a database is offline. The default is unselected.
offline?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is offline that is raised when a database is offline. The default is 15.

Raise event if database is Select Yes to raise an event if a database is deleted. The default is unselected.
deleted?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is deleted that is raised when a database is deleted. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Data Space

Dynamically observe Select Yes to dynamically observe databases at each monitoring interval. The
databases at each interval? default is unselected.

NOTE: Dynamic observation monitors all databases regardless of target


resource object.

52 SQL Server Knowledge Scripts


Description How to Set It

Exclude monitoring loading Select Yes to exclude the monitoring of the SQL Server databases that are in
or restoring databases loading or restoring state under the SQL Server instance. The default is
under SQL Server unselected.
instance?

Specify list of databases to Specify the name of the databases you want to exclude from monitoring,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from monitoring.

NOTE: Enter each database on a separate line.

The databases specified in the file are excluded even if dynamic monitoring is not
enabled.

You can use standard pattern-matching characters when specifying database


names:matches zero

 * or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Exclude monitoring Select Yes to exclude the monitoring of the availability group databases that are
availability group databases under the SQL Server instance. The default is unselected.
under SQL Server
instance?

Event Notification

Raise event if used data Select Yes to raise an event if the used data space value exceeds the threshold
space exceeds you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
data space exceeds which the used data space value exceeds the threshold. The default is 5.
threshold

Threshold -- Maximum Specify the maximum percentage of data space that can be used before an event
percentage of used data is raised. The percentage usage of data space is compared to the total space
space if database can grow available for the database in SQL Server. The default is 90%.

Threshold -- Maximum Specify the maximum percentage of data space that can be used before an event
percentage of used data is raised. The percentage usage of data space is compared to the space
space if database cannot allocated for the data space, The default is 90%.
grow

SQL Server Knowledge Scripts 53


Description How to Set It

Raise event if used data Select Yes to raise an event if the used data space value falls below the threshold
space falls below you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
data space falls below which the data space value that is currently in use falls below the threshold. The
threshold default is 5.

Threshold -- Minimum used Specify the minimum disk space in MB that is required for the data. If the amount
data space of disk space falls below this threshold, an event is raised.The default is 0 MB.

Raise event if used log Select Yes to raise an event if the used log space value exceeds the threshold
space exceeds you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
log space exceeds which the used log space value exceeds the threshold. The default is 5.
threshold

Threshold -- Maximum Specify the maximum percentage of log space in comparison to the maximum log
percentage of used log space specified in the SQL Server, that can be used before an event is raised.
space if log space can grow The default is 90%.

Threshold -- Maximum Specify the maximum percentage of log space in comparison to the total log
percentage of used log space specified in the SQL Server, that can be used before an event is raised.
space if log space cannot The default is 90%.
grow

Raise event if used log Select Yes to raise an event if the used log space value falls below the threshold
space falls below you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
log space falls below which the used log space value that is currently in use falls below the threshold.
threshold The default is 5.

Threshold -- Minimum used Specify the minimum disk space in MB that is required for the database’s log
log space space. If the amount of disk space falls below this threshold, an event is
raised.The default is 0 MB.

Raise event if total used Select Yes to raise an event if the total used database space exceeds threshold
database space exceeds you specify. The default is Yes.
threshold?

Event severity when total Set the event severity level, from 1 to 40, to indicate the importance of an event in
used database space which the total used database space exceeds the threshold. The default is 5.
exceeds threshold

Threshold- Maximum Specify the maximum percentage of total used database space, that can be used
percentage of total used before an event is raised. The default is 90%.
database space

Raise event if total Select Yes to raise an event if the total available database space falls below the
available database space threshold you specify. The default is Yes.
falls below threshold?

Event severity when total Set the event severity level, from 1 to 40, to indicate the importance of an event in
available database space which the total used database falls below the threshold. The default is 5.
falls below threshold

54 SQL Server Knowledge Scripts


Description How to Set It

Threshold- Minimum total Specify the minimum total database space that is required for the data. If the
database space available amount of database space falls below this threshold, an event is raised.The
default is 0 MB.

Data Collection

Collect data for data Select Yes to collect data for charts and reports. If enabled, data collection
utilization (%)? returns the percentage of allocated data space that is currently in use. The default
is unselected

Collect data for allocated Select Yes to collect data for charts and reports. If enabled, data collection
data space (MB)? returns the data space size in MB that is currently allocated for a specific
database. The default is unselected.

Collect data for used data Select Yes to collect data for charts and reports. If enabled, data collection
space (MB)? returns the data space size in MB that is currently in use for a specific database.
The default is unselected.

Collect data for log Select Yes to collect data for charts and reports. If enabled, data collection
utilization (%)? returns the percentage of allocated log space that is currently in use. The default
is unselected

Collect data for allocated Select Yes to collect data for charts and reports. If enabled, data collection
log space (MB)? returns the log space size in MB that is currently allocated for a specific database.
The default is unselected.

Collect data for used log Select Yes to collect data for charts and reports. If enabled, data collection
space (MB)? returns the log space size in MB that is currently in use for a specific database.
The default is unselected.

Collect data for total Select Yes to collect data for charts and reports. If enabled, data collection
database size (MB)? returns the size of the total database in MB. The default is unselected.

Collect data for total Select Yes to collect data for charts and reports. If enabled, data collection
database space utilization returns the percentage of total database space used. The default is unselected.
(%)?

Collect data for total Select Yes to collect data for charts and reports. If enabled, data collection
database space available returns the available database space in MB. The default is unselected
(MB)?

3.13 ErrorLog
Use this Knowledge Script to monitor the SQL Server error logs (Errorlog, Errorlog.* in the SQL
Server log folder). Ensure that the user has read permission to this files/folders.

On the first job iteration, this script sets a starting point for next iteration log scanning and does not
scan the existing entries in the logs. As a result, it does not return any results on the first iteration. As
it continues to run at the interval specified in the Schedule tab, this script looks for any error log
entries that have appeared since the last monitoring interval.

This script looks for the matching log text you specified in the Log text to match parameter. If you
disable the Literal match? parameter, log text containing any of the words you specified is considered
a match. This script raises an event if the number of entries that match the Log text to match criteria
exceeds the threshold you specify.

SQL Server Knowledge Scripts 55


Resource Objects
SQL Server instance

Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_ErrorLog job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor Error Log

Log text to match Specify all or part of the string you want to check for. Separate multiple search
strings with commas.

The default is Wait-for graph.

NOTE: The text string Wait-for graph can be used to catch deadlocks that
might occur on the SQL Server instance you are monitoring. However, if this
string is used, the SQL Server instance must have additional tracing enabled. For
more information, see Microsoft Knowledge Base article 832524.

Literal match? Select Yes if you want to search for the entire search string. For example, if you
set this parameter to Yes and specify “foo bar” as the search string, only lines
containing “foo bar” are considered a match. The default is Yes.

Select No to match any of the words in the Log text to match parameter value.
For example, if you set this parameter to No and specify “foo bar” as the search
string, any lines that contain “foo,” “bar,” or “foo bar” are considered a match.

Case-sensitive? Select Yes to match upper and lower case letters when checking for a match to
the search string. The default is No.

Text to exclude Specify a string or series of strings that you want to exclude from the search
results. Use comma to separate multiple strings.

Event Notification

56 SQL Server Knowledge Scripts


Description How to Set It

Raise event if number of Select Yes to raise an event if new log entries are found. The default is Yes.
new log entries exceed
threshold? NOTE: In general, the detail message for the Knowledge Script contains details
about the occurrences found. If the message is larger than 32 KB, the data is
saved in a file on the managed computer in the \NetIQ\AppManager\bin folder,
and the detail message contains the truncated data. If you generate these log
files, you should periodically remove the files when you are done with them.

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
number of new log entries which the number of new log entries exceed the threshold. The default is 5.
exceed threshold

Threshold -- Maximum Specify the number of entries that can be logged before an event is raised. The
number of new log entries default is 0.

Data Collection

Collect data for number of Select Yes to collect data for the new log entries for charts and reports. If
new log entries? enabled, data collection returns the number of new event log entries.The default
is unselected.

3.14 LogShipping
Use this Knowledge Script to monitor log shipping status. Log shipping is a process in which
transaction logs from a primary Microsoft SQL Server are applied sequentially on a scheduled basis
to another Microsoft SQL Server.

On the first job iteration, this script sets a starting point for future log scanning and does not scan the
existing entries in the logs. Therefore, it does not return any results on the first iteration. As it
continues to run at the interval specified in the Schedule tab, this script scans the logs for any new
entries created since the last time it checked.

This script raises an event if the number of successful log shipping records exceeds the threshold you
specify, and if log shipping fails for any reason.

Resource Objects
Microsoft SQL Server instances

Default Schedule
The default interval for this script is Every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_LogShipping job fails
unexpectedly? unexpectedly. The default is Yes.

SQL Server Knowledge Scripts 57


Description How to Set It

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor Log Shipping

Event Notification

Raise event if number of Select Yes to raise an event if the number of successful log shipping records
successful log shipped exceeds threshold. The default is Yes.
records exceeds
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
number of successful log which the number of successful log shipping records exceeds the threshold you
shipped records exceeds specify. The default is 25.
threshold

Threshold- Maximum Specify the maximum number of successful log shipping records that can be
number of successful log found before an event is raised. The default is 100 entries.
shipped records

Raise event if number of Select Yes to raise an event if the number of log shipping records that failed
failure log shipped exceeds the threshold. The default is Yes.
records exceeds
threshold?

Exclude monitoring of the Select Yes to exclude the monitoring of the backup errors of SQL Server
backup errors? databases. The default is unselected.

IMPORTANT: This parameter is effective only when the Raise event if number of
failure log shipped records exceeds threshold? parameter is selected.

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
number of failure log which the number of log shipping that failed exceeds the threshold you specify.
shipped records exceeds The default is 5
threshold

Threshold- Maximum Specify the maximum number of log shipping records that can fail before an event
number of failure log is raised. The default is 0.
shipped records

Data Collection

Collect data for successful Select Yes to collect data for successful log shipping records for charts and
records of log shipping? reports.The default is unselected.

Collect data for failure Select Yes to collect data for failed log shipping records for charts and reports.
records of log shipping? The default is unselected.

Custom data stream legend Specify a custom data stream legend to display in the Graph Data tab.

58 SQL Server Knowledge Scripts


3.15 LogSpace
Use this Knowledge Script to monitor a database’s available log space and used log space. This
script raises an event if the available log space falls below the threshold you specify, or if the
percentage of log space used exceeds the threshold you specify.

You can set this script to observe new databases dynamically each time it runs. Observing databases
dynamically allows you to monitor log space for newly created SQL Server databases since you ran
the Discovery_SQLServer Knowledge Script and prevents you from attempting to monitor databases
that have been dropped since discovery.

NOTE

 Although this script can observe new databases each time it runs, the new databases are not
reflected in the Operator Console or Control Center.
 To run this Knowledge Script, you need public and read-only permission on all the databases
that are to be monitored.
 You can monitor availability group databases on secondary replica only if the Readable
Secondary option is configured as Yes for secondary replica.

Resource Objects
System or User Databases

If you are not observing databases dynamically, you can run this script on a Database folder or
individual database objects. Dynamic observation monitors all databases regardless of target
resource object.

Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_LogSpace job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Raise event if database is Select Yes to raise an event if a database is offline. The default is unselected.
offline?

SQL Server Knowledge Scripts 59


Description How to Set It

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is offline that is raised when a database is offline. The default is 15.

Raise event if database is Select Yes to raise an event if a database is deleted. The default is unselected.
deleted?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event
database is deleted that is raised when a database is deleted. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Log Space

Dynamically observe Select Yes to dynamically observe databases at each monitoring interval. The
databases at each interval? default is unselected.

NOTE: Dynamic observation monitors all databases regardless of target


resource object.

Exclude monitoring loading Select Yes to exclude the monitoring of the SQL Server databases that are in
or restoring databases loading or restoring state under the SQL Server instance. The default is
under SQL Server unselected.
instance?

Specify list of databases to Specify the name of the databases you want to exclude from monitoring,
exclude (comma- separated by commas.
separated)
You can use standard pattern-matching characters when specifying database
names:

 * matches zero or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

60 SQL Server Knowledge Scripts


Description How to Set It

Specify file path containing Specify the full file path of .csv or .txt format file that contains the name of the
list of databases to exclude databases that you want to exclude from monitoring.

NOTE: Enter each database on a separate line.

The databases specified in the file are excluded even if dynamic monitoring is not
enabled.

You can use standard pattern-matching characters when specifying database


names:matches zero

 * or more instances of a previous character


 ? matches exactly one instance of a previous character
 \d matches any single digit from 0 - 9
 [ ] matches exactly one instance of any character between the brackets,
including ranges

Exclude monitoring Select Yes to exclude the monitoring of the availability group databases that are
availability group databases under the SQL Server instance. The default is unselected.
under SQL Server
instance?

Event Notification

Raise event if used log Select Yes to raise an event if the used log space value exceeds the threshold
space exceeds you specify. The default is Yes.
threshold?

Event severity when used Set the event severity level, from 1 to 40, to indicate the importance of an event in
log space exceeds which the used log space value exceeds the threshold. The default is 5.
threshold

Threshold -- Maximum Specify the maximum percentage of log space that can be used before an event
percentage of used log is raised. The default is 90%.
space

Raise event if available Select Yes to raise an event if the available log space value falls below the
log space falls below threshold you specify. The default is Yes.
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
available log space falls which the available log space value falls below the threshold. The default is 5.
below threshold

Threshold -- Minimum Specify the minimum disk space in MB that is required for the database’s log
available log space space. If the amount of disk space falls below this threshold, an event is
raised.The default is 0 MB.

Data Collection

Collect data for used log Select Yes to collect data about the used log space for charts and reports. If
space? enabled, data collection, returns the percentage of log space used for each
database. The default is unselected.

Collect data for available Select Yes to collect data about the available log space for charts and reports. If
log space? enabled, data collection, returns the available log space in MB. The default is
unselected.

SQL Server Knowledge Scripts 61


3.16 MemUtil
Use this Knowledge Script to monitor the amount of memory used by Microsoft SQL Server
processes: sqlservr, sqlagent, and sqlexec. This script raises an event if memory usage exceeds the
maximum threshold you set, and if the number of free buffer pages falls below the minimum threshold
you set.

Resource Object
Microsoft SQL Server

Default Schedule
The default schedule for this script is Every 10 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_MemUtil job fails unexpectedly.
unexpectedly? The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor memory
utilization

Event Notification

Raise event if memory Select Yes to raise an event if the amount of memory used by the server process
usage exceeds and the agent process exceeds the threshold. The default is Yes.
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
memory usage exceeds which the amount of memory used by the server process and the agent process
threshold exceeds the threshold. The default is 5.

Threshold- Maximum Specify the maximum amount of memory that can be used by a server process
memory used by server before an event is raised. The default is 2000 MB.
process

Threshold- Maximum Specify the maximum amount of memory that can be used by an agent process
memory used by agent before an event is raised. The default is 75 MB.
process

62 SQL Server Knowledge Scripts


Description How to Set It

Raise event if server Select Yes to raise an event if the amount of server memory used by Microsoft
memory usage exceeds SQL Server and all related processes exceeds the threshold. The default is Yes.
threshold?

Event severity when server Set the event severity level, from 1 to 40, to indicate the importance of an event in
memory usage exceeds which the amount of memory used by Microsoft SQL Server and all related
threshold processes exceeds the threshold. The default is 5.

Threshold- Maximum Specify the maximum amount of memory that can be consumed by Microsoft
server memory used SQL Server and all related processes before an event is raised. The default is
3000 MB.

Raise event if number of Select Yes to raise an event if the number of free buffer pages falls below the
free buffer pages are threshold. The default is unselected.
below threshold?
NOTE: This parameter is applicable for a version prior to SQL Server 2012.

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
number of free buffer pages which the number of free buffer pages falls below the threshold. The default is 5.
are below threshold

Threshold- Minimum Specify the minimum number of buffer pages that must be free to prevent an
number of free buffer pages event from being raised. The default is 50 pages.

Raise event if free Select Yes to raise an event if the free memory available with Microsoft SQL
memory is below Server falls below threshold. The default is unselected.
threshold?
NOTE: This parameter is applicable for SQL Server 2012 or a later version.

Event severity when free Set the event severity level, from 1 to 40, to indicate the importance of an event in
memory is below threshold which the free memory available with Microsoft SQL Server falls below threshold.
The default is 5.

Threshold- Minimum free Specify the amount of memory that must be free with Microsoft SQL Server to
memory prevent an event from being raised. The default is 100 MB.

Data Collection

Collect data for maximum Select Yes to collect maximum memory used data for charts and reports. If
memory used? enabled, data collection returns the maximum amount of memory used by the
server process and the agent process.

Collect data for server Select Yes to collect server memory used data for charts and reports. If enabled,
memory used? data collection returns the amount of memory used by Microsoft SQL Server and
all related processes.

Collect data for number of Select Yes to collect the number of free buffer pages for charts and reports. If
free buffer pages? enabled, data collection returns the number of buffer pages that are available.

NOTE: This parameter is applicable for a version prior to SQL Server 2012.

Collect data for free Select Yes to collect the free memory of Microsoft SQL Server for charts and
memory? reports. If enabled, data collection returns the amount of free memory available
with Microsoft SQL Server.

NOTE: This parameter is applicable for SQL Server 2012 or a later version.

SQL Server Knowledge Scripts 63


3.17 MonitorJobs
Use this Knowledge Script to monitor the SQL Server scheduled jobs that have not successfully
completed. You can specify the jobs to monitor. By default, this script raises events for the jobs that
failed since the time you specify prior to the first iteration and thereafter for new jobs failure since the
last monitoring interval. In addition, if the number of failed jobs exceeds the threshold you specify, an
event is raised.

NOTE: To run this Knowledge Script, you need the SQL Server Select permission on sysjobs and
sysjobservers tables of the msdb database.

Resource Objects
SQL Server instance

Default Schedule
The default interval for this script is every 10 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_MonitorJobs job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Raise event if job is Select Yes to raise an event if a job is running on SQL Express Server. The
running on SQL Express default is unselected.
Server?
SQL Server jobs are not compatible with SQL Express Server. Therefore, if a
database has an instance running SQL Express Server, AppManager raises an
event that the job is running on SQL Express Server.

Event severity when job is Set the event severity level, from 1 to 40, to indicate the importance of an event
running on SQL Express that is raised when a database is offline. The default is 15.
Server

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

64 SQL Server Knowledge Scripts


Description How to Set It

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor SQL Jobs

Specify list of jobs to Specify the names of jobs to include in monitoring. Separate multiple names with
monitor (comma-separated) a comma. Only specified job names are included in data collection and have
events raised if job failures are detected. You can use the SQL wildcard
characters (% and _) to specify the names of the jobs. For example, if you specify
App%, the jobs that start with App will be monitored.

By default, all jobs are monitored.

Monitor only new failed Select Yes to monitor the failed jobs since the last monitoring interval. The default
jobs? is Yes.

Specify the time prior to first Specify the time (in minutes) prior to first iteration from which you want to monitor
iteration from which failed the failed jobs. For example, if you set the time as 20 minutes, the Knowledge
jobs are monitored Script starts monitoring for the failed jobs starting from 20 minutes before the first
iteration. The default time is 10 minutes.

Number of SQL jobs to Specify the number of SQL jobs that a report can contain. The default is 20. Enter
include in report 0 to display all SQL jobs.

Include detail report in data Select Yes to include a detail report in the data points collected for charts and
points? reports. The default is unselected.

Event Notification

Raise event if failed Select Yes to raise an event if the number of job failures exceeds the threshold.
monitor jobs exceed The default is Yes.
threshold?

Event severity when failed Set the event severity level, from 1 to 40, to indicate the importance of an event in
monitor jobs exceed which the number of failed jobs exceeds the threshold. The default is 5.
threshold

Threshold - maximum failed Specify the maximum number of failed jobs that can be detected before an event
monitor jobs is raised. The default is 0 job.

Data Collection

Collect data for failed Select Yes to collect data for the total number of failed jobs for charts and reports.
monitor jobs? If enabled, data collection returns the number of jobs that have failed, including
the job name and the reason for the failure. The default is unselected.

3.18 NearMaxConnect
Use this Knowledge Script to monitor the SQL Server user connections utilization. This script
compares the number of user connections that are currently in use to the maximum number of
concurrent connections configured for the SQL Server. This script raises an event if the percentage of
user connections that are currently in use exceeds the threshold you set.

SQL Server Knowledge Scripts 65


NOTE: To run this Knowledge Script, you need public and view server state SQL Server
permissions

If you have not configured the maximum user connections in the SQL Server then this script does not
collect any data.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Once every hour.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_NearMaxConnect job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor User Connection Utilization

Event Notification

66 SQL Server Knowledge Scripts


Description How to Set It

Raise event if SQL Server Select Yes to raise an event if you have configured the Maximum number of
is configured for concurrent connections option in SQL Server properties as unlimited. The
unlimited concurrent default is Yes.
connections?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event in
Server is configured for which Maximum number of concurrent connections option in SQL Server
unlimited concurrent properties is configured as unlimited. The default is 25.
connections

Raise event if user Select Yes to raise an event if the percentage of user connections used
connection utilization compared to the maximum number of connections configured for the SQL Server
exceeds threshold? exceeds the threshold. The default is Yes.

Event severity when user Set the event severity level, from 1 to 40, to indicate the importance of an event in
connection utilization which the percentage of user connections used exceeds the threshold. The
exceeds threshold default is 5.

Threshold - Maximum Specify the maximum percentage of user connections that can be in use before
percentage of user an event is raised. The default is 95%.
connections utilized

Data Collection

Collect data for user Select Yes to collect data for the percentage of SQL Server user connections that
connections utilization? are currently in use for charts and reports. The default is unselected.

3.19 NearMaxLocks
Use this Knowledge Script to monitor the Locks utilization of SQL Server. This script compares the
used number of Locks to the maximum available Locks configured for the SQL Server. This script
raises an event if the percentage of Locks that are currently in use exceeds the threshold you set.

Monitors the used number of locks compared to the maximum available locks configured for the SQL
Server.

NOTE: To run this Knowledge Script, you need public and view server state SQL Server
permissions

If you have not configured the maximum number of Locks in the SQL Server then you cannot use this
script to collect data.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Once every hour.

SQL Server Knowledge Scripts 67


Setting Parameter Values
Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_NearMaxLocks job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Locks Utilization

Event Notification

Raise event if SQL Server Select Yes to raise an event if you have configured the Locks option in SQL
is configured for Server properties as unlimited. The default is Yes.
unlimited available
Locks?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event in
Server is configured for which the Locks option in SQL Server properties is configured as unlimited. The
unlimited available Locks default is 25.

Raise event if Locks Select Yes to raise an event if the percentage of locks that are currently in use
utilization exceeds exceeds the threshold. The default is Yes.
threshold?

Event severity when Locks Set the event severity level, from 1 to 40, to indicate the importance of an event in
utilization exceeds which the percentage of Locks exceeds the threshold. The default is 5.
threshold

Threshold - Maximum Specify the maximum percentage of locks that can be in use before an event is
percentage of Locks utilized raised. The default is 95%.

68 SQL Server Knowledge Scripts


Description How to Set It

Data Collection

Collect data for Locks Select Yes to collect data for the percentage of locks that are currently in use for
utilization? charts and reports. The default is unselected.

3.20 RunSql
Use this Knowledge Script to run SQL statements or stored procedures. You can enter the SQL
Server statements to be executed when you run this script, or you can load the statements from a
script file and specify a full path to the file you want to use.

You can set maximum and minimum thresholds to be compared against the SQL Server statement’s
primary output value--either the number of rows returned, or the value found in the column you
specified. This script raises an event if the output value exceeds the maximum threshold or falls
below the minimum threshold you set.

When constructing a SQL statement for use with this script, include the database name in the syntax.

For example:

select categoryid from Northwind.dbo.categories

This script might encounter problems if you employ the USE command to qualify queries.

For example:

use mydatabase select * from mytable.

Instead, specify select * from mydatabase.dbo.mytable to fully qualify queries.

AppManager does not provide a syntax-checking mechanism. Syntax checking is performed by the
SQL Server on the monitored server when the job is run. If an error is detected, the SQL Server
passes an error to the Knowledge Script.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Every 5 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_RunSql job fails unexpectedly.
unexpectedly? The default is Yes.

SQL Server Knowledge Scripts 69


Description How to Set It

Event severity when job fails Set the event severity level, from 1 to 40, to indicate the importance of an event
unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server.
You can either select Windows Authentication or SQL Server Authentication.
The default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default
is none.

For more information on specifying user name, see Section 2.7.3, “Specifying
the User Name in the Knowledge Script,” on page 21.

Monitoring

Timeout Specify the number of seconds to wait while trying to establish a SQL connection
before terminating the attempt and raising a timeout exception. The default is 30
seconds.

Number of retries Specify the number of times the script should retry establishing a SQL
connection before terminating the attempt. The default is 0 (no retry attempts).

SQL query or command Select one of the following options:.


source
 Parameter: Select this option if you want to enter the T-SQL query as a
single-line statement.
 File: Select this option if you want to specify the file path that contains the
list of SQL queries.

SQL query or command If you have selected the Parameter option in SQL query or command source,
statement enter a single-line statement here.

IMPORTANT: This parameter does not accept multi-line statements.

TIP: Unless you are entering very simple statements, you might find that typing
them into this field is error-prone. To avoid errors, you can copy and paste
statements, or use the Full path to SQL query or command file parameter.

70 SQL Server Knowledge Scripts


Description How to Set It

Full path to SQL query or If you have selected the File option in SQL query or command source, enter
command file the complete file path.

For example, F:\NetIQ Corporation\Sample.txt, or


\\<computer>\<dir>\Sample.txt.

NOTE: The T-SQL statements in the file must be separated by semi-colons.

For more information, see “Loading SQL Server Statements From a Script File”
on page 73.

You cannot use a UNC path if the NetIQ AppManager Client Resource Monitor
service is running as a system account.

Specify a description for the Specify a description for the SQL query that you want to display in the event
SQL query detail message. By default, the description is Detail result of query.

Save query results to a Select Yes to save the query results to a file. By default, query results are not
file? saved to a file.

Full path to results file If you are saving query results to a file, enter the complete file path and filename.
For example, F:\NetIQ Corporation\QueryResult, or
\\<computer>\<dir>\QueryResult.

You cannot use a UNC path if the NetIQ Corporation AppManager Client
Resource Monitor service is running as a system account.

Append to results file? Select Yes to append the results of the query to the existing contents of the
results file. If disabled, the results file is overwritten each time.

By default, the contents of the results file are appended each time a query or
command is run.

Number of rows to write to Specify the number of rows to write to the result file. The default is 10.
results file

Include query results in Select Yes to include the results of your query or command in the event detail
event details? message.

By default, query results are included.

Number of rows to display in Specify the number of rows to display in the event detail message.
event details
The default is 10 rows.

NOTE: You can enter 0 to indicate all rows. However, the event detail message
has a 32-KB limit.

Include query results in Select Yes to include the results of your query in the data detail message.
data details?
By default, query results are included.

Number of results to display Specify the number of rows to display in the data detail message.
in data details
The default is 10 rows.

NOTE: Enter 0 to indicate all rows. However, the event detail message has a 32-
KB limit.

Event notification

SQL Server Knowledge Scripts 71


Description How to Set It

Threshold type Select whether you want to perform threshold checking on one of the following:

 Number of rows returned: Perform threshold checkin on the number of


rows returned by the command or query. If the number of rows exceeds the
maximum threshold or falls below the minimum threshold, an event is
raised.
 Value in column number: Perform threshold checking on the value found
in a column, specified by the number of the column. Column numbers start
with 0 for the leftmost column. If the value in the specified column exceeds
the maximum threshold or falls below the minimum threshold, an event is
raised.
 Value in column name: Perform threshold checking on the value found in
a column, specified by the name of the column. If the value in the specified
column exceeds the maximum threshold or falls below the minimum
threshold, an event is raised.

Column number If the threshold is comparing values found by column number, indicate the
column number to use as the primary output value. The column you specify must
contain numeric data. A value of 0 returns the first column from the SQL
statements. Any other positive value returns the value for the first row of data
from the specified column. If the specified column is not a numeric field, an error
is raised and the Knowledge Script returns a -1 result. If you do not select by
column number, you can select by column name. The default is 0.

NOTE: You should execute your query in SQL Query Analyzer to ensure that the
proper rows and number of columns are returned. The leftmost column is
column zero. Also note that if a query is doing a “Select * ...“ and if the table
schema changes, the column numbering might change.

Named Column If the threshold is comparing values found by column name, indicate the column
name to use as the primary output value. The column you specify must contain
numeric data. The value for the first row of data in the specified column is
returned. If the specified column is not a numeric field, an error is raised and the
Knowledge Script fails.

Raise event if maximum Select Yes to raise an event when the T-SQL statements run by this script return
threshold is exceeded? more rows than the threshold, or if the value in the specified column exceeds the
threshold you set.

The default is Yes.

Event severity when Set the severity level, from 1 to 40, to indicate the importance of an event in
maximum threshold which the maximum threshold is exceeded.
exceeded
The default is 5.

Threshold -- Maximum Specify the maximum number of rows that can returned by the query or for the
value found in the column. If the number of rows exceeds the threshold value, an
event is raised. The default is 100.

Raise event if minimum Select Yes to raise an event when the T-SQL statements run by this script return
threshold is not met? fewer rows than the threshold, or if the value in the specified column falls below
the threshold value you set.

The default is Yes.

Event severity when Set the severity level, from 1 to 40, to indicate the importance of an event in
minimum threshold not met which the minimum threshold is not met.

The default is 5.

72 SQL Server Knowledge Scripts


Description How to Set It

Threshold -- Minimum Specify the minimum number of rows that can be returned by the query or for the
value found in the column. If the number of rows falls below the threshold value,
an event is raised.

The default is 0.

Event detail options

Raise event for SQL Select Yes to raise an event when your query generates a Microsoft SQL Server
Server informational informational message.
messages?
The text of the message is returned in the event detail message. This option is
helpful when SQL Server returns the query result as an informational message
rather than as data. For example, when using the dbcc checktable command.

By default, this script does not raise an event under these conditions.

Event severity for SQL Set the severity level, from 1 to 40, to indicate the importance of an event in
Server informational which a SQL Server information message is generated.
messages
The default is 35.

Raise event if no rows are Select Yes to raise an event if no rows are returned.
returned?
The default is unselected.

Data Collection

Collect data for number of Select Yes to collect the number of rows returned by your query. If this
rows returned? parameter is set to Yes and the value returned is -1 or any negative number, an
error occurred while attempting to collect data.

By default, this script does not collect data.

Custom data stream legend Specify a custom legend for the data stream returned by this Knowledge Script.

Loading SQL Server Statements From a Script File


Because these SQL Server statements are passed through the ODBC driver, you do not need to
enter the go statements normally required in the command line tool, osql. Example of a simple SQL
Server script:

SELECT COUNT(*) FROM QBD.dbo.Event


WHERE ParentEventId IS NOT NULL AND Status = 0;
SELECT EventID, JobID, MachineName, KPName, Severity, Occurrence,
ModificationTime, EventMsg FROM QDB.dbo.Event
WHERE ParentEventId IS NOT NULL AND Status = 0

3.21 ServerDown
Use this Knowledge Script to monitor the up or down status of SQL Server. If the SQL Server or agent
services are down, this script raises an event and optionally, attempts to start the services.

This script can also identify the downtime of the SQL Server since the server was started. This
information is returned in the event detail message.

Resource Object
SQL Server instance

SQL Server Knowledge Scripts 73


Default Schedule
The default interval for this script is Every five minutes.

Setting Parameter Values


Set the following parameters as needed:

NOTE: The ServiceDown Knowledge Script does not raise any event or collect data for agent service
for SQL Server Express Edition, because it does not monitor the agent service for SQL Server
Express edition.

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_ServerDown job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Monitor Server State

Restart SQL Server Select Yes to automatically restart SQL Server if it is detected down. The default
automatically if down? is Yes.

Event Notification

Raise event if service Select Yes to raise an event if a restart service fails or succeeds. The default is
restart fails or succeeds? Yes.

Event severity when service Set the event severity level, from 1 to 40, to indicate the importance of an event in
restart fails which the service is down and AppManager for Microsoft SQL Server cannot
restart it. The default is 5.

Event severity when service Set the event severity level, from 1 to 40, to indicate the importance of an event in
restart succeeds which the service is down and AppManager for Microsoft SQL Server
successfully restarted it. The default is 25.

Raise event if service Select Yes to raise an event if service down time exceeds the threshold you
down time exceeds specify. The default is unselected.
threshold?

Event severity when service Set the event severity level, from 1 to 40, to indicate the importance of an event in
down time exceeds which the service down time exceeds the threshold you set. The default is 5.
threshold

Threshold - Maximum Specify the maximum time in minutes that a service can be down before an event
service down time is raised. The default is 5 minutes.

74 SQL Server Knowledge Scripts


Description How to Set It

Raise event if SQL Select Yes to raise an event if the SQL Server’s server or agent service is
Server’s server or agent disabled. The default is unselected.
service is disabled?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event in
Server’s server or agent which the SQL Server’s server or agent service is disabled. The default is 15.
service is disabled

Raise event if SQL Select Yes to raise an event if the SQL Server’s server or agent service does not
Server’s server or agent exist. The default is unselected.
service does not exist?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event in
Server’s server or agent which the SQL Server’s server or agent service does not exist. The default is 25.
service does not exist

Data Collection

Collect data for server Select Yes to collect data for the total number of hours the server was down for
downtime? charts and reports. If enabled, data collection returns the number of hours the
server has been down since it was started. The default is unselected.

3.22 SQLClusterOwner
Use this Knowledge Script to determine the node ownership of a SQL Server failover cluster
instance. This script raises an event if the cluster owner node is changed. In addition, this script
generates data streams for ownership status.

Resource Object
Microsoft SQL Server instance

Default Schedule
The default interval for this script is Every 5 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_SQLClusterOwner job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL server fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

SQL Server Knowledge Scripts 75


Description How to Set It

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method to access SQL Server. You can either select
Windows Authentication or SQL Server Authentication. The default is Windows
Authentication.

User name Specify the Windows or SQL Server user name to access SQL Server. You can
specify multiple users separated by a comma. The default is none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Failover Cluster

Event Notification

Raise event if owner node Select Yes to raise an event if the cluster owner is changed. The default is Yes.
is changed?

Event severity when owner Set the event severity level, from 1 to 40, to indicate the importance of an event in
node is changed which the cluster owner has changed. The default is 15.

Raise event to show the Select Yes to raise an event to display the cluster owner in the first iteration. The
owner node in first default is unselected.
iteration?

Event severity to show the Set the event severity level, from 1 to 40, to indicate the importance of an event to
owner node in first iteration display the cluster owner in the first iteration. The default is 25.

Raise event if job is not Select Yes to raise an event if the job is not applicable for the cluster. The default
applicable? is Yes.

Event severity when job is Set the event severity level, from 1 to 40, to indicate the importance of an event in
not applicable which the job is not applicable for the cluster. The default is 25.

Data Collection

Collect data for owner node Select Yes to collect cluster owner node status data for charts and reports. The
state? default is unselected.

3.23 TopResourceUsers
Use this Knowledge Script to monitor the total CPU time used by Microsoft SQL Server users, the
number of read and write operations performed by SQL Server users. This script also monitors the
total number of locks held by all SQL Server users, and the number of memory pages that can be
allocated to all SQL Server users. This script raises an event if the value exceeds the threshold you
set.

NOTE: To run this Knowledge Script, you need public and view server state SQL Server
permissions. If you do not have these permissions, the Knowledge Script does not display any error,
but the data returned is not complete. To get complete data, you must have these permissions.

76 SQL Server Knowledge Scripts


Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Every 5 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_TopResourceUsers job fails
unexpectedly? unexpectedly. The default is Yes.

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor Top Resources Usage

Applications to exclude Specify the names of the applications you want to exclude from monitoring.
Separate multiple names by commas (,) and no spaces. The default value is
SQLAgent.

If an application name literally matches the pattern you specify, then all the
applications that contains the specified name will be excluded.

For example, if you enter SQLAgent, and have applications, such as then
SQLAgent, SQLAgent - Job invocation engine, and SQLAgent - Generic
Refresher, then all these applications are not monitored.

SQL Server Knowledge Scripts 77


Description How to Set It

Number of rows to display Specify the number of rows to display in the event or data detail message.
in event/data detail
The default is 100 rows. You can specify a maximum of 5000 rows.

NOTE: You can enter 0 to indicate all rows. However, the event detail message
has a 32-KB limit.

Include results in event Select Yes to include the results in the event detail message.
details?
By default, query results are included.

Include results in data Select Yes to include the results in the data detail message.
details?
By default, query results are not included.

Event Notification

Raise event if CPU time Select Yes to raise an event if CPU time exceeds threshold. By default, raising an
used exceeds threshold? event is enabled.

Include most expensive Select Yes to display the queries that consumed maximum CPU time and
queries based on CPU and elapsed time. The default is unselected.
elapsed time?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
maximum threshold which CPU time exceeds the threshold. The default severity level is 5.
exceeded

Threshold - Maximum CPU Specify the maximum amount of CPU time that can be used before an event is
time used raised. The default is 9999999 milliseconds.

Raise event if IO Select Yes to raise an event if the number of IO operations exceeds threshold. By
operations exceed default, raising an event is enabled.
threshold?

Include most expensive Select Yes to display the queries that performed highest IO operations. The
queries based on IO default is unselected.
operations?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
maximum threshold which the number of IO operations exceeds the threshold. The default severity
exceeded level is 5.

Threshold - Maximum Specify the maximum number of IO operations that can be used before an event
number of IO operations is raised. The default is 9999999 operations.

Raise event if number of Select Yes to raise an event if the number of locks held exceeds threshold. By
locks held exceeds default, raising an event is enabled.
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
maximum threshold which the number of locks held exceeds the threshold. The default severity level
exceeded is 5.

Threshold - Maximum user Specify the maximum number of user locks that can be held before an event is
locks raised. The default is 1000 locks.

Raise event if allocated Select Yes to raise an event if allocated memory exceeds threshold. By default,
memory exceeds raising an event is enabled.
threshold?

78 SQL Server Knowledge Scripts


Description How to Set It

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
maximum threshold which allocated memory exceeds the threshold. The default severity level is 5.
exceeded

Threshold - Maximum Specify the maximum amount of memory that can be allocated before an event is
memory allocated raised. The default is 15000 pages.

Data Collection

Collect data for CPU time Select Yes to collect data for charts and reports. If enabled, data collection
used? returns the total amount of CPU time used. By default, data collection is disabled.

Collect data for number of Select Yes to collect data for charts and reports. If enabled, data collection
IO operations? returns the number of read and write operations used by SQL Server users.

Collect data for number of Select Yes to collect data for charts and reports. If enabled, data collection
locks held? returns the total number of locks held by SQL Server users. By default, data
collection is disabled.

Collect data for number of Select Yes to collect data for charts and reports. If enabled, data collection
memory pages allocated? returns information about the total number of memory pages allocated to SQL
Server users. By default, data collection is disabled.

3.24 UserConnections
Use this Knowledge Script to monitor the total number of SQL Server user connections. This script
raises an event if the total number of SQL Server user connections exceeds the threshold you
specify.

NOTE: To run this Knowledge Script, you need public and view server state SQL Server
permissions. If you do not have these permissions, the Knowledge Script does not display any error,
but the data returned is not complete. To get complete data, you must have these permissions.

Resource Object
SQL Server instance

Default Schedule
The default interval for this script is Every 30 minutes.

Setting Parameter Values


Set the following parameters as needed:

Description How to Set It

General Settings

Job Failure Notification

Raise event if job fails Select Yes to raise an event if the SQLServer_UserConnections job fails
unexpectedly? unexpectedly. The default is Yes.

SQL Server Knowledge Scripts 79


Description How to Set It

Event severity when job Set the event severity level, from 1 to 40, to indicate the importance of an event
fails unexpectedly that is raised when the job fails unexpectedly. The default is 5.

Raise event if SQL Server Select Yes to raise an event if login to SQL Sever fails. The default is Yes.
login fails?

Event severity when SQL Set the event severity level, from 1 to 40, to indicate the importance of an event
Server login fails that is raised when the login to SQL server fails. The default is 15.

Additional Settings

Event Details

Event detail format Select the format in which you want to display the event detail. You can select
from HTML Table or Plain Text. The default is HTML Table.

Authentication Select the authentication method that you want to use to access SQL Server. You
can either select Windows Authentication or SQL Server Authentication. The
default is Windows Authentication.

User name Specify the Windows or SQL Server user name that you want to use to access
SQL Server. You can specify multiple users separated by a comma. The default is
none.

For more information on specifying user name, see Section 2.7.3, “Specifying the
User Name in the Knowledge Script,” on page 21.

Monitor User Connections

Number of user Specify the number of user connections to display in the event detail message.
connections to include in Enter 0 to display all connections. The default is 20 user connections.
report

Include results in data Select Yes to include the results in the data detail message.
details?
By default, query results are not included.

Event Notification

Raise event if number of Select Yes to raise an event if the number of user connections exceeds the
connections exceeds threshold. The default is Yes
threshold?

Event severity when Set the event severity level, from 1 to 40, to indicate the importance of an event in
threshold exceeds which the number of user connections exceeds the threshold. The default is 5.

Threshold -- Maximum Specify the maximum number of user connections that are allowed before an
number of user connections event is raised. The default is 100 connections.

Data Collection

Collect data for total Select Yes to collect data for charts and reports. If enabled, data collection
number of user returns the total number of SQL Server user connections. The default is
connections? unselected.

80 SQL Server Knowledge Scripts


3.25 Recommended Knowledge Script Groups
You can find the SQLServer Knowledge Script Groups (KSGs) on the RECOMMENDED tab of the
Knowledge Script pane in the Operator Console.

All the scripts in the KSGs have their parameters set to recommended values. To run all of the
recommended scripts in a KSG at one time, click the RECOMMENDED tab, and then run the KSG on
a SQL Server resource.

The SQLServer KSGs enable a “best practices” usage for monitoring your SQL Server environment.
You can use these KSGs with AppManager monitoring policies. A monitoring policy lets you efficiently
and consistently monitor all the resources in your environment using a set of preconfigured
Knowledge Scripts. For more information, see “About Policy-Based Monitoring” in the AppManager
Help.

A KSG is composed of a subset of a module’s Knowledge Scripts. The script that belongs to a KSG is
a different copy of the original script you access from the SQLServer tab. If you modify a script that
belongs to a KSG, the parameter settings of the original script in the SQLServer tab are not affected.

In some cases, default script parameter settings are different when the script is deployed as part of a
KSG, as opposed to when it is deployed alone. The default settings of a script within a group depend
on its monitoring purpose within the larger group, and on the intended monitoring scope of that group.

If you modify or remove a script associated with the SQLServer KSG and want to restore it to its
original form, you can reinstall the AppManager For SQLServer module on the repository computer or
check in the appropriate script from the AppManager\qdb\kp\SQLServer directory.

The following Knowledge Scripts are members of the SQLServer recommended KSG to monitor SQL
Server:

 Accessibility
 BlockedProcesses
 CacheHitRatio
 Connectivity
 DBLocks
 DBStats
 MonitorJobs
 ServerDown
 TopResourceUsers
 UserConnections

SQL Server Knowledge Scripts 81


82 SQL Server Knowledge Scripts
4 Troubleshooting AppManager for
4

Microsoft SQL Server

This chapter describe how to troubleshoot AppManager for Microsoft SQL Server.

4.1 Enabling dynamic logging for a Knowledge Script


job
When you run a Knowledge Script and the job fails or encounters an error, you should stop the
Knowledge Script job, check out the script, and then modify the PRM_TraceLevel variable to the
desired logging level (Off, Fatal, Error, Warn, Info, Debug, or All) to enable tracing. By default, the
PRM_TraceLevel variable is Warn. After that the Knowledge Script must be checked in and run
again. In the process, the monitoring job gets interrupted and the data is lost.

To avoid the above situation, you can enable dynamic logging for a job while the job is running.

IMPORTANT: The dynamic logging for a Knowledge Script is applicable only when the value of the
PRM_TraceLevel variable is Warn.

To enable dynamic logging:

1 Identify the jobs for which dynamic logging need to be enabled.


2 Open the Registry Editor.
3 Go to the following location:
 For 64-bit agent:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Netiq\AppManager\4.0\NetIQmc\Traci
ng
 For 32-bit agent:
HKEY_LOCAL_MACHINE\SOFTWARE\Netiq\AppManager\4.0\NetIQmc\Tracing
4 Right-click inside the Tracing folder and click New > String Value to add a String key.
5 Specify a name for the String key. The key name should be either the child job ID or
SQLServer. If you want to enable dynamic logging for a particular job that has the child job ID as
40, specify 40 as the key name. If you specify SQLServer as the key name, the dynamic logging
is enabled for the all the SQL Server jobs on the managed client.

NOTE: You can add String key for each job for which dynamic logging need to be enabled. For
example, if you want to enable dynamic logging for three jobs only that have child IDs 50, 55,
and 62, create three separate String keys as 50, 55, and 62 respectively.

6 Double-click the String key that you have added in step 4 and specify the desired Logging level
(Off, Fatal, Error, Warn, Info, Debug, or All) in the Value data field.

Troubleshooting AppManager for Microsoft SQL Server 83


NOTE
 If you have added a String key as SQLServer and another String key as 40, the dynamic
logging for the job 40 will be in accordance with the logging level specified in the String key
40.
 If you delete the String key SQLServer and the String key 40, the logging level for the job 40
returns to Warn, which is the default value.

4.2 Determining the non-default port for SQL Server


or Availability Group Listener
If the SQL Server instance or Availability Group Listener is configured to a non-default port, you can
determine the port and use the same port in the AppManager Security Manager so that the discovery
is successful.

To determine the non-default port for a SQL Server:

1 Run the SQL Server Configuration Manager.


2 Select the SQL Server Network Configuration.
3 Select the instance for which you want to determine the port.
4 Right-click the TCP/IP protocol and select Properties.
5 Click IP Addresses.
6 In IP All, see the port number in the TCP Port field.

To determine the non-default port for an Availability Group Listener:

1 Expand the Availability Group Listeners node.


2 Right-click the listener, and select the Properties.
3 In the Port field, see the port number.

84 Troubleshooting AppManager for Microsoft SQL Server

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy