share library_books edit

General

  1. Get a free account at sematext.com/spm
  2. Create an SPM App
  3. For logs (optional) create a Logsene App to obtain an App Token for Logsene

Follow the installation instructions in Sematext user interface. The user interface provides copy/paste instructions for various platforms including Docker Cloud, Docker Swarm, Kubernetes, Mesos, and Rancher.

To use Logging and Monitoring with a single agent, the provided instructions need to be extended with application tokens LOGSENE_TOKEN or SPM_TOKEN as described in the examples below.

Installation using Docker client

  1. Get a free account at sematext.com/spm
  2. Create an SPM App of type "Docker" and copy the SPM Application Token
  3. For logs (optional) create a Logsene App to obtain an App Token for Logsene
  4. Run the image after adding your SPM and/or Logsene tokens:

docker pull sematext/sematext-agent-docker docker run -d --name sematext-agent-docker \ -e SPM_TOKEN=YOUR_SPM_TOKEN \ -e LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN \ -v /var/run/docker.sock:/var/run/docker.sock sematext/sematext-agent-docker -->

Installation of the Docker Image of the monitoring agent:

Installation using Docker compose

Create a Logsene and SPM App and replace the actual LOGSENE_TOKEN and SPM_TOKEN with your individual tokens in the following compose file:

# docker-compose.yml
sematext-agent:
  image: 'sematext/sematext-agent-docker:latest'
  environment:
    - LOGSENE_TOKEN=YOUR_LOGSENE_TOKEN 
    - SPM_TOKEN=YOU_SPM_TOKEN
  cap_add:
    - SYS_ADMIN
  restart: always
  volumes:
    - '/var/run/docker.sock:/var/run/docker.sock'
    - '/:/rootfs:ro'

Start Sematext Docker agent with the docker-compose file:

docker-compose up -d

Docker Swarm and Docker Enterprise

Connect your Docker client to Swarm or UCP remote API endpoint and deploy Sematext Docker Agent with following docker command with your SPM and Logsene token: 

docker service create –mode global –name sematext-agent-docker \
–mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
-e SPM_TOKEN=”REPLACE THIS WITH YOUR SPM TOKEN” \
-e LOGSENE_TOKEN=”REPLACE THIS WITH YOUR LOGSENE TOKEN” \
sematext/sematext-agent-docker

Please refer to Monitoring and Logging for Docker Enterprise Edition for further information.

Kubernetes and Red Hat OpenShift

Run Sematext Agent as Kubernetes DaemonSet.

  1. Get a free account
  2. Create an SPM App of type "Docker" and copy the SPM App Token
  3. For logs (optional) create a Logsene App to obtain an App Token for Logsene
  4. Create sematext-agent.yml - and set your SPM and Logsene App Token in the section spec.env.
  5. Run the DaemonSet
kubectl create -f sematext-agent.yml 

On Red Hat OpenShift use the "oc" command instead of kubectl.

Note: Red Hat Certified images for the Sematext Docker Agent are available in the Red Hat Container Catalog. You should use "registry.connect.redhat.com" as Docker registry to access Red Hat certified images.

oc apply -f sematext-agent.yml 

CoreOS using fleet

Please note due to the end of support for Fleet on CoreOS, we recommend using Kubernetes installation.

To install SPM for Docker including log forwarding from journald execute these commands:

export $SPM_TOKEN=YOUR-SPM-TOKEN
export $LOGSENE_TOKEN=YOUR-SPM-TOKEN
etcdctl set /sematext.com/myapp/spm/token $SPM_TOKEN
etcdctl set /sematext.com/myapp/logsene/token $LOGSENE_TOKEN
wget https://raw.githubusercontent.com/sematext/sematext-agent-docker/master/coreos/sematext-agent.service
fleetctl load sematext-agent.service; fleetctl start sematext-agent.service
wget https://raw.githubusercontent.com/sematext/sematext-agent-docker/master/coreos/logsene.service
fleetctl load logsene.service; fleetctl start logsene.service; 

Please note the provided .service scripts use port 9000 for the logging service. The provided service templates could be changed after the download.

An alternative way to install the services is to include the content of the unit files in the cloud-init config file. 

The latest documentation, install script, and service files are available in the Github repository

Rancher

Please read Rancher Monitoring and Logging Support. There are various deployment options for Rancher, Swarm, Kubernetes or Mesos. In addition, we recommend reading Rancher Labs blog post about the Rancher Catalog Entry.

Installation on Nomad by Hashicorp

See an example of the job description for Nomad by Hashicorp

Installation on Mesos / Marathon

The following configuration will activate Sematext Docker Agent on every node in the Mesos cluster. Please note that you have to specify the number of Mesos nodes (instances), SPM App Token and Logsene App Token. An example call to the Marathon API:

curl -XPOST -H "Content-type: application/json" http://your_marathon_server:8080/v2/apps  -d '
{
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "sematext/sematext-agent-docker"
    },
    "volumes": [
      {
        "containerPath": "/var/run/docker.sock",
        "hostPath": "/var/run/docker.sock",
        "mode": "RW"
      }
    ],
    "network": "BRIDGE"
  },
  "env": {
        "LOGSENE_TOKEN": "YOUR_LOGSENE_TOKEN",
        "SPM_TOKEN": "YOUR_SPM_TOKEN" 
  },
  "id": "sematext-agent",
  "instances": 1,
  "cpus": 0.1,
  "mem": 100,
  "constraints": [
    [
      "hostname",
      "UNIQUE"
    ]
  ]
}