Synology SNMP Network Monitoring with LibreNMS Docker

Here’s my code…

docker run
-v /volume1/docker/mariadb:/var/lib/mysql
-e MYSQL_ROOT_PASSWORD=mypasswd
-e TZ=America/Los_Angeles
–name mariadb
-d
–restart always
mariadb:latest
–sql-mode=’’

running on a base DS918+

@beaker thank you

Getting the logs, error output

container still exists

docker logs mariadb

if you have removed the containers

stop mariadb from restarting itself without --restart

clear the files/folders in mariadb

rm -rvf /volume1/docker/mariadb/*
or use DSM GUI to delete the files/folders inside mariadb

without --restart always

docker run \
-d \
-v /volume1/docker/mariadb:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=root_password \
-e TZ=America/Los_Angeles \
--name mariadb \
mariadb:latest \
--sql-mode=''

Once it exits with error

docker logs mariadb

Could you copy/paste the error logs, probably last 10~20 lines will do…

I think I figured it out (with your help). When I used your run statement, the container didn’t start. But there were a couple log entries.
root@synology:/volume1/docker# docker logs mariadb
2020-05-07 19:44:41-07:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.12+maria~bionic started.
2020-05-07 19:44:42-07:00 [Note] [Entrypoint]: Switching to dedicated user ‘mysql’
2020-05-07 19:44:42-07:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.12+maria~bionic started.
2020-05-07 19:44:43-07:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD

I had a password in the run statement, but I was using a special character. Once I removed that special char, it worked fine w/ Jason’s original run statement. :slight_smile:

Continuing on…
-Daren

Next issue… (and no errors up until now on this fresh install)

root@synology:/volume1/docker/librenms# docker exec librenms setup_database

In Connection.php line 664:

SQLSTATE[HY000] [1049] Unknown database ‘librenms’ (SQL: select * from info
rmation_schema.tables where table_schema = librenms and table_name = migrat
ions and table_type = ‘BASE TABLE’)

In PDOConnection.php line 31:

SQLSTATE[HY000] [1049] Unknown database ‘librenms’

In PDOConnection.php line 27:

SQLSTATE[HY000] [1049] Unknown database ‘librenms’

from librenms log file…
root@synology:/volume1/docker/librenms# docker logs librenms
*** Running /etc/my_init.d/10_syslog-ng…
May 7 20:45:10 37a09ee3e3d4 syslog-ng[12]: syslog-ng starting up; version=‘3.13.2’
*** Running /etc/my_init.d/librenms_100_cron…
*** Running /etc/my_init.d/librenms_101_ssl…
*** Running /etc/my_init.d/librenms_102_ipv6…
*** Running /etc/my_init.d/librenms_103_timezone…
*** Running /etc/my_init.d/librenms_104_config…

LibreNMS\ComposerHelper::postInstall
Illuminate\Foundation\ComposerScripts::postInstall
@php artisan vue-i18n:generate --multi-locales --format=umd
*** Running /etc/my_init.d/librenms_105_environment…
*** Running /etc/my_init.d/librenms_106_daily…
*** Running /etc/my_init.d/librenms_107_create_default_files…
*** Running /etc/my_init.d/librenms_108_syslog…
*** Running /etc/my_init.d/librenms_109_services…
*** Running /etc/my_init.d/librenms_900_permissions…
setfacl: /opt/librenms/bootstrap/cache: Operation not supported
setfacl: /opt/librenms/logs: Operation not supported
setfacl: /opt/librenms/rrd: Operation not supported
setfacl: /opt/librenms/storage: Operation not supported
setfacl: /opt/librenms/storage/app: Operation not supported
setfacl: /opt/librenms/storage/app/public: Operation not supported
setfacl: /opt/librenms/storage/debugbar: Operation not supported
setfacl: /opt/librenms/storage/framework: Operation not supported
setfacl: /opt/librenms/storage/framework/cache: Operation not supported
setfacl: /opt/librenms/storage/framework/cache/data: Operation not supported
setfacl: /opt/librenms/storage/framework/sessions: Operation not supported
setfacl: /opt/librenms/storage/framework/testing: Operation not supported
setfacl: /opt/librenms/storage/framework/views: Operation not supported
setfacl: /opt/librenms/storage/logs: Operation not supported
chown: changing ownership of ‘/opt/librenms/conf.d/custom.config.php’: Read-only file system
chmod: changing permissions of ‘/opt/librenms/conf.d/custom.config.php’: Read-only file system
*** Booting runit daemon…
*** Runit started as PID 78
Starting nginx…
Starting php-fpm…
Starting rrdcached…
May 7 20:45:19 37a09ee3e3d4 cron[86]: (CRON) INFO (pidfile fd = 3)
May 7 20:45:19 37a09ee3e3d4 cron[86]: (CRON) INFO (Running @reboot jobs)
May 7 20:46:01 37a09ee3e3d4 CRON[104]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/alerts.php >> /dev/null 2>&1)
May 7 20:47:01 37a09ee3e3d4 CRON[151]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/alerts.php >> /dev/null 2>&1)
May 7 20:48:01 37a09ee3e3d4 CRON[171]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/alerts.php >> /dev/null 2>&1)
May 7 20:49:01 37a09ee3e3d4 CRON[187]: (librenms) CMD (. /etc/librenms_environment; /opt/librenms/alerts.php >> /dev/null 2>&1)

There is no /opt/librenms directory.

Did you create the tables in MariaDB??

Login to your MariaDB container via:
Try this first:
docker exec -it mariadb mysql -u root

If not:
docker exec -it mariadb mysql -u root -p

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

After creating the tables above

docker restart mariadb

Ahhh ok ok. That explains, it happens

This is normal, /opt is in your docker container

Yes, I had completed all those steps. :slight_smile:

root@synology:/volume1/docker# docker exec -it mariadb mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.4.12-MariaDB-1:10.4.12+maria~bionic mariadb.org binary distribution

Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> CREATE USER ‘librenms’@’%’ IDENTIFIED BY ‘1qaz2wsx’;
Query OK, 0 rows affected (0.127 sec)

MariaDB [(none)]> CREATE USER ‘librenms’@‘localhost’ IDENTIFIED BY ‘1qaz2wsx’;
Query OK, 0 rows affected (0.111 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO ‘librenms’@’%’;
Query OK, 0 rows affected (0.083 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye
root@synology:/volume1/docker# docker restart mariadb

Ok sweet. MariaDB is settled… let’s tackle LibreNMS next…

Could you post your librenms docker run command too? That way I can refer to both just in case you’ve changed any variables/naming.

At this stage I think you can just post your passwords if they generated, I highly recommend you start from scratch after we managed to deploy this time round, to make sure we start from a clean state.

I used exactly what was in the instructions, changing just the passwd & TZ.

root@synology:/volume1/docker/librenms# docker run \

-p 8668:80
-e DB_HOST=db
-e DB_NAME=librenms
-e DB_USER=librenms
-e DB_PASS=password
-e APP_KEY=base64:nN4CbqJ34Jdwbm0Sh8QhNIrpSTjvDXp64CU26k2tSt0=
-e BASE_URL=http://10.10.10.50:8668
-e TZ=America/Los_Angeles
–link mariadb:db
-v /volume1/docker/librenms/logs:/opt/librenms/logs
-v /volume1/docker/librenms/rrd:/opt/librenms/rrd
-v /volume1/docker/librenms/custom.config.php:/opt/librenms/conf.d/custom.config.php:ro
–name librenms
-d
–restart always
jarischaefer/docker-librenms:latest
37a09ee3e3d46ca6842dc6be2db6a479f0f7e3dafd0a1e476217dc326bcd4265
root@synology:/volume1/docker/librenms#

Thanks!

Thanks for the update

Command looks good…

Hmmmm

If the container is still running, could you execute the database setup again and see whether it shows the same errors?

Checking the logs, seems that it can connect into MariaDB but missing the LibreNMS database

Just tested a fresh install… and it worked on my end. Syno 916+

Could you try these commands, I’ve adjusted to match your settings

(ignore the TZ , we’re testing here)

mkdir /volume1/docker/mariadb-test

docker run \
-v /volume1/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=''

docker exec -it mariadb-test mysql -u root
(if you get error 2002, wait for few seconds and try again)

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

docker restart mariadb-test


mkdir -p /volume1/docker/librenms-test/{logs,rrd}
touch /volume1/docker/librenms-test/custom.config.php

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="base64:EnvObkEFPuBasVQ/kabnYM8GCKI8k1eN7SWaSA90wbI=" \
-e BASE_URL=http://10.10.10.50:8669 \
-e TZ=Asia/Singapore \
--link mariadb-test:db \
-v /volume1/docker/librenms-test/logs:/opt/librenms/logs \
-v /volume1/docker/librenms-test/rrd:/opt/librenms/rrd \
-v /volume1/docker/librenms-test/custom.config.php:/opt/librenms/conf.d/custom.config.php:ro \
--name librenms-test \
-d \
--restart always \
jarischaefer/docker-librenms:latest

(I’m using port 8669 here)

docker exec -it librenms-test setup_database
(this takes a while…)

docker exec librenms-test create_admin

Hopefully everything works, try logging in @ http://10.10.10.50:8669

Let me know if this set of commands works on your end, its basically the same command I ran with change of IP to match yours on the -e BASE_URL

(Fingers crossed :face_with_hand_over_mouth:)

Well, that worked. The only difference I can see is that you added “-it” in docker exec -it librenms-test setup_database command.

Ok, I’ll remove all the containers and images and try again.

Thank you!!!
-Daren

Great!!

Remember to remove the existing data folders for both mariadb and LibreNMS if you are starting fresh :sweat_smile:

Still find it weird that it didn’t work during your first attempt…

Maybe it’s the double-quotes for the app_key

This didn’t matter as well I realise when running the database setup. Was hoping it would show real-time database activity with the “-it” option, but it doesn’t, so just wait till the process is finished and it will output at the end

5 posts were split to a new topic: LibreNMS and Raspberry Pi

Hi,
I’m trying to set up the SMTP Office 365 relay to send alerts, but it fails.
The configuration seems to be good, but obviously it’s wrongs.

Someone has had the same problem??
Thank you :sweat_smile:

Hi @alrodgir and welcome to the forums :slight_smile:

What is your setup like?

Check/Allow firewall going out for smtp port 587 on the host that you installed LibreNMS on

1 Like

I’m talking about librenms configuration.
My network admin is reviewing the firewall configuration, I’ll answer you ASAP about this config.

Erm…

which parts are you in control?

Router < > LibreNMS Host (Synology? Server? VM? Laptop? PC?)

If you have another SMTP server to try on, it would be great to filter out whether it is the settings, or network wide blockage

  1. Another SMTP server
    a) Fails
    Host/Network Problem
    b) Success
    Office365 config problem

If you are on Syno and firewall turned on, please make sure SMTP outgoing is allowed. If you have to ask an network admin… they might be blocks/policies in the network that you are unaware of.

When you click on Test Email, what error does LibreNMS returns you?

Oh, sorry for being so concise :sweat_smile:
My set up is so simply:
Synology NAS with Librenms docker.
The Synology firewall is off.
Moikrotik router.
All output traffic it’s allowed.

Maybe I can try with the Google SMTP server :thinking:

When I click the test I obtain this Captura3
But, if I configure a printer to alert directly, with the same config, the printer alert correctly.

1 Like

Ok now we are getting somewhere… :smiley:

It seems the auth returns error, so network is ok as it’s able to contact the smtp server

Try unchecking “Auto TLS” and test again

Yea, this test should help too if above doesn’t work

hi all, an update to recent test deployment of jarischaefer’s LibreNMS image,
its broken on both Synology and general Debian installs

Do NOT update to latest image

Do NOT update to latest image if you doing maintenance of your containers

Tested on:
Syno 916+
DSM 6.2.3-25426

Version 1.65.1 - Sat Jul 11 2020 03:56:16 GMT+0800
Database Schema 2020_06_23_00522_alter_availability_perc_column (170)
Web Server nginx/1.15.8
PHP 7.4.7
Python 3.6.9
MySQL 10.4.12-MariaDB-1:10.4.12+maria~bionic
Laravel 6.18.20
RRDtool 1.7.0

Discovery works but never polls after

Test with Ubuntu VM

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

Thought I’d test this image in a VM to cancel out some Syno permission problems to make sure the image is working

poller-wrapper.py error

Latest working version: 1.63

If anyone tested with the latest version and works, would appreciate if they could report with any work arounds/solutions :slight_smile:

For new users deploying a fresh install, I’ve tested from latest, v1.65, v.1.64, with poller-wrappy.py errors, please use v1.63

Version 	1.63 - Tue Apr 28 2020 11:52:42 GMT+0800
Database Schema 	2020_04_19_010532_eventlog_sensor_reference_cleanup (164)
Web Server 	nginx/1.15.8
PHP 	7.4.5
MySQL 	10.5.4-MariaDB-1:10.5.4+maria~focal
RRDtool 	1.7.0

Eg:
docker pull jarischaefer/docker-librenms:1.63

Meanwhile I’ll go report to jarischaefer :sweat_smile: