SlideShare a Scribd company logo
1 of 22
Monitoring Microsoft SQL Server 2008 with Opsview




Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence   2
Introduction
• This blog post takes a deep-dive into monitoring
  Microsoft SQL Server 2008 with Opsview V4. In order to
  monitor MS SQL 2008 (known hereon as SQL2K8), we will
  have to leverage Opsview’s ability to support Nagios
  plugins which can be found on the Exchange.Nagios.org
  website.

• If you don’t already have Opsview installed, visit our
  website and download Opsview Core (free), Opsview
  Pro (30 day trial) or request a trial to Opsview
  Enterprise.

                                                                    3
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Initial Setup
• First we will need to monitor a few services. To do this
  we can use the Opsview guide “Monitoring Windows
  Services”.
• The main 3 SQL services we may wish to monitor are:
• MSSQLSERVER – “SQL Service server”
• SQLSERVERAGENT – “SQL Server agent”
• SQLBrowser – “SQL Server Browser”




                                                                    4
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Firstly login to Opsview and navigate to “SETTINGS >
  SERVICE CHECKS” and scroll down to “Database - MS SQL
  Server” where we can find a few pre-configured checks.
• We will need to modify these checks to include the
  correct service names (as above). For example, the
  service check for “MS SQL Server Service” should have
  arguments of:

“ -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll
MSSQLSERVER=started' ”




                                                                    5
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Once these services have been created, we
  should have the following:
   Name                     Arguments
   MS SQL Agent Service     check_nrpe -H $HOSTADDRESS$ -c
                            nsc_checkservicestate -a 'ShowAll
                            SQLSERVERAGENT=started'

   MS SQL Browser           check_nrpe -H $HOSTADDRESS$ -c
                            nsc_checkservicestate -a 'ShowAll
                            SQLBrowser=started'

   MS SQL Server Listener   check_tcp -H $HOSTADDRESS$ -p 1433 -w 2 -c 5

   MS SQL Server Service    check_nrpe -H $HOSTADDRESS$ -c
                            nsc_checkservicestate -a 'ShowAll
                            MSSQLSERVER=started'




                                                                           6
Tuesday, 07 August 2012     © Opsview Ltd. Commercial in Confidence
Configuration
• Now we have the basic checks, lets add more “in-depth”
  monitoring.
• In order to do this, we are going to need a plugin from
  the Nagios Exchange called “Check MSSQL Database
  Stats”, from the link here.
• Download the .py script, and copy it to the folder
  /usr/local/nagios/libexec.
• Once there, do:
“chown nagios:nagios check_mssql_database.py”,



• then
                                                                    7
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
“chmod 755 check_mssql_database.py”.


• This will now show up in our service checks as a plugin.
• In order to run the plugin on the platform, we will need
  to install a small plugin called “pymssql”. To do this,
  follow the instructions below:

UBUNTU/DEBIAN: sudo apt-get install python-pymssql RHEL:            yum
install pymssql (Some repos have it python-pymssql)


Once this plugin is installed, we can run a check on our MS
SQL server to make sure we can access it. To do this, run a
command similar to the one below, but with your
information added:
                                                                          8
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
./check_mssql_database.py -H ipaddress -U username -P password -T
_Total -p 1433



• This command works as follows:
• “-H” is the ip address or hostname of the server on which
  the MS SQL Server 2008 install resides. Important: the
  username and password (-U and –P respectively) are
  the”SQL SERVER AUTHENTICATION” login details, and
  not the “Windows authentication” login details.




                                                                    9
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Generally, the admin username will be “sa” for example.
  –T specifies the table name; with the operator “_Total”
  telling the query to look at all tables, and finally, -p
  specifies the port number – generally 1433.




                                                                    10
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• If the command works, you should see the following
  output:

OK:Time to connect is 0.004s|Time_to_connect=0.004s;;;;


• If not, you may need to review the login details, if you
  see something similar to the following:

CRITICAL:Unable to access SQL Server.


• As mentioned, the above output was obtained by using
  the AD credentials and not the SQL server credentials to
  try and access the box.
                                                                    11
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Once we have the “OK..” message, we can begin to query
  the SQL server from within Opsview. So now we can login
  to Opsview again (if closed), and begin to create our
  service checks.
• To do this, go to “SETTINGS > SERVICE CHECKS” and click
  the plus sign in the top left corner.
• In this example, we are going to monitor the size of the
  database. To do this, use the plugin we just installed, and
  add the arguments, similar to those ran earlier, but with
  the “-H $HOSTADDRESS$” variable, and the
  %DATABASE% attribute, for scalability. We'll explain these
  later on in the guide.
                                                                    12
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration




• With the full arguments field reading:

-H $HOSTADDRESS$ -U sa -P password11! -T %DATABASE% -p 1433 -
-datasize -w 70000 -c 99000

                                                                    13
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• The key differentiator from hereon are the options after
  “-p 1433..”. We are specifying here we want to monitor “-
  -datasize” (so size of DB), and that we want to be warned
  if we go above 70000KB, (yellow alert in Opsview) and
  critical alert on 99000KB or more (Red in Opsview). For
  the full list of operators, see the bottom of this guide.
• Now we have created our service check (we can do the
  above for all the operators, where applicable), we now
  need to add them to our MS SQL host. But before we can
  do that, we need to add the attribute “%DATABASE%”
  first.
• To do this, go to “SETTINGS > Attributes” and click the
  plus sign

                                                                    14
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• In the “Name” box, enter “DATABASE”, and click “submit
  changes”, it is that simple!




• Next, we must create this host via “SETTINGS > HOST”
  and click the “plus” sign at the top left.
• Populate all the fields appropriately, using the IP address
  of the server on which the SQL DB is running on.
                                                                    15
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Once done, click onto the “MONITORS” tab. Here is
  where we will assign our new service checks to our host,
  as below:




                                                                    16
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Once we have added our monitors, click “ATTRIBUTES”,
  and select in the dropdown box our new attribute,
  “DATABASE”.
• In the value field, enter the name of your database - or if
  you want to monitor all, we can use the “_Total”
  operator.
• Finally, click submit, and now have our SQL Server 2008
  host created, with the attribute specified, and all our
  new service checks enabled.




                                                                    17
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration
• Now this is done, we just need to reload opsview due to
  the configuration changes using “SETTINGS -> APPLY
  CHANGES”




• And Opsview will reload, your new host will be available
  and will be monitoring your new service checks, as on
  the following slide (with a lot more service checks):

                                                                    18
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Configuration




                                                                    19
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Reference:
• On the following slide are the options which can be
  applied to the command, as per the output of the
  command ./check_mssql_database.py -h I have also
  added a “arguments” section.




                                                                    20
Tuesday, 07 August 2012   © Opsview Ltd. Commercial in Confidence
Reference
 Option                   Arguments                                             Notes
 --activetrans            -H $HOSTADDRESS$ -U sa -P password11!                Monitors # of active transactions,
                          -T %DATABASE% -p 1433 --activetrans -w                warns on over 5, and critical on
                          5 -c 10                                               over 10 transactions.
 --datasize               -H $HOSTADDRESS$ -U sa -P password11!                Monitors size of database, warns
                          -T %DATABASE% -p 1433 --datasize -w                   on over 70000kb, critical on
                          70000 -c 99000
                                                                                99000Kb
 --logcachehit            -H $HOSTADDRESS$ -U sa -P password11!                Monitors log cache hit in %. Less
                          -T %DATABASE% -p 1433 --logcachehit -w                than 50% gives us critical, less
                          75: -c 50:
                                                                                than 75% gives warning.
 --logwait                H $HOSTADDRESS$ -U sa -P password11! -               In .ms, how long it takes to
                          T %DATABASE% -p 1433 --logwait -w 30 -c               retrieve logs.
                          50

 --loggrowths             -H $HOSTADDRESS$ -U sa -P password11!                Check Log Growths
                          -T %DATABASE% -p 1433 --loggrowths -w 5
                          -c 10

 --time2connect           -H $HOSTADDRESS$ -U sa -P password11!                Time in .ms to connect to DB.
                          -T %DATABASE% -p 1433 --time2connect -w
                          0010 -c 0050

 --transpsec              -H $HOSTADDRESS$ -U sa -P
                          password11! -T %DATABASE% -p
                          1433 --transpsec -w 20 -c 30

                                                                                                                     21
Tuesday, 07 August 2012               © Opsview Ltd. Commercial in Confidence
About Opsview
Opsview delivers a single unified view of the health of all your distributed physical,
virtual and hybrid cloud systems.

We give DevOps staff all the tools they need to get their jobs done faster, easier and
for less.

•    Opsview Enterprise offers large enterprises (+100 devices) and MSPs a certified,
     professionally supported system with enhanced functionality such as dynamic
     dashboards and reports

•    SMEs looking for feature-rich dashboards to monitor the performance of their on-
     premise, virtualized or cloud apps choose Opsview Pro

•    Opsview Core is our free, open source monitoring tool - you can test and
     customize it how you want

www.opsview.com
                                                                                         22
Tuesday, 07 August 2012       © Opsview Ltd. Commercial in Confidence

More Related Content

Similar to Monitoring Microsoft SQL Server 2008 with Opsview

End to End Monitoring using Nested Keywords
End to End Monitoring using Nested KeywordsEnd to End Monitoring using Nested Keywords
End to End Monitoring using Nested KeywordsOpsview
 
Monitoring Oracle Databases with Opsview
Monitoring Oracle Databases with OpsviewMonitoring Oracle Databases with Opsview
Monitoring Oracle Databases with OpsviewOpsview
 
Advanced reporting with Opsview
Advanced reporting with OpsviewAdvanced reporting with Opsview
Advanced reporting with OpsviewOpsview
 
VMukti SQL Server Configuration during server installation For V1034 to V1038
VMukti SQL Server Configuration during server installation For V1034 to V1038VMukti SQL Server Configuration during server installation For V1034 to V1038
VMukti SQL Server Configuration during server installation For V1034 to V1038vmukti
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidationsimplelogic
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidationsimplelogic
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidationsimplelogic
 
Monitoring Server Temperature with Opsview
Monitoring Server Temperature with OpsviewMonitoring Server Temperature with Opsview
Monitoring Server Temperature with OpsviewOpsview
 
Creating Custom Notifications in Opsview
Creating Custom Notifications in OpsviewCreating Custom Notifications in Opsview
Creating Custom Notifications in OpsviewOpsview
 
From Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your WebservicesFrom Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your Webserviceskingsfleet
 
Sql server reporting services
Sql server reporting servicesSql server reporting services
Sql server reporting servicesssuser1eca7d
 
Sqlsat154 maintain your dbs with help from ola hallengren
Sqlsat154 maintain your dbs with help from ola hallengrenSqlsat154 maintain your dbs with help from ola hallengren
Sqlsat154 maintain your dbs with help from ola hallengrenAndy Galbraith
 
Maria db audit plugin introduction v1.3
Maria db audit plugin introduction v1.3Maria db audit plugin introduction v1.3
Maria db audit plugin introduction v1.3YUCHENG HU
 
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...
SharePoint Saturday Belgium 2014 -  Best Practices for Configuring the ShareP...SharePoint Saturday Belgium 2014 -  Best Practices for Configuring the ShareP...
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...BIWUG
 
Microsoft exchange-server-2013-installation
Microsoft exchange-server-2013-installationMicrosoft exchange-server-2013-installation
Microsoft exchange-server-2013-installationtakdirlovely09
 
Aws user group #04 landing zones
Aws user group #04   landing zonesAws user group #04   landing zones
Aws user group #04 landing zonesPolarSeven Pty Ltd
 
10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor10 SQL Server Metrics to Monitor
10 SQL Server Metrics to MonitorSQLDBApros
 

Similar to Monitoring Microsoft SQL Server 2008 with Opsview (20)

End to End Monitoring using Nested Keywords
End to End Monitoring using Nested KeywordsEnd to End Monitoring using Nested Keywords
End to End Monitoring using Nested Keywords
 
Monitoring Oracle Databases with Opsview
Monitoring Oracle Databases with OpsviewMonitoring Oracle Databases with Opsview
Monitoring Oracle Databases with Opsview
 
Advanced reporting with Opsview
Advanced reporting with OpsviewAdvanced reporting with Opsview
Advanced reporting with Opsview
 
VMukti SQL Server Configuration during server installation For V1034 to V1038
VMukti SQL Server Configuration during server installation For V1034 to V1038VMukti SQL Server Configuration during server installation For V1034 to V1038
VMukti SQL Server Configuration during server installation For V1034 to V1038
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidation
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidation
 
Ms sql database consolidation
Ms sql database consolidationMs sql database consolidation
Ms sql database consolidation
 
Monitoring Server Temperature with Opsview
Monitoring Server Temperature with OpsviewMonitoring Server Temperature with Opsview
Monitoring Server Temperature with Opsview
 
Creating Custom Notifications in Opsview
Creating Custom Notifications in OpsviewCreating Custom Notifications in Opsview
Creating Custom Notifications in Opsview
 
From Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your WebservicesFrom Developer to Production, Promoting your Webservices
From Developer to Production, Promoting your Webservices
 
Sql server reporting services
Sql server reporting servicesSql server reporting services
Sql server reporting services
 
Sqlsat154 maintain your dbs with help from ola hallengren
Sqlsat154 maintain your dbs with help from ola hallengrenSqlsat154 maintain your dbs with help from ola hallengren
Sqlsat154 maintain your dbs with help from ola hallengren
 
Maria db audit plugin introduction v1.3
Maria db audit plugin introduction v1.3Maria db audit plugin introduction v1.3
Maria db audit plugin introduction v1.3
 
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...
SharePoint Saturday Belgium 2014 -  Best Practices for Configuring the ShareP...SharePoint Saturday Belgium 2014 -  Best Practices for Configuring the ShareP...
SharePoint Saturday Belgium 2014 - Best Practices for Configuring the ShareP...
 
MyRBQM Portal | v6.7 Release Notes
MyRBQM Portal | v6.7 Release NotesMyRBQM Portal | v6.7 Release Notes
MyRBQM Portal | v6.7 Release Notes
 
Microsoft exchange-server-2013-installation
Microsoft exchange-server-2013-installationMicrosoft exchange-server-2013-installation
Microsoft exchange-server-2013-installation
 
Microsoft Exchange Server 2013 Installation
Microsoft Exchange Server 2013 InstallationMicrosoft Exchange Server 2013 Installation
Microsoft Exchange Server 2013 Installation
 
Aws user group #04 landing zones
Aws user group #04   landing zonesAws user group #04   landing zones
Aws user group #04 landing zones
 
10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor
 
dbadapters
dbadaptersdbadapters
dbadapters
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Monitoring Microsoft SQL Server 2008 with Opsview

  • 1.
  • 2. Monitoring Microsoft SQL Server 2008 with Opsview Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence 2
  • 3. Introduction • This blog post takes a deep-dive into monitoring Microsoft SQL Server 2008 with Opsview V4. In order to monitor MS SQL 2008 (known hereon as SQL2K8), we will have to leverage Opsview’s ability to support Nagios plugins which can be found on the Exchange.Nagios.org website. • If you don’t already have Opsview installed, visit our website and download Opsview Core (free), Opsview Pro (30 day trial) or request a trial to Opsview Enterprise. 3 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 4. Initial Setup • First we will need to monitor a few services. To do this we can use the Opsview guide “Monitoring Windows Services”. • The main 3 SQL services we may wish to monitor are: • MSSQLSERVER – “SQL Service server” • SQLSERVERAGENT – “SQL Server agent” • SQLBrowser – “SQL Server Browser” 4 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 5. Configuration • Firstly login to Opsview and navigate to “SETTINGS > SERVICE CHECKS” and scroll down to “Database - MS SQL Server” where we can find a few pre-configured checks. • We will need to modify these checks to include the correct service names (as above). For example, the service check for “MS SQL Server Service” should have arguments of: “ -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll MSSQLSERVER=started' ” 5 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 6. Configuration • Once these services have been created, we should have the following: Name Arguments MS SQL Agent Service check_nrpe -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll SQLSERVERAGENT=started' MS SQL Browser check_nrpe -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll SQLBrowser=started' MS SQL Server Listener check_tcp -H $HOSTADDRESS$ -p 1433 -w 2 -c 5 MS SQL Server Service check_nrpe -H $HOSTADDRESS$ -c nsc_checkservicestate -a 'ShowAll MSSQLSERVER=started' 6 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 7. Configuration • Now we have the basic checks, lets add more “in-depth” monitoring. • In order to do this, we are going to need a plugin from the Nagios Exchange called “Check MSSQL Database Stats”, from the link here. • Download the .py script, and copy it to the folder /usr/local/nagios/libexec. • Once there, do: “chown nagios:nagios check_mssql_database.py”, • then 7 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 8. Configuration “chmod 755 check_mssql_database.py”. • This will now show up in our service checks as a plugin. • In order to run the plugin on the platform, we will need to install a small plugin called “pymssql”. To do this, follow the instructions below: UBUNTU/DEBIAN: sudo apt-get install python-pymssql RHEL: yum install pymssql (Some repos have it python-pymssql) Once this plugin is installed, we can run a check on our MS SQL server to make sure we can access it. To do this, run a command similar to the one below, but with your information added: 8 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 9. Configuration ./check_mssql_database.py -H ipaddress -U username -P password -T _Total -p 1433 • This command works as follows: • “-H” is the ip address or hostname of the server on which the MS SQL Server 2008 install resides. Important: the username and password (-U and –P respectively) are the”SQL SERVER AUTHENTICATION” login details, and not the “Windows authentication” login details. 9 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 10. Configuration • Generally, the admin username will be “sa” for example. –T specifies the table name; with the operator “_Total” telling the query to look at all tables, and finally, -p specifies the port number – generally 1433. 10 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 11. Configuration • If the command works, you should see the following output: OK:Time to connect is 0.004s|Time_to_connect=0.004s;;;; • If not, you may need to review the login details, if you see something similar to the following: CRITICAL:Unable to access SQL Server. • As mentioned, the above output was obtained by using the AD credentials and not the SQL server credentials to try and access the box. 11 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 12. Configuration • Once we have the “OK..” message, we can begin to query the SQL server from within Opsview. So now we can login to Opsview again (if closed), and begin to create our service checks. • To do this, go to “SETTINGS > SERVICE CHECKS” and click the plus sign in the top left corner. • In this example, we are going to monitor the size of the database. To do this, use the plugin we just installed, and add the arguments, similar to those ran earlier, but with the “-H $HOSTADDRESS$” variable, and the %DATABASE% attribute, for scalability. We'll explain these later on in the guide. 12 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 13. Configuration • With the full arguments field reading: -H $HOSTADDRESS$ -U sa -P password11! -T %DATABASE% -p 1433 - -datasize -w 70000 -c 99000 13 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 14. Configuration • The key differentiator from hereon are the options after “-p 1433..”. We are specifying here we want to monitor “- -datasize” (so size of DB), and that we want to be warned if we go above 70000KB, (yellow alert in Opsview) and critical alert on 99000KB or more (Red in Opsview). For the full list of operators, see the bottom of this guide. • Now we have created our service check (we can do the above for all the operators, where applicable), we now need to add them to our MS SQL host. But before we can do that, we need to add the attribute “%DATABASE%” first. • To do this, go to “SETTINGS > Attributes” and click the plus sign 14 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 15. Configuration • In the “Name” box, enter “DATABASE”, and click “submit changes”, it is that simple! • Next, we must create this host via “SETTINGS > HOST” and click the “plus” sign at the top left. • Populate all the fields appropriately, using the IP address of the server on which the SQL DB is running on. 15 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 16. Configuration • Once done, click onto the “MONITORS” tab. Here is where we will assign our new service checks to our host, as below: 16 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 17. Configuration • Once we have added our monitors, click “ATTRIBUTES”, and select in the dropdown box our new attribute, “DATABASE”. • In the value field, enter the name of your database - or if you want to monitor all, we can use the “_Total” operator. • Finally, click submit, and now have our SQL Server 2008 host created, with the attribute specified, and all our new service checks enabled. 17 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 18. Configuration • Now this is done, we just need to reload opsview due to the configuration changes using “SETTINGS -> APPLY CHANGES” • And Opsview will reload, your new host will be available and will be monitoring your new service checks, as on the following slide (with a lot more service checks): 18 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 19. Configuration 19 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 20. Reference: • On the following slide are the options which can be applied to the command, as per the output of the command ./check_mssql_database.py -h I have also added a “arguments” section. 20 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 21. Reference Option Arguments Notes --activetrans -H $HOSTADDRESS$ -U sa -P password11! Monitors # of active transactions, -T %DATABASE% -p 1433 --activetrans -w warns on over 5, and critical on 5 -c 10 over 10 transactions. --datasize -H $HOSTADDRESS$ -U sa -P password11! Monitors size of database, warns -T %DATABASE% -p 1433 --datasize -w on over 70000kb, critical on 70000 -c 99000 99000Kb --logcachehit -H $HOSTADDRESS$ -U sa -P password11! Monitors log cache hit in %. Less -T %DATABASE% -p 1433 --logcachehit -w than 50% gives us critical, less 75: -c 50: than 75% gives warning. --logwait H $HOSTADDRESS$ -U sa -P password11! - In .ms, how long it takes to T %DATABASE% -p 1433 --logwait -w 30 -c retrieve logs. 50 --loggrowths -H $HOSTADDRESS$ -U sa -P password11! Check Log Growths -T %DATABASE% -p 1433 --loggrowths -w 5 -c 10 --time2connect -H $HOSTADDRESS$ -U sa -P password11! Time in .ms to connect to DB. -T %DATABASE% -p 1433 --time2connect -w 0010 -c 0050 --transpsec -H $HOSTADDRESS$ -U sa -P password11! -T %DATABASE% -p 1433 --transpsec -w 20 -c 30 21 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence
  • 22. About Opsview Opsview delivers a single unified view of the health of all your distributed physical, virtual and hybrid cloud systems. We give DevOps staff all the tools they need to get their jobs done faster, easier and for less. • Opsview Enterprise offers large enterprises (+100 devices) and MSPs a certified, professionally supported system with enhanced functionality such as dynamic dashboards and reports • SMEs looking for feature-rich dashboards to monitor the performance of their on- premise, virtualized or cloud apps choose Opsview Pro • Opsview Core is our free, open source monitoring tool - you can test and customize it how you want www.opsview.com 22 Tuesday, 07 August 2012 © Opsview Ltd. Commercial in Confidence