Datasentinel Docs
Visit our websiteBlogRelease Notes
  • 👋Welcome
  • 🆓Free Trial
  • 📣Release Notes
  • Getting started
    • Architecture
    • Installation
      • 🌐Platform
      • 🕶️Agent
    • PostgreSQL clusters
      • 🔌Extensions
        • 🔌pg_stat_statements
        • 🔌pg_store_plans
        • 🔌system_stats
        • 🔌pg_buffercache
      • 🕶️Monitoring User
      • ➕Adding Connection
    • FAQs
      • ❓Platform FAQ
      • ❓Agent FAQ
  • Features
    • Key Features
      • 📊Session History
      • 📊Top Queries
      • 📂Top Tables
      • 🔓Lock Explorer
      • 📈Cluster & System Metrics
      • ⌚Live360
      • 📰Reporting
      • 🔔Alerting
        • Settings
        • Templates
        • Silences
        • Manager
    • Other Features
      • 📡Agentless Monitoring
      • 🛡️Role Based Access
      • 🔂Changed Parameters
    • Tips & Hints
      • 🖥️User Interface
      • 🏷️Tags
      • 🔀Metric Correlation
      • 👁️‍🗨️Consolidated View
      • ❗Graphical Annotations
      • ☁️Predefined Providers
      • ❓Wait Event Description
      • ®️Read Replicas
      • 👁️‍🗨️Agentless & System Metrics
      • ☑️Simplified pg_instance Display
  • implementation
    • Platform Usage
      • ⚙️Configuration
        • 🔑License
        • 📓LDAP
        • ✉️SMTP
        • 📋Audit
        • 👨‍🏭Users & Roles
      • 🧩API
        • 🔗Access Token
        • 🧩Connection API
        • 🧩Role API
        • 🧩User API
        • 🧩Reporting API
        • 🧩Workload API
        • 🧩Alerting API
      • 🛠️Tooling
    • Agent Usage
      • 📣Release Notes
      • ⌨️CLI
      • 🧩API
      • 🗃️Collection Level
      • 🔬Internals
    • Upgrade
      • 🔄Platform
      • 🔄Agent
    • Troubleshooting
      • 🩺Error message: “502 Bad Gateway”
      • 🩺The UI is not displaying any metrics for my new instance.
      • 🩺UI dashboard is encountering loading errors
      • 🩺InfluxDB
  • Support
    • How to Contact Us
  • GitHub Toolkit
Powered by GitBook
On this page
  • Howto
  • Dockerfile
  • Docker-compose
  1. Getting started
  2. Installation
  3. Alternate Deployments
  4. Docker

Agent

The agent is accessible as a Docker image through the public Docker Hub.

Last updated 1 year ago

A single agent has the capability to monitor multiple PostgreSQL clusters

Howto

Because the agent registers the server name and listening port to the platform, you need to expose them externally and pass the values when running a new agent.

This allows the platform to communicate with the agent.

// download, install and run the agent

export DATASENTINEL_AGENT_HOST=172.16.250.199
export DATASENTINEL_AGENT_PORT=8383

docker run -d -p $DATASENTINEL_AGENT_PORT:$DATASENTINEL_AGENT_PORT -e DATASENTINEL_AGENT_HOST=$DATASENTINEL_AGENT_HOST -e DATASENTINEL_AGENT_PORT=$DATASENTINEL_AGENT_PORT datasentinel/datasentinel-agent

You can use the by attaching a shell (docker exec -it <mycontainer> bash)

// Example agent CLI command
/agent/datasentinel/datasentinel status agent

Subsequently, you can use the to configure the agent. For detailed information, please refer to the Agent API documentation. Configuration files are stored within the volume /agent/config

// Check agent status
curl -k https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/agent/status

Update token with valid license

export TOKEN="Valid license key"

cat <<EOF >body.json
{
    "value" : "$TOKEN"
}
EOF

curl -k --header 'Content-Type: application/json' --request PUT "https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/server/token" -d @body.json

Set Datasentinel upload platform

cat <<EOF >upload_server.json
{
  "host": "datasentinel_server",
  "port": 443
}
EOF

curl -k --header "api-token: $TOKEN" --header 'Content-Type: application/json' -X PUT https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/server -d @upload_server.json
# Check upload server
curl -k -X GET https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/server

Test the communication between the agent and the platform

curl -k --header "api-token: $TOKEN" --request POST https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/server/test-upload

Add a PostgreSQL connection

cat > body.json <<EOF
{
  "host": "172.16.250.199",
  "port": 5432,
  "user": "datasentinel",
  "password": "myPassword",
  "tags": "application=application_name,environment=docker,datacenter=datacenter"
}
EOF

curl -k --header "api-token: $TOKEN" --header 'Content-Type: application/json' --request POST "https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/connections/pg_docker_example" -d @body.json

Check connection

curl -k --header "api-token: $TOKEN" -X GET https://${DATASENTINEL_AGENT_HOST}:${DATASENTINEL_AGENT_PORT}/api/connections

Dockerfile

Docker-compose

wget https://raw.githubusercontent.com/datasentinel/datasentinel_toolkit/master/docker/agent/docker-compose.yml
docker-compose up -d
https://hub.docker.com/repository/docker/datasentinel/datasentinel-agent/general
agent CLI
API
https://github.com/datasentinel/datasentinel_toolkit/blob/master/docker/agent/docker-compose.yml
version: '2.2'
volumes:
  agent-config:
services:
  agent:
    image: datasentinel/datasentinel-agent
    container_name: datasentinel-agent
    restart: always
    ports:
        - 8383:8383
    environment:
      - DATASENTINEL_AGENT_HOST=$HOSTNAME
      - DATASENTINEL_AGENT_PORT=8383
https://github.com/datasentinel/datasentinel_toolkit/blob/master/docker/agent/Dockerfile
FROM ubuntu:latest

ARG DATASENTINEL_AGENT_PORT=8282

ENV DATASENTINEL_DIR=/agent
ENV DOCKER_ENV=yes

ADD datasentinel-agent-debian-buster-2.7.1.tar.gz $DATASENTINEL_DIR/


RUN apt-get update \ 
    && apt-get install -y libssl-dev --no-install-recommends \
    && mkdir -p $DATASENTINEL_DIR/config \
    && chgrp -R 0 $DATASENTINEL_DIR \
    && chmod -R g+rwX $DATASENTINEL_DIR \
    && apt-get clean -y autoclean  \
    && rm -rf /var/cache/apk/* \
    && rm -rf /var/lib/apt/lists/*

VOLUME [ "${DATASENTINEL_DIR}/config"]

USER 1001

WORKDIR $DATASENTINEL_DIR

EXPOSE $DATASENTINEL_AGENT_PORT

CMD $DATASENTINEL_DIR/datasentinel/datasentinel start agent