/docker-munin-mongodb

Docker image for providing MongoDB statistics to Munin

Primary LanguageDockerfile

docker-munin-mongodb

Docker image for providing MongoDB statistics to Munin via a munin-node instance.

What's inside

How to build

git clone https://github.com/paulchen/docker-munin-mongodb.git
docker build docker-munin-mongodb -t docker-munin-mongodb

Connectivity

  • Connects to an instance of MongoDB at localhost:27017.
  • Runs munin-node at port 4949.

How to run

When running the image, make sure to connect port 27017 to your running MongoDB and to expose port 4949.

As this image was created having instances of MongoDB and Rocket.Chat in mind that are run via Docker (see https://docs.rocket.chat/installing-and-updating/docker-containers/systemd), the command to run the image might look like this (which will wire port 4949 from the image to port 4950 on the host):

docker run --name docker-munin-mongodb --link mongo:mongo --net=rocketchat_default -p 127.0.0.1:4950:4949 -p [::1]:4950:4949 docker-munin-mongodb:latest

A complete systemd unit file might look like this:

[Unit]
Description=docker-munin-mongodb
Requires=docker.service
Requires=mongo.service
After=docker.service
After=mongo.service

[Service]
EnvironmentFile=/etc/environment
User=root
Restart=always
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker stop docker-munin-mongodb
ExecStartPre=-/usr/bin/docker rm docker-munin-mongodb

ExecStart=/usr/bin/docker run \
    --name docker-munin-mongodb \
    --link mongo:mongo \
    --net=rocketchat_default \
    -p 127.0.0.1:4950:4949 \
    -p [::1]:4950:4949 \
    docker-munin-mongodb:latest

ExecStop=-/usr/bin/docker stop docker-munin-mongodb
ExecStop=-/usr/bin/docker rm docker-munin-mongodb

[Install]
WantedBy=multi-user.target

Both the above docker run command and the systemd unit will wire the image's port 4949 to localhost:4950. Configure a new host in your instance of Munin that connects to that port.