Docker jasonrivers/nagios Permissions Problem

I was running this docker image proxied via traefik but I was receiving an error message in the Nagios web interface:

docker nagios Error: Could not read object configuration data

And in the logs from the container:

container_name | Warning: File '/opt/nagios/var/perfdata.log' could not be opened - service performance data will not be written to file!
container_name | Error: Unable to create temp file '/opt/nagios/var/nagios.tmpAofds4' for writing status data: Permission denied

To solve the issue I connected to the container:

docker exec -it container_name bash

And set the nagios user as the owner of the ‘var’ directory:

chown nagios /opt/nagios/var/

Then restarted the container.

I also used the following docker-compose.yml file for proxying via traefik:

version: '2'
services:
  my-nagios:
    image: jasonrivers/nagios:latest
    ports:
      - "8181:80"
    environment:
      - NAGIOS_FQDN=sub.domain.com
    volumes:
      - /var/containers/nagios/dirs/etc/:/opt/nagios/etc/
      - /var/containers/nagios/dirs/var:/opt/nagios/var/
      - /var/containers/nagios/dirs/plugins:/opt/Custom-Nagios-Plugins
    restart: always
    labels:
      - traefik.backend=nagios
      - traefik.frontend.rule=Host:monitor.redbranch.net
      - traefik.docker.network=proxy
    networks:
      - internal
      - proxy
networks:
  proxy:
    external: true
  internal:
    external: false

 

 

 

 

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>