Coder Social home page Coder Social logo

agent's Introduction

Swarmpit agent

Swarmpit docker agent.

version PRs Welcome

Run

docker run -d \
  --name agent \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  swarmpit/agent:latest

Parameters

Important!

In case you are deploying agent inside Swarmpit stack with some sort of customization, make sure that Swarmpit service name (default to app) match domain name set by EVENT_ENDPOINT & HEALTH_CHECK_ENDPOINT.

agent's People

Contributors

kenits avatar mrq1911 avatar nohaapav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

agent's Issues

Windows Agent

We have a multi-os swarm cluster and we cant check the windows based nodes resources.

Adding ENV to use socket proxy

It would be nice to also configure the agent to use a socket proxy like the main app can:

Swarmpits behavior can be reconfigured via Environment Variables.
SWARMPIT_DOCKER_SOCK

Docker SOCK location used by docker client. In case of socket proxy use following format: http://TCPENDPOINT:2375. Default is /var/run/docker.sock.

Thanks in advance, also for any hints, ideas, considersations in the meantime :)

client version is too new

The collector is in a reboot loop.

$ docker version
Client:
 Version:	17.12.0-ce
 API version:	1.35
 Go version:	go1.9.2
 Git commit:	c97c6d6
 Built:	Wed Dec 27 20:10:14 2017
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.0-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.2
  Git commit:	c97c6d6
  Built:	Wed Dec 27 20:12:46 2017
  OS/Arch:	linux/amd64
  Experimental:	false
swarmpit_event-collector.0.h6673zkgu7y0@dfw-dev-swm-w-1    | 2018/02/12 16:07:06 INFO: Waiting for Swarmpit...
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:06 INFO: Swarmpit event collector starting...
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:06 INFO: EVENT_ENDPOINT: http://app:8080/events
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:06 INFO: HEALTH_CHECK_ENDPOINT: http://app:8080/version
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:06 INFO: Waiting for Swarmpit...
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:06 INFO: Swarmpit event collector starting...
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:06 INFO: EVENT_ENDPOINT: http://app:8080/events
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:06 INFO: HEALTH_CHECK_ENDPOINT: http://app:8080/version
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:06 INFO: Waiting for Swarmpit...
swarmpit_event-collector.0.f4pvin159be4@dfw-dev-swm-w-2    | 2018/02/12 16:07:07 INFO: Swarmpit event collector starting...
swarmpit_event-collector.0.f4pvin159be4@dfw-dev-swm-w-2    | 2018/02/12 16:07:07 INFO: EVENT_ENDPOINT: http://app:8080/events
swarmpit_event-collector.0.f4pvin159be4@dfw-dev-swm-w-2    | 2018/02/12 16:07:07 INFO: HEALTH_CHECK_ENDPOINT: http://app:8080/version
swarmpit_event-collector.0.f4pvin159be4@dfw-dev-swm-w-2    | 2018/02/12 16:07:07 INFO: Waiting for Swarmpit...
swarmpit_event-collector.0.fgagscfwjpno@dfw-dev-swm-m-1    | 2018/02/12 16:07:09 INFO: Swarmpit OK
swarmpit_event-collector.0.fgagscfwjpno@dfw-dev-swm-m-1    | 2018/02/12 16:07:09 ERROR: Event channel error: Error response from daemon: client version 1.36 is too new. Maximum supported API version is 1.35
swarmpit_event-collector.0.h6673zkgu7y0@dfw-dev-swm-w-1    | 2018/02/12 16:07:11 INFO: Swarmpit OK
swarmpit_event-collector.0.h6673zkgu7y0@dfw-dev-swm-w-1    | 2018/02/12 16:07:11 ERROR: Event channel error: Error response from daemon: client version 1.36 is too new. Maximum supported API version is 1.35
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:11 INFO: Swarmpit OK
swarmpit_event-collector.0.ntu22r0endlq@dfw-dev-swm-w-3    | 2018/02/12 16:07:11 ERROR: Event channel error: Error response from daemon: client version 1.36 is too new. Maximum supported API version is 1.35
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:11 INFO: Swarmpit OK
swarmpit_event-collector.0.5yr31ttt3pg9@dfw-dev-swm-m-3    | 2018/02/12 16:07:11 ERROR: Event channel error: Error response from daemon: client version 1.36 is too new. Maximum supported API version is 1.35

multi-arch docker image

Hello.
I propose to make a multiarch docker image for agent.
What do you think about that?
I made fork and some changes.

  • add go.mod for dependency resolution and fixation version
  • remove makefile in faver of use go.mod
  • some code formatting changes
  • make travis file for multi-arch build (I know it's terrible, but work)

and some question about swarmpit/task/stats.go

func calculateCPUPercentUnix(previousCPU, previousSystem uint64, v *types.StatsJSON) float64

CPUStats don't have OnlineCPUs and as I understand always go to in if block

	var (
		cpuPercent  = 0.0
		cpuDelta    = float64(v.CPUStats.CPUUsage.TotalUsage) - float64(previousCPU)
		systemDelta = float64(v.CPUStats.SystemUsage) - float64(previousSystem)
		onlineCPUs  = float64(v.CPUStats.OnlineCPUs)
	)

	if onlineCPUs == 0.0 {
		onlineCPUs = float64(len(v.CPUStats.CPUUsage.PercpuUsage))
	}

I use manifest-tool to create a single tag for docker image and have some problem with travis and manifest-tool, don't know how to make it work together.

May some test https://hub.docker.com/r/kenits/swarmpit_agent edge? It's build by travis

Monitor all disk usage not only root

Only root partition usage is monitoring, this is not useful when data are mounted on another partition.
Quick modification, can be to use env variable to know partition to monitor and default if not present is root partition.
Better way is to monitor all data partitions (not /sys, /proc, ...), but some modification must be done in front end to display that.

Do you think the quick modification is acceptable ?

Enable viewing logs when Docker version >= 20.10

I'm currently running Swarmpit but also using Loki (using their custom log-driver) for logging from all containers.
Now those longs aren't currently available in Swarmpit.
I believe that is because the buttons are disabled when the driver is not json-file our journald.
However, the logs are indeed available using "docker service logs", since i'm running docker 20.10.1, which supports "dual logging".

https://www.docker.com/blog/introducing-docker-engine-20-10/

Starting with Docker Engine 20.10, you can use docker logs to read container logs regardless of the configured logging driver or plugin. This capability, sometimes referred to as dual logging, allows you to use docker logs to read container logs locally in a consistent format, regardless of the remote log driver used, because the Engine is configured to log information to the “local” logging driver. Refer to “Configure the default logging driver “ in the Docker documentation for additional information

Any chance to get Logs in Swarmpit enabled when available, without having to change log-drivers on the containers?

How do I set up swarmpit agent timzone?

When I tried to easily install swarmpit with docker, the timezone-related argument did not exist, so I manually specified it in docker-compose, but the swarmpit agent did not set the timezone.
How can I set the swarmpit agent timezone?

My docker-compose.yml

version: '3.8'

services:
  app:
    image: swarmpit/swarmpit:latest
    environment:
      - SWARMPIT_DB=http://db:5984
      - SWARMPIT_INFLUXDB=http://influxdb:8086
      - INTERACTIVE=0
      - ADMIN_USERNAME=${SWARMPIT_ADMIN_USERNAME}
      - ADMIN_PASSWORD=${SWARMPIT_ADMIN_PASSWORD}
      - TZ=Asia/Seoul
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 888:8080
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080"]
      interval: 60s
      timeout: 10s
      retries: 3
    networks:
      - net
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 1024M
        reservations:
          cpus: '0.25'
          memory: 512M
      placement:
        constraints:
          - node.role == manager

  db:
    image: couchdb:2.3.0
    environment:
      - TZ=Asia/Seoul
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - db-data:/opt/couchdb/data
    networks:
      - net
    deploy:
      resources:
        limits:
          cpus: '0.30'
          memory: 256M
        reservations:
          cpus: '0.15'
          memory: 128M

  influxdb:
    image: influxdb:1.8
    environment:
      - TZ=Asia/Seoul
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - influx-data:/var/lib/influxdb
    networks:
      - net
    deploy:
      resources:
        limits:
          cpus: '0.60'
          memory: 512M
        reservations:
          cpus: '0.30'
          memory: 128M

  agent:
    image: swarmpit/agent:latest
    environment:
      - DOCKER_API_VERSION=1.35
      - TZ=Asia/Seoul
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
    networks:
      - net
    deploy:
      mode: global
      labels:
        swarmpit.agent: 'true'
      resources:
        limits:
          cpus: '0.10'
          memory: 64M
        reservations:
          cpus: '0.05'
          memory: 32M

networks:
  net:
    driver: overlay

volumes:
  db-data:
    driver: local
  influx-data:
    driver: local

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.