I'm in the process of setting up the SQL Sensor v2. However when the sensor is executed it returns with and error - "No valid datatable was returned".
If the SQL query used in the sensor is executed in SQL Managment studio it does return one row with a value.
The result set is as follows:
(No column name) run_status CopyBatchData 1
Article Comments
Hi
Thank you for the response, I've got the SQL Query to work.
After correcting the query I'm experiencing the following error though.
"Invalid column name 'run_status'.
If you run it in the SQL v2 sensor outside PRTG it is working but within I get this error.
Herewith is my query for your assistance:
select 'CopyBatchData', case when run_status = '0' then '0' else '1' end as [status] from msdb.dbo.sysjobhistory where job_id = 'B2B95BEF-BBCC-4A18-A90D-947E7626AEE7' and run_date >= cast(convert(varchar(8), getdate (),112) as int) and run_time > cast ((REPLACE(CONVERT(VARCHAR(5), GETDATE(), 108), ':', '') - 100) * 100 as int) and step_id = '1'
Regards,
Aug, 2016 - Permalink
Dear SQLHead
This case should be continued as a support case. Please contat support@paessler.com. Please describe the case in that email. In your sensor settings, please enable the "Write result to disk" option in the sensor and attach the two according log files, which are usually located in "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)" to that email.
Please also include screenshots of
- the sensor overview tab
- the sensor settings tab (multiple screenshots if required to cover all settings.)
Aug, 2016 - Permalink
Dear SQLHead
The error message implies that no table, or a completely empty table (with zero rows) was returned. Please check if you perform the SQL query on the correct database.
The SQL v2 sensor can also be started outside of PRTG. In the PRTG installation folder, subfolder "Sensor System", you find the file "SQLv2.exe". You can use this file to test the database connection and result for different queries.
Aug, 2016 - Permalink