jarischaefer / docker-librenms Goto Github PK
View Code? Open in Web Editor NEWDocker image for LibreNMS
License: MIT License
Docker image for LibreNMS
License: MIT License
Hello! I just want to ask how to config the e-mailing alert system of LibreNMS using docker? should I configure the docker environment for the smtp? Thank you so much!
Hello, I get this error when launching the image.
Starting rrdcached...
read_options: couldn't map "librenms" to a group, Sorry
librenms:
image: jarischaefer/docker-librenms
container_name: librenms
volumes:
- /Docker/appdata/LibreNMS/logs:/opt/librenms/logs
- /Docker/appdata/LibreNMS/rrd:/opt/librenms/rrd
networks:
- docker_default
ports:
- "80:80"
restart: unless-stopped
depends_on:
- db
environment:
- DB_HOST=db
- DB_PORT=3306
- DB_NAME=librenms
- DB_USER=librenms
- DB_PASS=XXXXXXXX
- POLLERS=4
- BASE_URL=http://localhost
- TZ=Europe/Paris
- PUID=1052
- PGID=105
Currently battling another issue, your latest throws me an ngnix HTTP 500.
2016/12/17 14:03:09 [crit] 42#42: *1 connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file or directory) while conn
ecting to upstream, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock
Checked, /var/run/php/php7.0-fpm.sock
does exist (with correct permissions), so I have currently no idea, how to proceed.
There is not much detail in the logs as well.
As one picture tells more than thousand words: https://s14.postimg.org/l7m286y69/Capture.png
@jarischaefer could you include composer in baseimage on next release to fix this?
Currently you have to run:
$ sudo apt-get update
$ sudo apt-get install composer
As LibreNMS seems to now depend on composer (not sure how, seems to be run happily without it), I think it should be included in your baseimage.
PHP 7.2 isn't supported yet, and running validate.php will throw up an error since the mcrypt extension is missing:
[FAIL] Missing PHP extension: mcrypt
[FIX] Please install mcrypt
(Also misses XML, but at least that package is available as php7.2-xml).
The script /etc/my_init.d/4_config has several bash errors.
First is the $(!1) in the beginning, should probably be $1.
Later in the file a space is missing before the ] sign in the if statement.
is there a way to set the time zone?
Hi @jarischaefer, looks like there is something broken in latest build as it does not include LibreNMS 1.38 but installs 1.37 instead.
Also build details displays an error building latest.
when running: docker exec librenms sh -c "cd /opt/librenms && php /opt/librenms/build-base.php"
I get:
WARNING: Cannot execute query (CREATE TABLE IF NOT EXISTS eventlog
( event_id
int(11) NOT NULL AUTO_INCREMENT, host
int(11) NOT NULL DEFAULT '0', datetime
datetime NOT NULL DEFAULT '0000-00-00 00:00:00', message
text CHARACTER SET latin1, type
varchar(64) CHARACTER SET latin1 DEFAULT NULL, reference
varchar(64) CHARACTER SET latin1 NOT NULL, PRIMARY KEY (event_id
), KEY host
(host
) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
): Invalid default value for 'datetime'
the librenms community is using this pbin.sh to help in troubleshooting installations.
Unfortunately it ends because of missing curl. Can this be added in the whole package?
I am using a non-default port for a MySQL docker instance on a synology NAS - 3307
I though I could specify this on the DB_HOST enviro setting:
-e DB_HOST=192.168.10.60:3307
But I get the error:
MySQL Error: Failed to parse address "192.168.10.60:3307:3306"
Soooo I guess that's not the way to specify it, are you able to change the default?
Any assistance appreciated.
Thanks for merging in my pull requests.
However it's not working 100% still due to the migration to .env files. .env files can't access the secret file to make use of them.
In LibreNMS we have a postInstall command for composer which would generate the .env file from config.php. Would the below be acceptable in /etc/my_init.d/6_permissions
and do you think it would work:
if [ ! -f "/opt/librenms/.env" ]
cd /opt/librenms/ && ./composer.phar install && chown -R librenms:librenms /opt/librenms/
fi
I get the error in the subject line when I try and add any host via cli or web interface. I've tried to add the host that docker is running on, as well as another host, with the same result. Do i need to open udp 161 or something?
When we can see it on alpinelinux? Thanks
root@f47df83609da:/opt/librenms# ./daily.sh
Re-running /opt/librenms/daily.sh as librenms user
Checking PHP version FAIL
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
Updating SQL-Schema FAIL
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
Updating submodules OK
Cleaning up DB FAIL
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
Fetching notifications FAIL
MySQL Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
Caching PeeringDB data OK
tried 1.31.03, 1.33, and 1.34-1. I originally was on 1.31.03, so I went back to that, while graphs seem to work, when I pulled your 1.3.4-1 image and tried to udpate the schema, it wouldn't work, showing the above errors.
Not seeing any flags to enable weathermap+weathermap cron, do you currently have it builtin?
I am running a DB in a container based on the steps listed in the post:
docker run --name librenms-mysql -d -e MYSQL_ROOT_PASSWORD=password -p 127.0.0.1:3306:3306 -v /my/persistent/directory/mysql:/var/lib/mysql mysql:5.6 --sql-mode=""
mysql --host=127.0.0.1 --user=root -ppassword -e "create database librenms;"
mysql --host=127.0.0.1 --user=root -p -e "GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%' IDENTIFIED BY 'librenms';"
I've validated that the DB is running file by creating another container and linking it to the DB container and running some basic mysql commands.
I created the librenms container as mentioned:
docker run -d -h librenms -p 9080:80 -e DB_HOST=127.0.0.1 -e DB_NAME=librenms -e DB_USER=librenms -e DB_PASS=anotherpass -e BASE_URL=http://x.x.x.x:9080 -e POLLERS=4 -e TZ=America/Chicago --link librenms-mysql:db -v /data/logs:/opt/librenms/logs -v /data/rrd:/opt/librenms/rrd --name librenms jarischaefer/docker-librenms
But when I run the following commands, I get the error Connection refused
:
docker exec librenms sh -c "cd /opt/librenms && php /opt/librenms/build-base.php"
I am trying to run this in a docker container but i have not been successfull
i have downloaded and setup my database properly (i think and it is up and running (in bridge mode). i try to do the same with this container but when i try to run the first script to initialize the database it is not working and gives the following error
[/share/container] # docker exec librenms sh -c "cd /opt/librenms && php /opt/librenms/build-base.php"
ERROR: Cannot connect to database:
PHP Warning: mysqli_connect(): (HY000/2002): Connection timed out in /opt/librenms/build-base.php on line 18
PHP Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /opt/librenms/build-base.php on line 20
can this image be executed in bridge mode and if so how?
Inspired by #37
The goal is to help users who run the container on slow platforms (hardware, internet connection, graph driver, ...).
Target: 300MB compressed size
Hi,
I am having issue that every 3-4 days all RRD files get owned by user different that librenms and then librenms as it cant update existing RRD files creates new files and interfaces.
I have already twice manually reowned files.
Using latest image
Any hints on what it can be?
Thanks.
Hi,
I'm wondering if it's possible this could be updated to use git to install LibreNMS rather than the zip so that you can get updates through?
root@librenms:/opt/librenms# ./snmp-scan.py
Could not import ipaddress module. Please install python-ipaddress or use python3 to run this script
Debian/Ubuntu: apt install python-ipaddress
RHEL/CentOS: yum install python-ipaddress
Trying to run snmp-scan.py fails, I assume due to lacking some packages in the container, would it be possible to add these?
Any chance you could add the snmp-scan option as it seems to be a missing option would be nice if i could enable it on the device that runs discovery. So that we could maybe SNMPDISCOVER_ENABLE as well and be able to trigger periodic SNMP scans?
If i use SSL and stopped container, i cannot starting it again.
docker:/ # docker start -a librenms
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/0_cron...
*** Running /etc/my_init.d/1_php...
*** Running /etc/my_init.d/2_ssl...
ln: failed to create symbolic link '/etc/nginx/sites-enabled/librenms.https': File exists
*** /etc/my_init.d/2_ssl failed with status 1
*** Killing all processes...
If i deleted '/etc/nginx/sites-enabled/librenms.https', i can started the container. But I stopped and started it again, this issue came up again.
What is the most easy way to update the docker to the last LibreNMS version?
Something is wrong with the image. If I go anywhere except the first page there is no image and no graphs are displayed.
My base url is set to 192.168.2.22:8668 very similar to your setup.
One of the best out here,
docker-compose variant would be helpful
Thank you!
when running this command while SSH'd into Synology BASH (after successfully creating the database in MySQL):
docker exec librenms sh -c "cd /opt/librenms && php /opt/librenms/build-base.php"
I get "MySQL Error: Connection refused"
here are docker settings for librenms:
-p 8084:80
-e DB_HOST=192.168.10.60
-e DB_NAME=librenms
-e DB_USER=librenms
-e DB_PASS=librenms
-e TZ=Europe/London
-e BASE_URL=http://192.168.1.97:8084
-e POLLERS=16
-e DB_PORT=3037
Not sure where I'm going wrong ...
After Install I get directly with screen with only the error MySQL Error
Are missing php7.0-memcached package.
And addConfig memcache enable adds value 'true' (with single quotes) and this dont match when create the memcache resource (on definitions.inc.php).
regards.
I have an odd issue where, when adding a host that is not on the local LAN subnet via the web UI or command-line, LibreNMS tells me that it can't ping the host. However I can ping and snmpwalk the same host from the container, and DNS resolution works as well.
If I force LibreNMS to perform no ping or snmp checks the host is added, but no data is polled as the host is always considered down. Interestingly running a snmp debug shows that LibreNMS is able to get data from the host.
root@librenms:/# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
root@librenms:/# ping <myhost>
PING <myhost> (104.x.x.x) 56(84) bytes of data.
64 bytes from <myhost> (104.x.x.x): icmp_seq=1 ttl=51 time=147 ms
64 bytes from <myhost> (104.x.x.x): icmp_seq=1 ttl=115 time=147 ms (DUP!)
64 bytes from <myhost> (104.x.x.x): icmp_seq=2 ttl=51 time=150 ms
64 bytes from <myhost> (104.x.x.x): icmp_seq=2 ttl=115 time=150 ms (DUP!)
^C
--- <myhost> ping statistics ---
3 packets transmitted, 2 received, +2 duplicates, 33% packet loss, time 2003ms
rtt min/avg/max/mdev = 147.889/149.158/150.466/1.256 ms
root@librenms:/# snmpwalk -v2c -c community <myhost> .1
iso.3.6.1.2.1.1.1.0 = STRING: "Linux zip 2.6.32-042stab120.20 #1 SMP Fri Mar 10 16:52:50 MSK 2017
x86_64"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (16133619) 1 day, 20:48:56.19
iso.3.6.1.2.1.1.4.0 = STRING: "R"
iso.3.6.1.2.1.1.5.0 = STRING: "zip"
I have $config['nets'][] = '10.9.12.0/24'; set in the config.docker.php file. But when i run ./snmp-scan.py it then says:
Scanning IPs:
Scanned 0 IPs: 0 known devices, added 0 devices, failed to add 0 devices
Runtime: 0.30 seconds
I also tried ./snmp-scan.py -r 10.9.12.1 but the same.
If i manually add the IP in LibreNMS it works fine... and if i dump config in libreNMS i can see the nets is set.
Any ideas?
Thanks!
For some reason the polling & daily.sh script are fail to run automatically. Both run when called via docker exec and don't have any errors. I've setup LibreNMS previously and don't recall needing to edit anything to get these working.
librenms@librenms-copy:~$ ./daily.sh'
Updating SQL-Schema OK
Cleaning up DB OK
librenms@librenms-copy:~$
Sometimes it would be beneficial to have some kind of text editor present to do the on the fly changes for testing. Could you please consider adding it?
Clean install, keeps throwing the following error Cannot make/remove an entry for the specified session
I go to validate my config and throws error Fail: The poller (librenms) has not completed within the last 5 minutes, check the cron job.
My setup command was docker run -d --restart unless-stopped -h librenms -p 80:80 -e DB_HOST=db -e DB_NAME=librenms -e DB_USER=librenms -e DB_PASS=******* -e BASE_URL=http://192.168.10.38 -e POLLERS=16 -e TZ=Australia/Adelaide --link librenms-mysql:db -v librenms_data:/opt/librenms/logs -v librenms_data:/opt/librenms/rrd --name librenms jarischaefer/docker-librenms
Any ideas, I have done a clean install.
Am I totally mistaken or is the version information incorrect? I updated to the latest container (1.34) and under LibreNMS > About, it still shows as 1.31.03.
Is this just me?
I ran docker-compose pull and but it broke my librenms.
I notice i quickly get the 502 Bad Gateway on the docker startup (I think this is normal anyway), but then i get an error 500 and nothing happens.
Inside the container I ran "php validate.php" and i get:
Component | Version |
---|---|
LibreNMS | 1.34 |
DB Schema | 214 |
PHP | 7.1.12-1+ubuntu16.04.1+deb.sury.org+1 |
MySQL | 5.7.20 |
RRDTool | 1.5.5 |
SNMP | NET-SNMP 5.7.3 |
==================================== |
[OK] Database connection successful
[FAIL] You have not set sql_mode='' in your mysql config.
[FIX] Set sql-mode='' in your mysql config file in the [mysqld] section.
[FAIL] Your database schema (214) is older than the latest (217).
[FIX] Manually run ./daily.sh, and check for any errors.
`
Any ideas?
Thanks
Hi,
A disk pressure was triggered quite often in one some of my kubernetes nodes, so I tried to figure out which container was taking space (and, apparently, growing).
It appears that in my librenms containers, /var/log/syslog
and /var/log/daemon.log
are growing really fast, because of rrdcached (+2GB per hour). They are both full of these 2 lines:
Nov 26 13:46:01 librenms-deployment-5968b5d8b7-9zxq2 rrdcached[17634]: replaying from journal: /var/tmp/rrd.journal.1511703737.063461
Nov 26 13:46:01 librenms-deployment-5968b5d8b7-9zxq2 rrdcached[17634]: Replayed 0 entries (0 failures)
Is there something to do to maybe set the rrdcached log filter?
Is there an mechanism, to reload config.custom.php after modifying it, without spawning new container?
Parsed the code and did not find any way to do it, I do think we should implement one though if it is not present currently.
IMHO, it would make sense to reload it on every container restart, as it should not delay startup much, but would make system more flexible.
I am busy installing your librenms image on a Synology RS815+ NAS server. After I have created the database and issued my Docker run command the UID and GID of the files config.docker.php, config.php and directory config.d have the UID and GID from root in stead of librenms after install. I used the following docker run command to install the cointainer:
docker run
-d
-p 8000:80
-p 8443:443
-e DB_HOST=192.168.1.248
-e DB_NAME=librenms
-e DB_PORT=3307
-e DB_USER=librenms
-e DB_PASS=librenms
-e TZ=Europe/Brussels
-e BASE_URL=https://192.168.1.248:8443
-e POLLERS=16
-v /volume1/docker/librenms/logs:/opt/librenms/logs
-v /volume1/docker/librenms/rrd:/opt/librenms/rrd
-v /volume1/docker/librenms/ssl:/etc/nginx/ssl:ro
-v /volume1/docker/librenms/config.custom.php:/opt/librenms/config.custom.php:ro
--name librenms
jarischaefer/docker-librenms
The validate.php scripts complains about this and I can not login to to librenms. After a restart of the docker image and 'cd /opt && chown -R librenms.librenms /opt/librenms' I can login and the validate.php script no longer gives error messages. There are some warnings left but it seemed to be working.
Am I doing something wrong or can this be a bug.
Erik
Hi,
I've noticed that when running the image in my docker swarm cluster, every time the service is restarted it looses all the RRD and DDBB... So, after looking at the Dockerfile I found the volumes where defined from there instead of defining them at the docker-compose level.
Why is that? Could it be removed from there so everyone can manage his/her own volumes as they wish?
Cheers.
https://docs.librenms.org/#Extensions/Services/
I want to enable Nagios plugin to perform basic ping remote IP to monitor the network. Is it possible to do that on this docker image?
Thanks. Your image is so great!
Is your image supposed to work with both "validate.php" and "daily.php?
I get the following error when running it:
Component | Version |
---|---|
LibreNMS | |
DB Schema | 192 |
PHP | 7.0.16-3+deb.sury.org~xenial+1 |
MySQL | 5.5.47-MariaDB |
RRDTool | 1.5.5 |
SNMP | NET-SNMP 5.7.3 |
========================================================== |
PHP Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character in /opt/librenms/validate.php:113
Stack trace:
#0 /opt/librenms/validate.php(113): DateTime->__construct('@', Object(DateTimeZone))
#1 {main}
thrown in /opt/librenms/validate.php on line 113`
Is there a reason why the docker-image does not use a git-pull to update LibreNMS?
I am monitoring a few servers that have IPMI support to provide additional sensor data, but it seems that ipmitool is not provided with the docker image. Currently i resolve it by manually installing it every time the container is updated, but it is not the cleanest solution. Could ipmitool be added into the docker image in the future?
In the web interface after adding a device I cannot see any graph information, it shows "Error Drawing Graph", so I looked at RRDTool Output which shows:
any idea?
Nevermind, it seemed to have resolved itself after running for a couple of hours.
I was thinking, maybe we should enable syslog Integration on this as well, but make it optional.
General idea would be make variable "SYSLOG" and if it is true, then apply relevant syslog-ng config, and expose UDP/TCP 514.
As volume "log" is already exposed, we could write all device logs into it to make them persistent and parseable for other containers or tools.
Currently it us just an idea, have not written any code for it yet, as I currently have no idea how useful it would actually be for others. Main reason is, why run separate container or syslog server, if LibreNMS container, pretty much already has all the tools included. Only config part is missing.
Hello,
I see a great amount of files in /var/spool/mqueue-client.
They are error emails from crontab.
As you said in your documentation, sendmail is not working, we should use SMTP for alerting, so system emails can't reach out too.
The simplest is to add a /dev/null redirection to the poller cron line, th only one which does not have one:
*/5 * * * * librenms . /etc/librenms_environment; /opt/librenms/cronic /opt/librenms/poller-wrapper.py PLACEHOLDER_POLLERS
PS:
By the way, is sendmail, as a package, mandatory in your container ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.