PostgreSQL agent
Prerequisites
- For prerequisite checks for agent installation, see Prerequisite checks for agent installation.
- URL/IP of the SixthSense collector (your tenant URL, which will be provided by Customer Support).
- Access token from the SixthSense portal. For accessing the token, see Accessing your Access Token under Getting started with the Observability Portal.
- PostgreSQL agent version "latest".
- Package token to download agent (provided by the onboarding team).
- For information about supported agent versions and framework, see Supported agents.
Downloading the agent version 4.3.5 (latest)
For Windows and Linux based servers, use the following link.
curl --header "PRIVATE-TOKEN:<TOKEN>" --output meter-agent.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/32/packages/generic/Meter-Agent/v4.3.5/meter-agent.zip"
Configuring the PostgreSQL agent
Create a config.yaml file in the same directory.
# sixthsense-postgreSQL-agent can be configured via yaml or environment variables
#
# Note: Environment Variables are given higher priority over yaml file
#
# Following are the environment variables that can be set:
# ENV VARIABLE CORRESPONDS TO
# SS_SERVICE_NAME service_name
# SS_AUTHENTICATION authentication
# SS_BACKEND sixthsense_backend
# SS_LOGGING logging
# SS_SECURE secure
sixthsense:
service_name: <custom-service-name>
# Login to Sixthsense UI --> Go to Settings on Side Navbar --> Copy Access Token
authentication: <custom-service-authKey>
# debug|error|info
logging: info
sixthsense_backend: <custom-sixthsense_backend-url>
# For GCP: grpc-collector-observability.sixthsense.rakuten.com:443
# (One Cloud) For connectivity to backend using intra public network: 133.237.176.44:80
# (One Cloud) For connectivity to backend using onecloud private network: 100.99.116.221:80
# SSL connection with backend true|false
secure: true
# (For One Cloud) secure: false
# MY | ES | MS | CB | OR
type: PG
# cron optional
# cron: "* * * * *"
hostname: <hostIp>
port: <port> #5432
user: <user>
password: <password>
database: <database>
postgres:
# disable|enable
sslmode: disable # sslmode parameter to determine the security of the connection
isExtension : false
queryLimit: 10 #no of queries
queryThresholdTime: 1 #millisecond
note
Use either the sql port or socket.
To create a read-only new user in PostgreSQL use the following commands.
CREATE USER username WITH PASSWORD 'your_password';
GRANT the CONNECT access:
GRANT CONNECT ON DATABASE database_name TO username;
example:-
GRANT CONNECT ON DATABASE postgres TO sixthsense;
Then GRANT USAGE on schema:
GRANT USAGE ON SCHEMA schema_name TO username;
example:-
GRANT USAGE ON SCHEMA public TO sixthsense;
GRANt SELECT for multiple tables:
GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO username;
example:-
GRANT SELECT ON ALL TABLES IN SCHEMA public TO sixthsense;
Running the agent
For Linux:
Use the following command to run the agent.
./meter-agent ss-postgresql-config.yaml
ss-postgresql-config1.yaml...
For Windows:
Extract meter-agent.zip file and edit the configuration in the yaml file with cluster information.
Open the command prompt with run as Administrator and enter the following command:
nssm.exe install “Service_Name”
In the NSSM service installer screen, the Application tab is selected by default.
Enter the following details:
- Path: meter-agent.exe full path
- Startup directory: folder path
- Arguments: yaml full name
- Click the Details tab.
- Enter the following details:
- Display name: service display name
- Description: service description
- Setup type: select type for setup such as automatic.
- Click the Log on tab.
- Select Local System account radio button.
- Select Allow service to interact with desktop check box.
- Click Install service.