MSSSQL metricbeat module

Hi,

We want to use metricbeat mssql module, but do not know minimum priviliges for sql user. Our version MB 7.4.2,

Best regards,
Aleksandar

Hey @Aleksandar and welcome to discuss :slight_smile:

This is actually not documented, there is an open issue about doing it https://github.com/elastic/beats/issues/13006
If you have some insights on what permissions work in your case it'd be great if you could comment on this issue with this information :slightly_smiling_face:

Thanks!

Hi,

I was investigating permissions and you need next privileges:

use master
go
GRANT VIEW SERVER STATE TO [databaseuser]
GO

and public permision for all user database on server you can run this script or manuel exec this for all database create user [databaseuser] for login [databaseuser];
use master
go
DECLARE @dbname VARCHAR(50)
DECLARE @statement NVARCHAR(max)
DECLARE db_cursor CURSOR
LOCAL FAST_FORWARD
FOR
SELECT name
FROM MASTER.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb','distribution')
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @dbname
WHILE @@FETCH_STATUS = 0
BEGIN

SELECT @statement = 'use '+@dbname +';'+ 'CREATE USER [databaseuser]
FOR LOGIN [databaseuser];'

exec sp_executesql @statement

FETCH NEXT FROM db_cursor INTO @dbname
END
CLOSE db_cursor
DEALLOCATE db_cursor

This mssql module work on MSSQL 2017 in previous version some part is not working (query: sys.dm_db_log_stats not exist in prev version)

Best regards;

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.