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

EXE/SCRIPT ADVANCED SENSOR Parameter/Variables

Votes:

0

I am looking to use the EXE/SCRIPT ADVANCED SENSOR to run a number of SPs but the SPs have parameters/variables. In the PRTG sensors parameter settings box how would I state my parameter/variable that the SP needs to run?

exe-script-advanced-sensor parameters sql-sp

Created on Jul 23, 2015 12:36:47 PM



29 Replies

Votes:

0

Just like you would call it from the command line :)

Created on Jul 24, 2015 6:44:46 AM by  Stephan Linke [Paessler Support]



Votes:

0

Could you give an example? At the moment I use the following in the parameter box. What do I add to the end to set my parameter for the sp?

-d= database name -sp= SP name -s= server -u= username -p= password -sa

Created on Jul 24, 2015 6:53:39 AM



Votes:

0

Then your parameter field just has to look a little something like this: -d=database -sp=SPname -s=%host -u=username -p=password -sa

Let me know if that works :)

Created on Jul 24, 2015 7:08:24 AM by  Stephan Linke [Paessler Support]



Votes:

0

Yes that is currently what I have but I would like to know what I can add to the string to tell my sensor to call a parameter/variable that has been set in my sp?

I am making generic sp's and my plan is to have one or more parameters in the sp which will let me change the type of information I want as an output.

Created on Jul 24, 2015 7:14:44 AM



Votes:

0

Pardon, what do you mean by SP?

Created on Jul 24, 2015 7:47:02 AM by  Stephan Linke [Paessler Support]



Votes:

0

Stored Procedure. I want to use the EXE/SCRIPT ADVANCED SENSOR to call an SP in our database but the SP has a parameter in it that needs to be stated when calling it.

Sorry for any confusion.

Created on Jul 24, 2015 7:52:33 AM



Votes:

0

Ah - and you want that parameter to be dynamic? You could add the necessary parameters in the sensor comments, little example:

-d=database -sp='CALL %comments' -s=%host -u=username -p=password -sa

The %comments placeholder will then be replaced with the value of the sensor comment - it can be entered by heading to the tab with the small chat bubble on the sensor page.

Created on Jul 24, 2015 8:01:14 AM by  Stephan Linke [Paessler Support]

Last change on Jul 24, 2015 8:01:24 AM by  Stephan Linke [Paessler Support]



Votes:

0

Okay thank you I see. So in the small chat bubble I state the sp name and the parameter that needs to be set?

Created on Jul 24, 2015 8:12:26 AM



Votes:

0

Correct :)

Created on Jul 24, 2015 8:18:03 AM by  Stephan Linke [Paessler Support]



Votes:

0

That's great thank you.

Created on Jul 24, 2015 9:01:59 AM



Votes:

0

You're very welcome :)

Created on Jul 24, 2015 9:10:18 AM by  Stephan Linke [Paessler Support]



Votes:

0

I have now put in place my SP's but am having problems with this. I have put -d=database -sp='CALL %comments' -s=%host -u=username -p=password -sa in the setting and setup the comments tab with

EXEC SP Name and then my parameters @parameter1, @parameter2

But I get an error saying Could not find stored procedure 'CALL'. Any advise on what I'm doing wrong?

Created on Aug 13, 2015 11:14:17 AM



Votes:

0

Have you tried double quotes (like this: ") around the SP parameter yet?

Created on Aug 13, 2015 11:47:45 AM by  Stephan Linke [Paessler Support]



Votes:

0

Stephan is right, if a parameter contains a white space, the OS will think that these are actually two parameters.

Keeping them together you need to use -sp="CALL %comments%"

Created on Aug 13, 2015 11:53:10 AM



Votes:

0

Yes I got the error Could not find stored procedure 'CALL %comments'.

Created on Aug 13, 2015 12:10:03 PM



Votes:

0

Are the comments entered within the sensor or the device? Strange that it's not getting replaced...

Created on Aug 13, 2015 12:37:36 PM by  Stephan Linke [Paessler Support]



Votes:

0

Ah okay thanks. Well I have tried it like so -sp="CALL%comments%" and still get an error (Could not find stored procedure 'CALL%comments%'.)

Any chance this might be due to what I have in the comments tab?

If so what should I include in the comments tab? Currently I have it layed out as follows:

EXEC sp name @parameter1, @parameter2

Created on Aug 13, 2015 12:46:17 PM



Votes:

0

The correct syntax would be this: -sp="CALL %comments"

Note the whitespace between CALL and the placeholder and that there's only one %, preceeding the placeholders. The comments have to be like this: EXEC sp name @parameter1, @parameter2

Created on Aug 13, 2015 1:51:14 PM by  Stephan Linke [Paessler Support]



Votes:

0

Thanks I have tried both exactly as you have suggest above but still no luck.

Created on Aug 13, 2015 2:03:14 PM



Votes:

0

scratch that...

Created on Aug 14, 2015 11:05:22 AM by  Stephan Linke [Paessler Support]

Last change on Aug 17, 2015 5:32:38 AM by  Stephan Linke [Paessler Support]



Votes:

0

I'm not quite sure what you mean by test button. My steps to get to this problem are:

-Add a EXE/Script Advanced sensor to my chosen Device (the device doesn't have any real config it is set to 127.0.0.1) -set the EXE/Script field to SQLspXML.exe -Input -d=database -sp="CALL %comments" -s=%host -u=username -p=password -sa in the Parameters field -click save -open the comments tab and input EXEC sp name @parameter1, @parameter2

Created on Aug 14, 2015 11:34:24 AM



Votes:

0

are you able to offer any further advice on this? I'm currently running the most up to date version of PRTG.

Created on Aug 17, 2015 4:09:53 PM



Votes:

0

Sorry, my bad - seems like %comments isn't parsed in the parameters...You might want to use a wrapper script that reads out the comment via API:

http://your-prtg-server/api/getobjectproperty.htm?id=2043&name=comments&show=text&username=prtguser&passhash=prtgpasshash

...and then executes it accordingly.

Created on Aug 18, 2015 6:25:16 AM by  Stephan Linke [Paessler Support]



Votes:

0

okay how would I set this up? Do you have some steps to do this?

Created on Aug 18, 2015 8:29:26 AM



Votes:

0

Something like this: http://pastebin.com/G9t05hS3 It will read the current comment and execute your SQLspXML.exe with the given parameters, and output the result of it (it should, at least) :) The passhash can be obtained from the account settings within PRTG.

Created on Aug 18, 2015 8:49:27 AM by  Stephan Linke [Paessler Support]

Last change on Aug 18, 2015 8:49:45 AM by  Stephan Linke [Paessler Support]



Votes:

0

alright thank you. Do you have an example of the body for the wrapper script?

Created on Sep 6, 2015 9:45:35 AM



Votes:

0

What body do you mean?

Created on Sep 7, 2015 6:25:04 AM by  Stephan Linke [Paessler Support]



Votes:

0

Don't worry have got this working now by using the following info:

Using the optional –cp= parameter, it is possible to pass a comma separated list of parameters to your stored procedure. Parameters and their value need to be separated by a | e.g. -cp="@Firstname|Jane,@LastName|Doe,@Age|26"

Created on Sep 7, 2015 10:31:40 AM



Votes:

0

Alright, glad that you got it working now :)

Created on Sep 7, 2015 10:37:11 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.