Code Monkey home page Code Monkey logo

Comments (10)

tronyx avatar tronyx commented on July 20, 2024

I believe the process would be:

  1. Remove the Nagios service dir: docker exec nagios rm etc/service/nagios
  2. Do your work.
  3. Recreate the symbolic link to start it again: docker exec nagios ln -s /etc/sv/nagios /etc/service

My container name is nagios, but yours may not be so you would need to adapt the commands accordingly.

from docker-nagios.

tronyx avatar tronyx commented on July 20, 2024

This doesn't actually appear to work. Hopefully Jason can enlighten us as I hate having to restart the container every time I change something with the config.

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

I don't really understand why you would do this? The point of this container is that it's running an up to date Nagios, if you're going to replace Nagios in the container, why not just create a fresh container for the older version?

Replacing files inside a running container is also a bad idea, if the container is updated you'd have to replace the files every time, a better way to do it would be to use a Docker file FROM jasonrivers/nagios - But I still don't understand the point, The image is created with Nagios, if you want an older version of Nagios, personally I would create a fresh container.

Which version of Nagios are you trying to run?

from docker-nagios.

dm2pg avatar dm2pg commented on July 20, 2024

from docker-nagios.

JasonRivers avatar JasonRivers commented on July 20, 2024

Use docker cp to copy the configs out of the container, you shouldn't store your configs in the container, you should use a volume to store configs in. (using -v when running the container).

If you wish to add extras to the image, you can create a Dockerfile with FROM jasonrivers/nagios and then add in any extra applications you want.
The point of Docker is that you can regenerate the image easily and re-create the container at any time, if you store you configuration inside the container then you lose that ability.

from docker-nagios.

dm2pg avatar dm2pg commented on July 20, 2024

from docker-nagios.

bpsizemore avatar bpsizemore commented on July 20, 2024

Since you didn't originally mount the container to a volume to write your data, try using the docker cp utility.

$: docker cp --help

Usage:	docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
	docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

Copy files/folders between a container and the local filesystem

Options:
  -a, --archive       Archive mode (copy all uid/gid information)
  -L, --follow-link   Always follow symbol link in SRC_PATH

Docker containers aren't designed to be used in the same way a traditional server would use them. E.g. If you run nagios on the host machine, you might periodically update configs manually and copy out data. To do this same setup on docker, you would keep a copy of your nagios config and build a new container everytime you want to update the container. You could also use a docker volume to mount the directory in the container where data is stored, to somewhere on the localhost, so that could be reused in other containers and easily saved for other use.

As an example, here is what my nagios repo looks like...

/nagios-repo/
----etc/ *where config is stored*
----libexec/ *where plugins are stored*
----Dockerfile
----Readme
----nagios_key.pem *ssh-key*

Then my dockerfile looks like

From jasonrivers/nagios

# Put Config Files in place
COPY ./etc/ /opt/nagios/etc
RUN mkdir -p /home/nagios/.ssh/

COPY ./libexec/ /opt/nagios/libexec/

# Setup Nagios Key Communication
COPY nagios_key.pem /opt/nagios/.ssh/nagios_key.pem
RUN chown nagios:nagios /opt/nagios/.ssh/nagios_key.pem && chmod 700 /opt/nagios/.ssh/nagios_key.pem

CMD [ "/usr/local/bin/start_nagios" ]

Anytime I need to update or change my nagios config. I take the following steps:

  1. Update config in repo
  2. docker build . -t nagios
  3. docker run -d --name nagios_container -p 0.0.0.0:3000:80 nagios

The only difference is that you are wanting to save data so will need to add a volume that mounts from a dir on your host to somewhere in the container where the data is stored.

from docker-nagios.

byron6910 avatar byron6910 commented on July 20, 2024

How Can eject the commadn "service restart nagios in the docker" ? I do change in the configuration file to add a new host. Thanks

from docker-nagios.

davralin avatar davralin commented on July 20, 2024

Restart the container.

from docker-nagios.

Kolossi avatar Kolossi commented on July 20, 2024

... or if the UI is running, just click the "Process Info" link near the bottom of the right hand menu (under "System" heading), then click "Restart the Nagios Process" link on the right under the "Process commands" heading.

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.