Code Monkey home page Code Monkey logo

Comments (32)

samz-github avatar samz-github commented on July 20, 2024 5

This issue is not resolved yet..

from docker-nagios.

jonnymccullagh avatar jonnymccullagh commented on July 20, 2024 2

I fell over this issue today and would recommend that the documentation/readme be updated. Recommending the volume mount for nagiosgraph-etc was added in PR 64 but I have opened PR 146 to remove that line from the readme.
/opt/nagiosgraph/etc contains the following files by default.

access.conf     labels.conf               nagiosgraph-nagios.cfg  nagiosgraph_fr.conf
datasetdb.conf  map                       nagiosgraph.conf        ngshared.pm
groupdb.conf    nagiosgraph-apache.conf   nagiosgraph_de.conf     rrdopts.conf
hostdb.conf     nagiosgraph-commands.cfg  nagiosgraph_es.conf     servdb.conf

Mounting an empty volume at that location hides these files. I would suggest that new users do not want that to happen and experienced users will be able to copy those files out before mounting a volume over it.

from docker-nagios.

i15e avatar i15e commented on July 20, 2024 1

Per the comments above I worked around this by creating a temporary container and copying /opt/nagiosgraph/etc to the host filesystem's nagiosgraph basedir:

(c=$(docker create jasonrivers/nagios:latest) && {
   sudo docker cp -a $c:/opt/nagiosgraph/etc /HOST/PATH/TO/nagiosgraph
   docker rm $c >/dev/null
})

from docker-nagios.

herbalizer404 avatar herbalizer404 commented on July 20, 2024

Or maybe, what are the good rights to apply to the directories?

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

Hello,

Same issue here:

Can't locate ngshared.pm in @INC (you may need to install the ngshared module) (@INC contains: /opt/nagiosgraph/etc /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /opt/nagiosgraph/bin/insert.pl line 41

I've tried with latest, 4.4.0 and 4.3.2. Maybe I have missed something ?

Let me know,
Best
Nicolas

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

Yeaa there is some issue with perl path like /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 ...etc.

The workaround is to reinstall NagiosGraph. Here is how you can do that:

Start your container with volumes
#Enter your container
docker exec -it nagios4 /bin/bash

#Clean /opt/nagiosgraph folder --- you will receive ...etc and ... var are busy dont worry.
rm -rf /opt/nagiosgraph

#Build your NagiosGraph --- you dont need to download it its already there just reinstall it.
cd /tmp/nagiosgraph &&
./install.pl --install
--prefix /opt/nagiosgraph
--nagios-user ${NAGIOS_USER}
--www-user ${NAGIOS_USER}
--nagios-perfdata-file ${NAGIOS_HOME}/var/perfdata.log
--nagios-cgi-url /cgi-bin
&&
cp share/nagiosgraph.ssi ${NAGIOS_HOME}/share/ssi/common-header.ssi

No errors anymore.

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

I'd like to get more info on this, I am not seeing these errors at all.
Which log are you seeing these errors in?
Are you running the latest 4.4.1?
Are you getting the error when it's creating graphs or when you're trying to view them within Nagios?
What is the "action_url" you are using?

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

Which log are you seeing these errors in? --- Docker logs ... docker logs -f nagios4
Are you running the latest 4.4.1? --- yes its latest build 4.4.1
Are you getting the error when it's creating graphs or when you're trying to view them within Nagios? --- when you run the container you get the errors in the logs so graphs are not working at all.
What is the "action_url" you are using? --- I dont think is relevant the problem is when /opt/nagiosgraph/bin/insert.pl script is executed its searching python in /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 the problem is the /usr/local/lib/ folder does not contain anything.

That issues is only when you specify volumes for nagiosgraph (options below). If you dont use them its fine. If you run it without volumes if fine. As I said I didn't deep dive what is the problem I just reinstall it and now its fine.
-v /path-to-nagiosgraph-var:/opt/nagiosgraph/var
-v /path-to-nagiosgraph-etc:/opt/nagiosgraph/etc \

#Docker log pastebin
https://www.pastiebin.com/5b3c978f2fe63

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

Thanks, OK so this looks like the nagiosgraph install is putting files in etc, so when externally mounted those files are no longer in-place. I understand the issue, I'll take a look and see if I can get the install of nagiosgraph to be a little more sensible with where it's putting files it requires.

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

You can mount share over any folder and the filesystem will use latest mount. If you unmount the volume you will start seeing files from first mount ,so solution is to:
mount volume before installation
copy files somewhere mount and then move them back

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

Yep, That is one option to copy files after the container starts (I do this with example configs if there is no configs found), The alternative will be to have those files elsewhere anyway, I am looking at both options right now.

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

@vhristev once dockerhub has built the latest commit, this should fix this issue, If the required file is not in /opt/nagiosgraph/etc then it will re-run the installation, in my tests, it is renaming the existing config files with a date if they exist. This will only run if ngshared.pm is not in the directory.

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

@herbalizer404 @nicocolt ^^

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

Hello,

Got this issue with the new image:
Warning: File '/opt/nagios/var/perfdata.log' could not be opened - service performance data will not be written to file! nagios: Warning: File '/opt/nagios/var/perfdata.log' could not be opened - service performance data will not be written to file! Error: Unable to create temp file '/opt/nagios/var/nagios.tmpwmeo2C' for writing status data: Permission denied nagios: Error: Unable to create temp file '/opt/nagios/var/nagios.tmpwmeo2C' for writing status data: Permission denied

Reinstall of nagiosgraph shows this error: nagios not found in any of:

my running command is, as root:
docker container run -d --name nagios4 -v /root/docker-nagios/etc:/opt/nagios/etc -v /root/docker-nagios/var:/opt/nagios/var -v /root/docker-nagios/Custom-Nagios-Plugins:/opt/Custom-Nagios-Plugins -v /root/docker-nagios/nagiosgraph/var:/opt/nagiosgraph/var -v /root/docker-nagios/nagiosgraph/etc:/opt/nagiosgraph/etc -p 0.0.0.0:8080:80 jasonrivers/nagios:latest

Best regards

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

That is permissions related.

When you create your volume folders you must be sure your docker user can write in those folders. So if you create it with 'root' account change owner to your docker user. I dont know with which user your docker is running so check it out with "ps aux | grep docker"

If you want more info about that check that post: https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

Im not sure what you exactly doing but you can see its permissions issue in the log.
Unable to create temp file '/opt/nagios/var/nagios.tmpwmeo2C' for writing status data: Permission denied

Volumes are share points if you don't create the folders below and give them correct permissions its not going to work. Folders below must exist with correct permission. When you start docker with -v its not creating the folders for you:
Try commands below:

Create folders

mkdir /root/docker-nagios/etc /root/docker-nagios/var /root/docker-nagios/Custom-Nagios-Plugins /root/docker-nagios/nagiosgraph/var /root/docker-nagios/nagiosgraph/etc

Just for the test give 777 permissions.

chmod -R 777 /root/docker-nagios/etc /root/docker-nagios/var /root/docker-nagios/Custom-Nagios-Plugins /root/docker-nagios/nagiosgraph/var /root/docker-nagios/nagiosgraph/etc

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

@nicocolt latest commit should take ownership of the directories when Nagios starts.

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

vhristev avatar vhristev commented on July 20, 2024

JasonRivers last post is that he fix permissions ,so pull the latest code and try again.

As I said its a matter of user ownership ,so when you run the image you can see which user ID is creating files and chown to that ID

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

@nicocolt This should work fine, I do exactly that, What version of NRPE are you running on the host? I recommend using version 3.2.1 (Which is what the nagios container is running), Is it failing for other hosts or only the host that the container is running on? Could you raise a new issue for this and include your config for monitoring the host?

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

nicocolt avatar nicocolt commented on July 20, 2024

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

I'm not sure about a binary package for NRPE I have always compiled from source because distro packages are always out of date. Please raise a new issue if you want further help.

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

Closing as I believe original issue is resolved.

from docker-nagios.

itsmepetrov avatar itsmepetrov commented on July 20, 2024

same here

from docker-nagios.

mabazyar avatar mabazyar commented on July 20, 2024

Yeaa there is some issue with perl path like /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 ...etc.

The workaround is to reinstall NagiosGraph. Here is how you can do that:

Start your container with volumes
#Enter your container
docker exec -it nagios4 /bin/bash

#Clean /opt/nagiosgraph folder --- you will receive ...etc and ... var are busy dont worry.
rm -rf /opt/nagiosgraph

#Build your NagiosGraph --- you dont need to download it its already there just reinstall it.
cd /tmp/nagiosgraph &&
./install.pl --install
--prefix /opt/nagiosgraph
--nagios-user ${NAGIOS_USER}
--www-user ${NAGIOS_USER}
--nagios-perfdata-file ${NAGIOS_HOME}/var/perfdata.log
--nagios-cgi-url /cgi-bin
&&
cp share/nagiosgraph.ssi ${NAGIOS_HOME}/share/ssi/common-header.ssi

No errors anymore.

It works like a dream for me...Thanks for sharing your experience 👍

from docker-nagios.

davorceman avatar davorceman commented on July 20, 2024

Hello, just to say... I'm also getting this error with 4.4.3 version

Can't locate ngshared.pm in @inc (you may need to install the ngshared module) (@inc contains: /opt/nagiosgraph/etc /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /opt/nagiosgraph/bin/insert.pl line 41.

from docker-nagios.

kaka987 avatar kaka987 commented on July 20, 2024

https://github.com/mconf/nagios-etc/blob/master/nagiosgraph/ngshared.pm
It works ok after putting the file here: nagiosgraph/etc

from docker-nagios.

iercan avatar iercan commented on July 20, 2024

I had same issue. Then I realized because of I mount my own empty nagiosgraph/etc directory nagios can not see any conf and ngshared.pm file. I fixed issue by creating another container without any volume mount and copy all files from /opt/nagiosgraph/etc to old one. To fix these issue nagios_start may create all these files when etc directory is empty.

from docker-nagios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.