Академический Документы
Профессиональный Документы
Культура Документы
Introduction
In an environment where you work, there is a high degree of probably that you use Microsoft SQL
Server of some version of edition to provide a database to an application. In the same environment,
theres a good chance, if you are a Microsoft shop that you are using System Center Operations
Manager (SCOM) to monitor your environments.
All good database administrators (DBAs) create jobs, plans and tasks to keep their SQL servers in tip
top shape but a lot of the time, insight as to the status of these jobs is left either unturned like an
age old stone or is done by configuring SQL Database Mail on your SQL servers so that email alerts
are generated which means you have additional configuration being done on every server to
configure this and its yet another thing to manage.
In this guide, I am going to walk you through configuring a System Center Operations Manager 2012
R2 environment to extend the monitoring of your SQL Servers to include the health state of your SQL
Server Agent Jobs, allowing you to keep an eye on not just the SQL Server platform but also on the
jobs that run to make the platform healthy.
This guide as are all my publications, dedicated to my wife Nicky and my three daughters; Madison,
Jessica and Layla who are subjected to living with me and technology and not always in that order.
Authors
Richard J Green works as a Consultant for Fordway Solutions Limited, dealing in all things Microsoft
whilst specializing in delivering System Center solutions helping customers leverage their investment
in IT through Microsoft management technologies. Richard works extensively with Windows Azure.
He has an unhealthy obsession with the colour pink hence the colour choice of this book.
You can follow Richard on Twitter @richardjgreen or read his blog at focusing on Microsoft products
and technologies along with other digital ramblings at http://richardjgreen.net.
Copyright
This book is copyright of Richard J Green and co-authors. No unauthorised copying of material in this
book shall be performed without the prior written consent of Richard Green or one of the coauthors.
2014
Contents
Introduction ............................................................................................................................................ 2
Authors.................................................................................................................................................... 2
Copyright ................................................................................................................................................. 2
Prerequisites for Configuration............................................................................................................... 4
SQL Server and SQL Server Agent ....................................................................................................... 4
SQL Server Agent Jobs......................................................................................................................... 4
System Center Operations Manager................................................................................................... 4
Configuring SQL Agent Job Monitoring................................................................................................... 5
Create a SQL Server Agent Targeting Group ....................................................................................... 5
Enable the Agent Job Object Discovery .............................................................................................. 6
Create a SQL Server Agent Job Targeting Group ................................................................................ 8
Enable Alerting for Failed SQL Server Agent Jobs ............................................................................. 10
Extra Credit Tasks .................................................................................................................................. 11
Closing Credits....................................................................................................................................... 11
As you will see from the screenshot of the group creation, the object that needs to be added is the
SQLAgent$SERVER object, where SERVER is the SQL Server server name.
If you wanted to include all SQL Servers in your environment, you could create the appropriate
Dynamic Members statement or you could ignore this step and apply the following step to All
Objects of a Class instead of to the Group.
You should then see the Object Discovery Discover SQL Server 2012 Agent Jobs job which is disabled
by default hence why we dont get the statuses for our SQL Server Agent Jobs out of the box.
Right-click this Object Discovery and select Overrides > Override the Object Discovery > For a Group
and from the group picker, select the group we created previously in the SQL Server and SQL Server
Agent step.
As you can see from this screenshot, the two servers that I included in the group have performed the
discovery of the SQL Server Agent Jobs and their status has been reported into SCOM as Healthy.
In the screenshot, there are three jobs per server, dbcc_checkdb_weekly and
defragment_indexes_weekly which are user created SQL Server Agent Jobs and
syspolicy_purge_history which is a system job.
Because syspolicy_purge_history is a system job thats only purpose is to clear down the history of
SQL Server Agent Jobs history I am not actually interested in monitoring this. Furthermore, we
probably dont want to monitor SQL Server Agent Jobs which individual administrators have chosen
to create to aid their work; we only want to monitor the company mandated jobs used for
maintaining our servers.
As shown in the screenshot above, I have started the process of creating a group however this time,
the group is based on Dynamic Membership. By using Dynamic Membership, we can define here in
the group the Job Names that we want to monitor and based on the membership of our first group,
these will automatically be targeted and will be automatically applied to all our SQL Servers.
In this Dynamic Group, I have chosen to include Or expression groups for each of the SQL Server
Agent Job versions so that should somebody later add a SQL Server to our Agent Job monitoring
group that is running a different version of SQL Server that it will still work. This is covered briefly in
the Extra Credit Tasks task at the end of this guide but not a requirement.
Once we have created our new group, we can use the View Group Members menu option in the
Groups node of the Authoring pane in the Operations Console to check that we have correctly
targeted our Classes and that everything has been detected properly.
As you can see from the image above, the user created SQL Server Agent Jobs that we designated to
be part of this Dynamic Group have been correctly detected confirming both that our Class Targeting
has been set correctly and that our expression to match the Job Name is working also.
At the Override Properties dialog as shown above in the screenshot, override the Auto-Resolve Alert
and Generate Alert Parameter Names and change both of their Override Values to True.
Once youve made these changes, select OK to apply the override.
You now have a solution in place to bring visibly to the status of your SQL Server Agent Jobs into
SCOM and you have alert generation for failures.
10
Repeat the steps in this guide for other versions of SQL Server such as SQL Server 2014 to
future-proof your efforts if someone in your environment decides to be cutting-edge and
deploys a SQL Server 2014 instance.
Configure a Notification Channel and Subscriber for the SQL Server Agent Jobs alerts and
have the alerts sent to your monitoring team or your SQL DBA team, whichever is relevant in
your environment.
Use Dynamic Membership on the first group we created in the Create a SQL Server Agent
Targeting Group step so automatically include all of your SQL Servers but just make that you
are happy that the health state of all of your SQL Servers is in a good place before you do
otherwise the people receiving your alerts might be a bit unhappy with you.
Closing Credits
I hope youve enjoyed this guide and found it helpful and please feel free to reach out to me via my
blog at http://richardjgreen.net or via Twitter at @richardjgreen if you want more information about
this guide or have any suggestions for how it could be made even better.
11