Commit 2eb3f467 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Pone al día el proyecto

Mejora script de arranque, simplificando la carga del nombre del nodo.
Actualiza parámetro obsoleto de exclusión de directorios.
Agrega configuración para puerto, nivel de log y nombre del nodo.
Incluye healthcheck.
Actualiza algunos valores por defecto.
Actualiza y unifica fichero compose.
Actualiza plantillas CI utilizadas.
parent 9b7b4c80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
include:
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment.yml'
    file: '/deployment-service/docker-deploy.yml'

stages:
  - deploy
+1 −1
Original line number Diff line number Diff line
# Node exporter

Prometheus exporter for hardware and OS metrics. Inspired by https://github.com/stefanprodan/swarmprom
 No newline at end of file
Prometheus exporter for hardware and OS metrics. Inspired by <https://github.com/stefanprodan/swarmprom>
+2 −0
Original line number Diff line number Diff line
PORT=9100
CONFIG_PATH=/etc/node-exporter
HOST_PATH=/rootfs
MOUNT_POINTS_EXCLUDE=sys|proc|dev|etc|boot|tmp|run|.*/docker/containers
+14 −8
Original line number Diff line number Diff line
version: '3.5'

services:
  node-exporter:
    image: ${IMAGE_NAME:-prom/node-exporter}:${IMAGE_TAG:-latest}
    user: root
    entrypoint: ${CONFIG_PATH}/entrypoint.sh
    command:
      - --web.listen-address=:${PORT}
      - --log.level=${LOG_LEVEL:-info}
      - --path.rootfs=${HOST_PATH}
      - --path.sysfs=${HOST_PATH}/sys
      - --path.procfs=${HOST_PATH}/proc
      - --collector.textfile.directory=${CONFIG_PATH}
      - --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|etc)($$|/)
      - --collector.filesystem.mount-points-exclude=^/(${MOUNT_POINTS_EXCLUDE})($$|/)
      - --no-collector.ipvs
    environment:
      CONFIG_PATH:
      NODE_ID: '{{.Node.ID}}'
      NODE_NAME: '{{.Node.Hostname}}'
    networks:
      metric-net:
    volumes:
      - /:${HOST_PATH}:ro
      - /etc/hostname:${CONFIG_PATH}/nodename:ro
      - /:${HOST_PATH}:ro,rslave
    configs:
      - source: entrypoint-config
        target: ${CONFIG_PATH}/entrypoint.sh
        mode: 0555
    healthcheck:
      test: wget --spider -q http://127.0.0.1:${PORT}
      interval: ${HEALTHCHECK_INTERVAL:-30s}
      timeout: ${HEALTHCHECK_TIMEOUT:-10s}
      retries: ${HEALTHCHECK_RETRIES:-10}
      start_period: ${HEALTHCHECK_START_PERIOD:-1m}
    deploy:
      mode: global
      restart_policy:
        delay: ${RESTART_DELAY:-10s}
        delay: ${RESTART_DELAY:-5s}
      update_config:
        delay: ${UPDATE_DELAY:-30s}
        delay: ${UPDATE_DELAY:-0s}
      resources:
        limits:
          cpus: '${RESOURCES_LIMITS_CPUS:-0.1}'
          cpus: '${RESOURCES_LIMITS_CPUS:-0.5}'
          memory: ${RESOURCES_LIMITS_MEMORY:-32M}
        reservations:
          cpus: '${RESOURCES_RESERVATIONS_CPUS:-0.001}'
+1 −3
Original line number Diff line number Diff line
#!/bin/sh

nodeName=$(cat "${CONFIG_PATH}/nodename")

echo "node_meta{\
node_id=\"${NODE_ID}\",\
container_label_com_docker_swarm_node_id=\"${NODE_ID}\",\
node_name=\"${nodeName}\"\
node_name=\"${NODE_NAME}\"\
} 1" > "${CONFIG_PATH}/node-meta.prom"

set -- /bin/node_exporter "${@}"
Loading