What's your database engine?

Where is it hosted?

Settings





Create a database user with CREATE SESSION and SELECT_CATALOG_ROLE privileges.

(*) nazar-cli periodicaly conects to your database and query metrics from the dynamic performance views.

The role SELECT_CATALOG_ROLE allows granted users with SELECT privileges on data dictionary views.



Create a database user with VIEW SERVER STATE permission.

(*) nazar-cli periodicaly conects to your database and query metrics from the dynamic performance views.

The permission VIEW SERVER STATE allows granted users with SELECT privileges on data dictionary views.

Inform the instance name that uniquely identify your RDS instance (ARN). It is a string containing your AWS Account Number, the Region where the RDS is running and the Instance Identifier. (see more)


Inform the Resource Group and Database Instance Name that uniquely identify your Azure DB instance. (see more)

Action required on AWS

Create a IAM user with the credentials for programatic access and attach the following policy to the user. (see more)

{{ policy }}

Below is a aws-cli code to create an IAM user, the keys required to programatic access and to attach the policy to the user.


                        # create user
                        
aws iam create-user --user-name nazar-io

# create access key
aws iam create-access-key --user-name nazar-io
You'll need to take notes of the credentials AccessKeyId and SecretAccessKey in the output json and fill in the form below.
{{ createUserResponse }}

Attach the policy to the user:


                        # attach user policy
                        
attach-user-policy --user-name nazar-io --cli-input-json
{{ policy }}

Action required on AZURE

To start collecting the data you will have to create an Azure service principal. Azure service principal is an identity created for use with applications, hosted services, and automated tools to access Azure resources. This access is restricted by the roles assigned to the service principal, giving you control over which resources can be accessed and at which level. (see more)


                        # create azure service principal
                        
# with 'Log Analytics Reader' role
az ad sp create-for-rbac --name nazar-io --role 'Log Analytics Reader'
{{ createServicePrincipalResponse }}
You'll need to take notes of the appId and password and tenant values in the output json and fill in the form in the next step.

Credentials: Fill in the credentials AccessKeyId and SecretAccessKey in the form below.

Fill in the credentials appId, password and tenant in the form below.


#{{ server.Server.Id }} - {{ server.Server.Name }}

You need to set the following parameter in RDS Parameter Groups:

log_min_duration_statement 100
slow_query_log 1
log_output FILE
long_query_time 0.1

Create a database user with CREATE SESSION and SELECT_CATALOG_ROLE privileges.

Download the agent nazar-cli (Requires Java 1.8+).

Replace [HOST:PORT], [USER], [PASSWORD] and [SID] or /[SERVICE_NAME].

Schedule the command below to run every 20 minutes.


                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD] \
  --db-instance-name [SID] or /[SERVICE_NAME]

Remember to give the privileges CREATE SESSION and SELECT_CATALOG_ROLE to the database user informed.

Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.

Create a database user with VIEW SERVER STATE permission.

Download the agent nazar-cli (Requires Java 1.8+).

Replace [HOST:PORT], [USER] and [PASSWORD].

Schedule the command below to run every 20 minutes.


                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD]

Remember to give the permission VIEW SERVER STATE to the database user informed.

Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.

You can do it in the AWS Management Console, or using the aws-cli code below.


                          # modify db parameter group
                              
modify-db-parameter-group --parameters nazar-io --cli-input-json
{
  "Version": "2012-10-17",
  "Statement": [ {
    "ParameterName": "log_min_duration_statement",
    "ParameterValue": "100"
  } ]
}

{
  "Version": "2012-10-17",
  "Statement": [ {
    "ParameterName": "slow_query_log",
    "ParameterValue": "1"
  }, {
    "ParameterName": "log_output",
    "ParameterValue": "FILE"
  }, {
    "ParameterName": "long_query_time",
    "ParameterValue": "0.1"
  } ]
}


#{{ server.Server.Id }} - {{ server.Server.Name }}

You need to set the following parameters in Azure Portal:

log_line_prefix '%t:%r:%u@%d:[%p]:'
log_min_duration_statement 100
slow_query_log on
log_output FILE
long_query_time 0.1

Create a database user with VIEW DATABASE STATE permission.

Create a database user with VIEW SERVER STATE permission.

Download the agent nazar-cli (Requires Java 1.8+).

Replace [HOST:PORT], [USER], [PASSWORD] and [DB_INSTANCE_NAME].

Replace [HOST:PORT], [USER] and [PASSWORD].

Schedule the command below to run every 20 minutes.


                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD] \
  --db-instance-name [DB_INSTANCE_NAME]

                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD]

Remember to give the permission VIEW SERVER STATE to the database user informed.

Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.

You can do it in the Azure Portal, or using the azure-cli code below.


                          # modify server configuration values
                              
az postgres server configuration set --name log_line_prefix --resource-group myresourcegroup --server mydemoserver --value '%t:%r:%u@%d:[%p]:'
az postgres server configuration set --name log_min_duration_statement --resource-group myresourcegroup --server mydemoserver --value 100 az mysql server configuration set --name slow_query_log --resource-group myresourcegroup --server mydemoserver --value on

az mysql server configuration set --name log_output --resource-group myresourcegroup --server mydemoserver --value FILE

az mysql server configuration set --name long_query_time --resource-group myresourcegroup --server mydemoserver --value 0.1


#{{ server.Server.Id }} - {{ server.Server.Name }}

Edit the postgresql.conf file in your PostgreSQL server. Add or modify the following parameters:


                          -- postgresql
                          
log_min_duration_statement = 100
log_line_prefix = '%t:%r:%u@%d:[%p]:'
lc_messages = 'C'
logging_collector = on

log_destination = 'stderr'
log_statement = 'none'
log_filename = 'postgresql-%a_%H.log'
log_truncate_on_rotation = on
log_rotation_age = 60
log_rotation_size = 0

Download the agent nazar-cli (Requires Java 1.8+).

Replace [PATH] with the value where you'll put the gzipped log files.

Schedule the command below to run hourly.


                          
                            java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --method uploader \
  --log-path [PATH]

Edit the my.cnf (Linux and Mac OS) or my.ini (Windows) file in your {{ database }} server. Locate the [mysqld] section in the file, and add or modify the following parameters:


                          -- mysql
                          
slow_query_log = 1
log_output = FILE
long_query_time = 0.1

Download the agent nazar-cli (Requires Java 1.8+).

Replace [PATH] with the value where you'll put the gzipped log files.

Schedule the command below to run hourly.


                          
                            java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --method uploader \
  --log-path [PATH]

Create a database user with CREATE SESSION and SELECT_CATALOG_ROLE privileges.

Download the agent nazar-cli (Requires Java 1.8+).

Replace [HOST:PORT], [USER], [PASSWORD] and [SID] or /[SERVICE_NAME].

Schedule the command below to run every 20 minutes.


                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD] \
  --db-instance-name [SID] or /[SERVICE_NAME]

Remember to give the privileges CREATE SESSION and SELECT_CATALOG_ROLE to the database user informed.

Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.

Create a database user with VIEW SERVER STATE permission.

Download the agent nazar-cli (Requires Java 1.8+).

Replace [HOST:PORT], [USER] and [PASSWORD].

Schedule the command below to run every 20 minutes.


                            # nazar-cli agent
                            
java -jar nazar-cli.jar \
  --access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
  --database {{ server.Server.Database }} \
  --aws-access-key-id {{ server.Credentials.AccessKeyId }} \
  --aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
  --endpoint [HOST:PORT] \
  --user [USER] \
  --password [PASSWORD]

Remember to give the permission VIEW SERVER STATE to the database user informed.

Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.

Go to Dashboard