Commit 36ab872a authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Pone al día el proyecto

See merge request redmic-project/metric/node-exporter!5
parents 971b88c6 2887ff69
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>
+3 −1
Original line number Diff line number Diff line
CONFIG_PATH=/etc/node-exporter
PORT=9100
CONFIG_PATH=/home
HOST_PATH=/rootfs
MOUNT_POINTS_EXCLUDE=sys|proc|dev|etc|boot|tmp|run|.*/docker/containers
+15 −9
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
      - --no-collector.hwmon
    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