Skip to content

GlacialMagma/docker-librenms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Version Build Status Docker Stars Docker Pulls Docker Repository on Quay Donate Paypal

About

๐Ÿณ LibreNMS Docker image based on Alpine Linux and Nginx.
If you are interested, check out my other ๐Ÿณ Docker images!

Features

Included

From docker-compose

Docker

Environment variables

  • TZ : The timezone assigned to the container (default UTC)
  • PUID : LibreNMS user id (default 1000)
  • PGID: LibreNMS group id (default 1000)
  • MEMORY_LIMIT : PHP memory limit (default 256M)
  • UPLOAD_MAX_SIZE : Upload max size (default 16M)
  • OPCACHE_MEM_SIZE : PHP OpCache memory consumption (default 128)
  • LIBRENMS_POLLER_THREADS : Threads that poller-wrapper.py runs (default 16)
  • LIBRENMS_SNMP_COMMUNITY : Your community string (default librenmsdocker)
  • DB_HOST : MySQL database hostname / IP address
  • DB_PORT : MySQL database port (default 3306)
  • DB_NAME : MySQL database name (default librenms)
  • DB_USER : MySQL user (default librenms)
  • DB_PASSWORD : MySQL password (default librenms)
  • MEMCACHED_HOST : Hostname / IP address of a Memcached server
  • RRDCACHED_HOST : Hostname / IP address of a RRDcached server

Volumes

  • /data : Contains configuration, rrd database, logs, additional syslog-ng config files

Ports

  • 80 : HTTP port

Use this image

Docker Compose

Docker compose is the recommended way to run this image. Copy the content of folder examples/compose in /var/librenms/ on your host for example. Edit the compose and env files with your preferences and run the following commands :

touch acme.json
chmod 600 acme.json
docker-compose up -d
docker-compose logs -f

Command line

You can also use the following minimal command :

docker run -d -p 80:80 --name librenms \
  -v $(pwd)/data:/data \
  -e "DB_HOST=db" \
  crazymax/librenms:latest

-e "DB_HOST=db"
โš ๏ธ db must be a running MySQL instance

Notes

Edit configuration

You can edit configuration of LibreNMS by placing *.php files inside /data/config folder. Let's say you want to edit the WebUI config. Create a file called for example /data/config/webui.php with this content :

<?php
$config['page_refresh'] = "300";
$config['webui']['default_dashboard_id'] = 0;

This configuration will be included in LibreNMS and will override the default values.

Add user

On first launch, an initial administrator user will be created :

Login Password
librenms librenms

You can create an other user using the commande line :

$ docker exec -it --user librenms librenms php adduser.php <name> <pass> 10 <email>

โš ๏ธ Substitute your desired username <name>, password <pass> and email address <email>

Validate

If you want to validate your installation from the CLI, type the following command :

$ docker exec -it --user librenms librenms php validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.41
DB Schema | 253
PHP       | 7.2.7
MySQL     | 10.2.16-MariaDB-10.2.16+maria~jessie
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.6.5
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  You have not added any devices yet.
        [FIX] You can add a device in the webui or with ./addhost.php
[FAIL]  fping6 location is incorrect or bin not installed.
        [FIX] Install fping6 or manually set the path to fping6 by placing the following in config.php: $config['fping6'] = '/path/to/fping6';
[WARN]  Your install is over 24 hours out of date, last update: Sat, 30 Jun 2018 21:37:37 +0000
        [FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN]  Your local git branch is not master, this will prevent automatic updates.
        [FIX] You can switch back to master with git checkout master

Update database

To update the database manually, type the following command :

$ docker exec -it --user librenms librenms php build-base.php

Cron

If you want to enable the cron job, you have to run a "sidecar" container like in the docker-compose file or run a simple container like this :

docker run -d --name librenms-cron \
  --env-file $(pwd)/librenms.env \
  -v librenms:/data \
  crazymax/librenms:latest /usr/local/bin/cron

-v librenms:/data
โš ๏ธ librenms must be a valid volume already attached to a LibreNMS container

Syslog-ng

If you want to enable syslog-ng, you have to run a "sidecar" container like in the docker-compose file or run a simple container like this :

docker run -d --name librenms-syslog-ng \
  --env-file $(pwd)/librenms.env \
  -p 514 -p 514/udp \
  -v librenms:/data \
  crazymax/librenms:latest /usr/sbin/syslog-ng -F

You have to create a configuration file to enable syslog in LibreNMS too. Create a file called for example /data/config/syslog.php with this content :

<?php
$config['enable_syslog'] = 1;

Upgrade

To upgrade to the latest version of LibreNMS, pull the newer image and launch the container. LibreNMS will upgrade automatically :

docker-compose pull
docker-compose up -d

How can i help ?

All kinds of contributions are welcomed ๐Ÿ™Œ!
The most basic way to show your support is to star ๐ŸŒŸ the project, or to raise issues ๐Ÿ’ฌ
But we're not gonna lie to each other, I'd rather you buy me a beer or two ๐Ÿป!

Paypal

License

MIT. See LICENSE for more details.

About

๐Ÿณ LibreNMS Docker image based on Alpine Linux and Nginx

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

โšก