Hello,

I would like to monitor one Database SpaceLog with PRTG.

When I query this SQLPERF : "DBCC SQLPERF(logspace)" on my database I have row/culumn fullfil with log space and log size.

So I try to add some elements to this SQL Script to adapt it for PRTG

declare @LogSpace table
(
DatabaseName varchar(255),
[LOG_SIZE] decimal,
[LOG_SPACE] decimal,
[Status] int)

insert into @LogSpace
execute('dbcc sqlperf(''LogSpace'')')

select * from @LogSpace
WHERE DatabaseName = 'MY_DATABASE'

When I put query this I get something interesting. It works like charm. To configure the sensor I follow this KB: https://helpdesk.paessler.com/en/support/solutions/articles/76000063495-how-do-i-monitor-the-size-of-a-microsoft-sql-server-database

I create Microsoft SQL v2 sensor, I choose the SQL script (show just before) and I put Data Processing option, Absolute, Culumn name, BytesDisk, etc.

PRTG sensor return this : "No valid datatable was returned"

I don't know what am I doing wrong.

Thank you for your help,

Best Regards.


Article Comments

Hi,

You need to use temporary tables, declare statements won't work in that case. The following should be helpful: https://www.simple-talk.com/sql/t-sql-programming/temporary-tables-in-sql-server/


Kind regards,
Stephan Linke, Tech Support Team


Jun, 2017 - Permalink