PostgreSQL agent

Prerequisites

  • 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 1.0.00.
  • Package token to download agent (provided by the onboarding team).

Downloading the agent

For Windows based servers, use the following link.

curl --header "PRIVATE-TOKEN:{{TOKEN}}" --output PostgreSQL.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/32/packages/generic/Postgres-Agent/v1.0/PostgreSQL_Windows.zip"

For Linux, use the following link.

curl --header "PRIVATE-TOKEN:{{TOKEN}}" --output Sixthsense-Meter-Agent.zip "https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/32/packages/generic/Meter-Agent/v4.0.1/Meter-Agent-v4.0.1.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>
# SSL connection with backend true|false
secure: <true|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

Use the following command to run the agent.

./meter-agent ss-postgresql-config.yaml
ss-postgresql-config1.yaml...