viper0131 / check_mk

Check_MK docker version
21 stars 20 forks source link

Can't start container #27

Closed mrwhite2 closed 6 years ago

mrwhite2 commented 6 years ago

hello

unfortunately I have always the same error when I try to start the container. Any Ideas?

docker-compose file: check_mk: image: nlmacamp/check_mk container_name: check_mk ports:

error: check_mk | Starting npcd...touch: cannot touch ‘/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid’: No such file or directory check_mk | chown: cannot access ‘/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid’: No such file or directory check_mk | An Error occured while reading your config on line 197 check_mk | Message was: "Could not open pidfile '/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid': No such file or directory" check_mk | OK check_mk | /omd/sites/mva/etc/rc.d/80-nagios: line 72: /omd/sites/mva/tmp/nagios/nagios.cfg: No such file or directory check_mk | Nagios configuration file /omd/sites/mva/tmp/nagios/nagios.cfg not found. Terminating... check_mk | Starting apache...OK check_mk | Initializing Crontab...OK

cheers, mrwhite2

mcgege commented 6 years ago

Hi mrwhite2,

this looks like the SYS_ADMIN capability is missing and/or the site mva wasn't initialized fully ... since version 1.5 the omd create command needs SYS_ADMIN caps to mount a tmpfs in [/opt]/omd/sites/mva/tmp.

Does it work if you startup check_mk as a "normal" docker container (without docker-compose)?

mburni commented 6 years ago

Hi mcgege,

I can reproduce the error when starting check_mk as a "normal" container:

docker run -it --rm --name check_mk --publish 99:5000 --cap-add=SYS_ADMIN nlmacamp/check_mk:1.5.0p2

Adding /opt/omd/sites/mva/tmp to /etc/fstab.
Creating temporary filesystem /omd/sites/mva/tmp...mount: tmpfs is write-protected, mounting read-only
mount: cannot mount tmpfs read-only
ERROR
Created new site mva with version 1.5.0p2.cre.

  The site can be started with omd start mva.
  The default web UI is available at http://2adc8857b917/mva/

  The admin user for the web applications is cmkadmin with password: LWkp2Yxx
  (It can be changed with 'htpasswd -m ~/etc/htpasswd cmkadmin' as site user.
)
  Please do a su - mva for administration of this site.

Updating password for user cmkadmin
Doing 'start' on site mva:
Creating temporary filesystem /omd/sites/mva/tmp...mount: tmpfs is write-protected, mounting read-only
mount: cannot mount tmpfs read-only
ERROR
Starting mkeventd...OK
Starting rrdcached...OK
Starting npcd...touch: cannot touch ‘/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid’: No such file or directory
chown: cannot access ‘/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid’: No such file or directory
An Error occured while reading your config on line 197
Message was: "Could not open pidfile '/omd/sites/mva/tmp/pnp4nagios/run/npcd.pid': No such file or directory"
OK
/omd/sites/mva/etc/rc.d/80-nagios: line 72: /omd/sites/mva/tmp/nagios/nagios.cfg: No such file or directory
Nagios configuration file /omd/sites/mva/tmp/nagios/nagios.cfg not found. Terminating...
Starting apache...OK
Initializing Crontab...OK

Can get it to work if using --privileged instead of --cap-add=SYS_ADMIN.

Regards, Michael

mrwhite2 commented 6 years ago

Hi mcgege

Sorry, I was out off town ;) I also tried "--cap-add=SYS_ADMIN" with "Docker Compose" and as a "Normal Container" and it was not working. With option --privileged it works like a charm, also with "Docker Compose".

If you would expose port 6557 also I would be happy, beacuase I use distributed monitoring and for the livestatus the container.

Cheers, Patrick

mcgege commented 6 years ago

@mrwhite2 @mburni Could you please tell me which operating system / distribution you are using? And what is your docker version?

mcgege commented 6 years ago

@mrwhite2 You can expose this port with --publish 6557:6557 when initializing the container

mrwhite2 commented 6 years ago

@mcgege OS: Ubuntu 18.04.1 LTS Docker Compose Version: 1.17.1 Docker Version: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:24:51 2018 OS/Arch: linux/amd64 Experimental: false

mcgege commented 6 years ago

Hmm ... it looks to me as this depends on the os and/or docker version. I have now updated the README (#29) on this toppic ... if someone identifies the the root cause please give me an update ...

mburni commented 6 years ago

Docker version 17.03.2-ce, build f5ec1e2 OS Ubuntu 16.04.4 LTS