ConSol-Monitoring / omd-labs-docker

Docker images with OMD labs edition
https://labs.consol.de/omd/
23 stars 14 forks source link

PNP4Nagios reactivates after container rebuild #34

Closed Dennis14e closed 7 months ago

Dennis14e commented 10 months ago

Monitoring core: naemon Using omd with docker compose.

  1. Start omd-labs-docker
  2. Open shell, e.g. docker compose exec omd /bin/bash
  3. Switch to site user (here main): su - main
  4. Go to ~/etc/naemon/naemon.d/
  5. There is a pnp4nagios.cfg, because PNP4Nagios is enabled by default
  6. Run omd stop && omd config set PNP4NAGIOS off && omd start
  7. File is gone, PNP4Nagios is disabled.
  8. Run a docker compose restart, PNP4Nagios is still disabled, pnp4nagios.cfg doesn't exist
  9. Run a docker compose down && docker compose up -d, pnp4nagios.cfg exists, so it creates perfdata files
  10. Again open shell (see 2. & 3.), run omd config show PNP4NAGIOS
  11. It shows "off", which is clearly not the case.

I don't know if this is a omd or a omd-labs-docker problem, but because a restart works and only a rebuild fails, I think this is a docker problem.

My docker-compose.yml:

version: '3.7'

services:
  omd:
    build:
      context: .
      pull: true
      dockerfile_inline: |
        FROM consol/omd-labs-debian:latest
        RUN apt-get update \
            && apt-get install -y iputils-ping nano \
            && rm -rf /var/lib/apt/lists/*
        RUN ln -s /bin/ping /usr/bin/ping && \
            ln -s /bin/ping4 /usr/bin/ping4 && \
            ln -s /bin/ping6 /usr/bin/ping6
      args:
        NEW_SITENAME: main
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./data/.ssh:/opt/omd/sites/main/.ssh
      - ./data/local:/opt/omd/sites/main/local.mount
      - ./data/etc:/opt/omd/sites/main/etc.mount
      - ./data/var:/opt/omd/sites/main/var.mount
Dennis14e commented 10 months ago

My current workaround: Use an Ansible playbook to deactivate PNP4Nagios (again) on startup:

# playbook.yml
---
- name: Update OMD installation
  hosts: all

  tasks:
  - name: Disable PNP4Nagios
    become: yes
    become_user: "{{ SITENAME }}"
    become_method: "su"
    become_flags: "-"
    command: "omd config set PNP4NAGIOS off"
sni commented 10 months ago

i guess it has something to do with the way the etc folder is not directly mounted but synced. tbh, these containers are designed for testing purposes and one-time use only. The way docker works totally defeats the OMD update mechanism.