What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Here's a weird one for you regarding monitoring services

Votes:

0

Hi there,

We have SQL servers with multiple SQL instances. When we reach the maximum of 50, we create a new server, but sometimes, we remove one freeing up a slot on a server. I would like to know if I could add a probe per machine that would tell me how many SQL instance services are running in order to know if we're capped on a specific server?

Thank you

probe service sql

Created on May 12, 2016 2:42:35 PM



8 Replies

Votes:

0

Wouldn't every instance need a seperate configuration file? You could simply count the amount of configs per server and work with limits, if I got this right :)

Created on May 13, 2016 10:21:50 AM by  Stephan Linke [Paessler Support]

Last change on May 13, 2016 10:22:01 AM by  Stephan Linke [Paessler Support]



Votes:

0

Thanks for the reply. The problem is that sometimes, the configurations files (as well as other files) stay on the server after removing an instance, so this would lead to a miscalculation as opposed to counting the active services.

Created on May 13, 2016 12:28:30 PM



Votes:

0

Ah, conditional as well! ;) A ssh script sensor might work as well:

#!/bin/bash
##############
# uncomment the command available on the system
##############
#count=$(pgrep -c mysqld)
#count=$(ps -C mysqld --no-headers | wc -l)

echo "0:$count:Active SQL daemons: $count"

That should actually do the trick :)

Created on May 13, 2016 12:51:01 PM by  Stephan Linke [Paessler Support]



Votes:

0

My apologies, I did not specify the version of SQL we are using. It's SQL Express 2008 R2, not MySQL. How would you go about and modify this command? Also, I did not know I could add these sort of commands in PRTG.

Created on May 13, 2016 1:34:17 PM



Votes:

0

Oh okay. What would be the following PowerShell script:

param($computer)
$Count = (Get-Service -Name "MSSQL*" -ComputerName $computer).Count
Write-Host "$($Count):Active SQL services: $($Count)"; 

Save it to
C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\Count-MSSQL-Instances.ps1 ... and create a new EXE/Script sensor on the SQL host. Use %host as the only parameter.

Notes

  • Execute Set-ExecutionPolicy RemoteSigned in a elevated 32bit PowerShell if you don't have any custom script sensors yet.
  • Make sure the device has administrative Windows credentials configured

Created on May 13, 2016 1:56:18 PM by  Stephan Linke [Paessler Support]

Last change on May 13, 2016 1:56:44 PM by  Stephan Linke [Paessler Support]



Votes:

0

Thank you. We'll give this a try today or next week and let you know the results.

Created on May 13, 2016 1:58:58 PM



Votes:

0

Update: Ya, powershell was too much of a pain to configure with security and everything. My college found a workaround by running this script with a simple WMI custom script: SELECT COUNT(*) FROM Win32_Process WHERE Name='sqlservr.exe'

Thanks anyway :)

Created on May 13, 2016 7:43:25 PM



Votes:

0

Alright then :) Couldn't figure out how to do the COUNT(*) statement in WQL, it always error'd on me :D

Created on May 16, 2016 6:29:35 AM by  Stephan Linke [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.