Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the minimum required permissions for SQL Monitoring #23

Open
danbarua opened this issue Nov 7, 2013 · 6 comments
Open

Document the minimum required permissions for SQL Monitoring #23

danbarua opened this issue Nov 7, 2013 · 6 comments

Comments

@danbarua
Copy link

danbarua commented Nov 7, 2013

sysadmin seems to work! :)

But it would be nice to know the minimal permission set to give my OpServer service account.

@NickCraver
Copy link
Member

The reason we haven't gotten to this is I'm far from the SQL feature set that I have in mind. As time allows, I'll add way more to the SQL section of Opserver. Integration with some of the tools already out there isn't far off, hoping the slower holiday season will let me spend some more time on that.

Once more of that is in place, we'll start seeing what permissions are needed for which features so you can choose. At that point, Opserver can intelligent enable or disable functionality, informing you of what permissions it lacks.

@waynebrantley
Copy link

Very impressive with the features set it already has!

@adutton
Copy link
Contributor

adutton commented Oct 11, 2014

This was what I used to create a SQL authentication login and grant it most of the SQL permissions it needed. This still fails because DBCC LOGINFO requires sysadmin level security, but it gives you most of the interesting details.

USE [master]
GO

CREATE LOGIN [opserver] WITH PASSWORD=N'correcthorsebatterystaple', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO

GRANT VIEW SERVER STATE to opserver;
GRANT VIEW ANY DEFINITION TO opserver;

EXEC sp_MSforeachdb 'use [?]; CREATE USER opserver FOR LOGIN opserver;';

USE msdb;
GRANT SELECT ON sysjobs TO opserver;
GRANT SELECT ON sysjobhistory TO opserver;
GRANT SELECT ON sysjobactivity TO opserver;
GRANT SELECT ON syscategories TO opserver;
EXEC sp_addrolemember N'SQLAgentReaderRole', N'opserver'

@briantist
Copy link

This would really be great to have. It feels pretty wrong to use or create an account that has sysadmin rights on every SQL server for a dashboard. A breakdown of which permissions are needed for which features would be helpful in letting us make decisions about how much power the opserver account has.

Addressing it sooner, in my opinion, is easier than trying to figure it out later when more features are added; it should be thought of as new features are being developed. I guess I'm thinking of it in sort of a TDD mindset.

@adutton that's a great start, thanks for that!

AlexSikilinda pushed a commit to AlexSikilinda/Opserver that referenced this issue Sep 16, 2016
@dgaspar
Copy link
Contributor

dgaspar commented Dec 17, 2018

This was what I used to create a SQL authentication login and grant it most of the SQL permissions it needed. This still fails because DBCC LOGINFO requires sysadmin level security, but it gives you most of the interesting details.

USE [master]
GO

CREATE LOGIN [opserver] WITH PASSWORD=N'correcthorsebatterystaple', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO

GRANT VIEW SERVER STATE to opserver;
GRANT VIEW ANY DEFINITION TO opserver;

EXEC sp_MSforeachdb 'use [?]; CREATE USER opserver FOR LOGIN opserver;';

USE msdb;
GRANT SELECT ON sysjobs TO opserver;
GRANT SELECT ON sysjobhistory TO opserver;
GRANT SELECT ON sysjobactivity TO opserver;
GRANT SELECT ON syscategories TO opserver;
EXEC sp_addrolemember N'SQLAgentReaderRole', N'opserver'

The latest checkout also requires:

USE msdb;
GRANT EXECUTE ON agent_datetime TO opserver;
GRANT SELECT ON dbo.sysjobsteps TO opserver;

USE master;
GRANT EXECUTE ON sp_WhoIsActive TO opserver;

@0UserName
Copy link

@adutton, why do you need EXEC sp_MSforeachdb 'use [?]; CREATE USER opserver FOR LOGIN opserver;'; if only two database have some permission GRANT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants