New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Here's a weird one for you regarding monitoring services

Votes:

0

Your Vote:

Up

Down

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 by  ygravel001 (0) 1



8 Replies

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  ygravel001 (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  ygravel001 (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  ygravel001 (0) 1



Votes:

0

Your Vote:

Up

Down

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 by  ygravel001 (0) 1



Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.