JasonRivers / Docker-Nagios

Docker image for Nagios
MIT License
231 stars 253 forks source link

Error: Failed to create IO broker set: Cannot allocate memory #135

Open manugu87 opened 2 years ago

manugu87 commented 2 years ago

docker pull jasonrivers/nagios:latest docker run --name nagios4 -p 0.0.0.0:8080:80 jasonrivers/nagios:latest

I don´t found any resolution, ¿can you help me?

Started runsvdir, PID is 11 checking permissions for nagios & nagiosgraph rsyslogd: [origin software="rsyslogd" swVersion="8.2001.0" x-pid="19" x-info="https://www.rsyslog.com"] start

Nagios Core 4.4.6 Copyright (c) 2009-present Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 2020-04-28 License: GPL

Website: https://www.nagios.org Error: Failed to create IO broker set: Cannot allocate memory

anobhask commented 1 year ago

change ulimit for docker container: --ulimit nofile=:

tukey42 commented 1 year ago

On my system nofile is already unlimited, but I got the same error running docker on PhotonOS. Running docker on another Ubuntu maschine, nagios works fine. Any other idea?

mariaa144 commented 1 year ago

Changing the ulimit didn't work for me either. I think docker might have changed something recently which is breaking the container. I'm using Arch Linux my versions below.

$ docker version
Client:
 Version:           23.0.1
 API version:       1.42
 Go version:        go1.20
 Git commit:        a5ee5b1dfc
 Built:             Sat Feb 11 13:58:04 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          23.0.1
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.20
  Git commit:       bc3805a0a0
  Built:            Sat Feb 11 13:58:04 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.18
  GitCommit:        2456e983eb9e37e47538f59ea18f2043c9a73640.m
 runc:
  Version:          1.1.4
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
$ uname -a
Linux xxx 5.15.94-1-lts #1 SMP Wed, 15 Feb 2023 07:09:02 +0000 x86_64 GNU/Linux

I am building Nagios in Docker from master but I also tried a release from back in April with the same results.

tukey42 commented 1 year ago

Sorry, I forgot to post my solution of the issue. The problem is, that NOFILE is much too high and nagios tries to allocate an array of this size and fails. I just added "--ulimit nofile=32768:32768" to my docker run command and that works for me.

mariaa144 commented 1 year ago

Setting the ulimits nofile worked for me once I applied it to the correct container. Bravo!

In my docker-compose.yml I did:

   ulimits:
      nofile:
        soft: 32768
        hard: 32768
pathia commented 4 months ago

The solution in this topic should be on the main page of this project !