I wrote VBasic the query to MSSQL gives out a mistake in job - "Response not wellformed: "(C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\Demo VBScript.vbs(10, 30) Microsoft VBScript compilation error: Expected end of statement )" (code: PE132)"
Imports System Imports System.Data.OleDb Imports System.Data.SqlClient Module Module1 Sub Main() Dim ConnectionString As String = "Persist Security Info=True;Data Source=10.1.0.142;Initial Catalog=master;Trusted_Connection=true;" Using Connection As New SqlConnection(ConnectionString) Connection.ConnectionString = ConnectionString Connection.Open() Dim sSQL As String = "select sum(s_mf.size)*8/1024 " _ & "FROM sys.master_files s_mf " _ & "WHERE db_name(s_mf.database_id) IN ('prtg');" Dim objCmd As New SqlCommand(sSQL, Connection) objCmd.ExecuteNonQuery() Connection.Close() End Using End Sub End Module
As it is correct to write inquiry to SQL to VBA-job?
Article Comments
I read API, your answer doesn't answer a question - connectingstring to base and data acquisition from procedure or from query!
Feb, 2015 - Permalink
First, your script has to create an output in the format
value:message Exit Code
so something like, as mentioned in the post before:
System.Console.WriteLine(sSQL & ":Ok")
Environment.Exit(0)
Does the script run from the commandline? If so, what are the outputs there?
Feb, 2015 - Permalink
The query might be correct, but nothing is reported back to PRTG.
What is missing is a value and message plus exit code. Something like:
In your case, this would probably read
See also the "/api.htm?tabid=7" page of your PRTG installation
Feb, 2015 - Permalink