Atatus monitors SQL Server on Google Cloud SQL, collecting key data like query metrics, execution plans, and events. Because Google Cloud SQL does not allow direct host access, the Atatus Infra Agent runs on a separate host (typically a GCE VM in the same VPC) that can connect to your Cloud SQL instance.
Before You Begin
| Component | Supported Versions / Requirements |
|---|---|
| SQL Server | 2014, 2016, 2017, 2019, 2022 |
| Atatus Infra Agent | 3.4.0 or higher |
1. Grant the Agent Access
Create a SQL login for the Atatus Infra Agent and assign the required permissions. On Cloud SQL the default admin user is sqlserver; connect as that role to run the following statements.
USE [master];
CREATE LOGIN atatus WITH PASSWORD = '<YourSecurePassword>';
GO
GRANT VIEW SERVER STATE TO atatus AS CustomerDbRootRole;
GRANT VIEW ANY DEFINITION TO atatus AS CustomerDbRootRole;
ALTER SERVER ROLE CustomerDbRootRole DROP MEMBER atatus;
GO
Note: Google Cloud SQL does not permit granting
CONNECT ANY DATABASE. You must create theatatususer explicitly in each target database.
For each application database, run:
USE [<your_database_name>];
CREATE USER atatus FOR LOGIN atatus;
GO
For SQL Server Agent Jobs monitoring (SQL Server 2016+), grant the same access to msdb:
USE [msdb];
CREATE USER atatus FOR LOGIN atatus;
GRANT SELECT ON dbo.log_shipping_monitor_primary TO atatus;
GRANT SELECT ON dbo.log_shipping_monitor_secondary TO atatus;
GRANT SELECT ON dbo.sysjobs TO atatus;
GRANT SELECT ON dbo.sysjobhistory TO atatus;
GRANT SELECT ON dbo.sysjobactivity TO atatus;
GO
2. Configure the Atatus Agent
Step 1: Configure the SQL Server Integration
Edit the conf.d/sqlserver.d/sqlserver.yml configuration file in your Atatus Agent installation directory:
metrics:
- hosts:
- "<CLOUD_SQL_INSTANCE_IP>"
port: 1433
username: atatus
password: <YourSecurePassword>
dbm: true
Replace <CLOUD_SQL_INSTANCE_IP> with your Cloud SQL instance's private/public IP, or 127.0.0.1 if connecting through the Cloud SQL Auth Proxy.
Step 2: Restart the Atatus Infra Agent
sudo service atatus-infra-agent restart
Enable Schema Collection for SQL Server 2017+ (Optional)
Atatus Agent can collect schema information from SQL Server 2017 and above.
Requirements
- Agent v3.4.0 or higher
collect_database_info: truecollect_settings: true- Use
auto_discovery: trueto auto-detect all databases
Configuration Example
metrics:
- hosts:
- "<CLOUD_SQL_INSTANCE_IP>"
port: 1433
username: <DB_USERNAME>
password: <DB_PASSWORD>
dbm: true
dbm_mssqlserver_options:
collect_settings:
enabled: true
collect_database_info:
enabled: true
auto_discovery: true
# include:
# - db_name1
# - db_name2
# exclude:
# - db_name1
# - db_name2
Collect Metrics Using Custom Queries (Optional)
You can collect custom metrics from SQL Server using the custom_queries option in your configuration.
Configuration Example
metrics:
- hosts:
- "<CLOUD_SQL_INSTANCE_IP>"
port: 1433
username: <DB_USERNAME>
password: <DB_PASSWORD>
dbm: true
dbm_mssqlserver_options:
additional_metrics_options:
custom_queries:
- query: SELECT age, salary, hours_worked, name FROM hr.employees;
columns:
- name: custom.employee_age
type: gauge
- name: custom.employee_salary
type: gauge
- name: custom.employee_hours
type: count
- name: name
type: tag
tags:
- 'table:employees'
max_custom_queries: 20
+1-415-800-4104