sstarcher / docker-sensu

Dockerized Sensu - Client, Server, Api
MIT License
103 stars 72 forks source link

RUNTIME_INSTALL causes server container to crash. #62

Closed nybos486 closed 6 years ago

nybos486 commented 6 years ago

Attempting to add a RUNTIME_INSTALL to the server environment variables in docker-compose.yaml causes the server container to crash

  environment:
    RUNTIME_INSTALL: sensu-plugins/disk-checks:master

It is possible that I'm not calling the RUNTIME_INSTALL properly?

Perhaps an example of proper execution might help.

sstarcher commented 6 years ago

Your command looks correct it's possible that the plugin has compile dependencies that are needed. Please check the logs from the container.

nybos486 commented 6 years ago

Unfortunately the container crashes/exits as soon as it reaches the end of what appears to be the second apt operation.

I thought that perhaps I needed to apply the runtime install to the server and client containers, when I do, the client crashes at the same place as the server...just following the apt operation.

If you are able to install plugins using RUNTIME_INSTALL inside docker-compose, could you post a working example of the compose file here? Please include your linux, docker, and docker-compose versions if possible. Server-log-tail.txt


I wouldn't mind applying plugins manually, but methods for achieving this on other installs don't appear to work with this deployment.

On the server in the /etc/sensu/conf.d directory a json file per check: { "checks": { "container_count": { "type": "metric", "command": "container-count.sh", "subscribers": [ "docker" ], "interval": 10 } } } And placing a the check script (container-count.sh in this case) in the /etc/sensu/plugins directory on the client.

Am I missing something?

sstarcher commented 6 years ago

If the container exists you can still get the logs from the container. The plugins only need to be installed for the client.

As for your second question I believe that should work, but I have not tried it.

hosterholz commented 6 years ago

The format in the readme is wrong. You need to specify the version as sensu-plugins/disk-checks@master https://github.com/sstarcher/docker-sensu/blob/bce368d9337046d2f085e5b0fdbe743f6951bfa5/bin/install#L36

nybos486 commented 6 years ago

When I try that:

sensu-client:
    container_name: mon-client
    image: sstarcher/sensu:latest
    hostname: log1-mon-client
    restart: unless-stopped
    command: client
    volumes:
        - /etc/hosts:/etc/hosts:ro
        - /dev:/host_dev/:ro
        - /proc:/host_proc/:ro
        - /sys:/host_sys/:ro
        - /var/run/docker.sock:/var/run/docker.sock
    ports:
        - 3030:3030
    environment:
        - CONFIG_DIR=/etc/sensu/conf.d
        - CLIENT_NAME=log1
        - CLIENT_SUBSCRIPTIONS=default,web
        - CLIENT_ADDRESS=10.0.4.168
        - CLIENT_KEEPALIVE_HANDLER=default #May need special handler in the future
        - CLIENT_DEREGISTER=false
        - REDIS_HOST=db1
        - REDIS_PORT=6379
        - REDIS_DB=0
        - REDIS_AUTO_RECONNECT=true
        - REDIS_RECONNECT_ON_ERROR=false
        - RUNTIME_INSTALL=sensu-plugins/sensu-plugins-disk-checks@master

I get the following error in the log just prior to the container stopping:

  2018-02-01T16:07:45.702942000Z Unpacking gcc-6 (6.3.0-18) ...
  2018-02-01T16:07:54.564589000Z gzip: stdin: not in gzip format
  2018-02-01T16:07:54.564959000Z tar: Child returned status 1
  2018-02-01T16:07:54.565299000Z tar: Error is not recoverable: exiting now
  2018-02-01T16:07:54.565634000Z /bin/install: line 47: cd: sensu-plugins-sensu-plugins-disk-checks-master: No such file or directory

Am I calling the RUNTIME_INSTALL correctly in the compose file?

sstarcher commented 6 years ago

Bad documentation is the cause. I attempted to improve it let me know if this makes sense. https://github.com/sstarcher/docker-sensu#runtime-installation

- RUNTIME_INSTALL=sensu-plugins/sensu-plugins-disk-checks@master vs - RUNTIME_INSTALL=sensu-plugins/disk-checks@master

Or you can also do - RUNTIME_INSTALL=disk-checks