jarischaefer / docker-librenms

Docker image for LibreNMS
MIT License
114 stars 37 forks source link

v:latest, 1.64 poller-wrapper.py errors #118

Closed qwebie closed 4 years ago

qwebie commented 4 years ago

Hi, I am author for https://jasonloong.com/2017/synology-snmp-network-monitoring-with-librenms-docker/

been using your image from the beginning, great job and thank you very much!

Reporting in that the image doesn't work for latest (1.65.1), v1.64

Tested on Synology 916+ / DSM 6.2.3-25426 (v1.65.1)

First time discovery works but device is not polled thereafter

Running poller-wrapper.py gives the follow errors:

Screenshot 2020-07-20 at 6 34 43 AM

Tested on Ubuntu 18.04.4 VM (v1.65.1, v1.64) v1.65.1 - Same error as above v1.64 - missing pip3/python modules (sorry, I didn't take a screenshot, took a quick glance) v1.63 - works as expected

All the tested versions run the following docker with changes to the tag at the end, and clearing of all persistent databases/files, containers before a new container

Docker MariaDB

docker run \
-v /my/path/docker/mariadb-test:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD="rooting" \
-e TZ=Asia/Singapore \
--name mariadb-test \
-d \
--restart always \
mariadb:latest \
--sql-mode=''

SQL Database

CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'%' IDENTIFIED BY 'libre_password';
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'libre_password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%';
FLUSH PRIVILEGES;
exit

LibreNMS container

docker run \
-p 8669:80 \
-e DB_HOST=db \
-e DB_NAME=librenms \
-e DB_USER=librenms \
-e DB_PASS=libre_password \
-e APP_KEY=generated_key \
-e BASE_URL=http://IP:8669 \
-e TZ=Asia/Singapore \
--link mariadb-test:db \
-v /my/path/docker/librenms-test/logs:/opt/librenms/logs \
-v /my/path/docker/librenms-test/rrd:/opt/librenms/rrd \
-v /my/path/docker/librenms-test/custom.config.php:/opt/librenms/conf.d/custom.config.php:ro \
--name librenms-test \
-d \
--restart always \
jarischaefer/docker-librenms:latest
E-t-z commented 4 years ago

I have not checked your guide yet, but it works fine here:

LibreNMS: 1.65.1 (using tag:latest) Synology DS1019+ / DSM: 6.2.3-25426

There is one major difference between mine and your setup, you are using DB container while I'm using Synology MariaDB package. Your error message also clearly states, that LibreNMS container cannot connect to your DB container. In any case, does your DB username, by any chance, contain any special characters, like @?

qwebie commented 4 years ago

LibreNMS: 1.65.1 (using tag:latest) Synology DS1019+ / DSM: 6.2.3-25426

Thank you for the update! That’s reassuring that it works on the same version for Syno

Your error message also clearly states, that LibreNMS container cannot connect to your DB container.

That’s probably a python issue there, there’s probably new config or new wrapper by LibreNMS

If the mariadb container has problems, v1.63 shouldn’t work because it can’t connect to the {db} hostname set by me and linked to the mariadb-test container...

In any case, does your DB username, by any chance, contain any special characters, like @?

Nope, they are what you see as in the SQL console commands typed above, as it’s for testing. Another test is that running the first database setup command by image works and returns no errors (for all the tested tags)

By the way, was your installation an upgrade from a previous or a fresh install?

E-t-z commented 4 years ago

By the way, was your installation an upgrade from a previous or a fresh install?

Upgrade: Download from registry, clean container, start container. DB stays the same as DB is on the host, only schema is updated.

qwebie commented 4 years ago

Upgrade: Download from registry, clean container, start container. DB stays the same as DB is on the host, only schema is updated.

Weird, I had a working but testing LibreNMS (can’t remember the version but definitely before 1.64) running as above docker (practically the same other than the generated key), did an upgrade to v1.65.1, and poller broke, which led me to test in a VM

jarischaefer commented 4 years ago

Could you please post the output of docker inspect librenms (replace librenms with the container name)? Make sure to remove credentials.

qwebie commented 4 years ago

Hi @jarischaefer thank you for the reply

Here's the full log output from creation to adding of device https://pastebin.com/JgfsC3SP

jarischaefer commented 4 years ago

Please use database or an alias that is not db for the database link. The DB_PORT environment variable is overwritten by Docker, see https://docs.docker.com/compose/link-env-deprecated/ for more information.

qwebie commented 4 years ago

Thank you, changed mariadb alias to another name other than "db" >> "libredb" fixes the poller-wrapper.py error, first discovery works but graphs do not update.

Next, I changed the mariadb container to run with the following options instead and everything works as expected (both Syno and VM)

mariadb:latest \
--innodb_file_per_table=1 \
--lower_case_table_names=0

Can't seem to find in their official doc that shows that it's still a requirement for mariadb to run in non-strict mode, just the above options when setting up