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


MSSQL Sensor Input Parameter

Votes:

0

Your Vote:

Up

Down

Hi, I would create an generell SQL Script with following query:

select sum(state + user_access + is_read_only + is_in_standby) as Status
from sys.databases
where name in ('master', 'tempdb', 'DB1', 'DB2')

Now I have used the placeholder @prtg in the query but it didn't work

select sum(state + user_access + is_read_only + is_in_standby) as Status
from sys.databases
where name in (@prtg)

On the Sensor Settings: Input Parameter: 'master', 'tempdb', 'DB1', 'DB2'

Now I geht following back: Id 3 is [DBNull]

When I only type master or DB1 in the Input Parameter it works. But I want to type more values in the paramater field.

parameters prtg sql-v2

Created on Mar 30, 2018 8:38:43 AM by  Ronald Böhm (0) 1

Last change on Apr 2, 2018 9:24:21 AM by  Felix Saure [Paessler Support]



3 Replies

Votes:

0

Your Vote:

Up

Down

Hello Ronald,

Thanks for your contacting us. I'm afraid that it's just possible to forward a single variable and no array to the SQL sensors, sorry. If you want to add up the results from different databases, you can either use a Sensor Factory Sensor, or create different .sql files for PRTG which includes the desired names.

Best regards, Felix

Created on Apr 2, 2018 9:38:02 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Ronald, not sure if it still helps you but maybe someone else does. I did solve it using parameters in xml like format (cant use < and > for obvious reasons). Then in my sql I extracted the variables. Here is a sample of sql file for SQL v2 sensor

DECLARE @input varchar(200)
DECLARE @a int
DECLARE @b int
DECLARE @c int
DECLARE @xml xml
SET @input = @prtg
SET @input = REPLACE ( @input , '{' , '<' ) 
SET @input = REPLACE ( @input , '}' , '>' ) 
SET @xml = CAST(@input AS XML)

SET @a = @xml.value('(/group/@a)[1]', 'int')  
SET @b = @xml.value('(/group/@b)[1]', 'int')  
SET @c = @xml.value('(/group/@c)[1]', 'int')  

select @a,@b,@c

Br, Karol

Created on Feb 11, 2019 7:42:45 PM by  Karol Tóth (0) 1

Last change on Feb 12, 2019 9:12:34 AM by  Karol Tóth (0) 1



Votes:

0

Your Vote:

Up

Down

Thanks for sharing, Karol! :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team

Created on Feb 11, 2019 7:47:02 PM 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.