Open myhellone opened 6 years ago
Hi @myhellone
Did you migrate the existing database to the new external database or if you are starting fresh, have you followed the setup instructions here: https://www.icinga.com/docs/icinga2/latest/doc/02-getting-started/#setting-up-the-mysql-database ?
Hi @jjethwa , thanx for you replay. I use instruction from https://github.com/jjethwa/icinga2 paragraph MySQL connections / Moving to separate MySQL-container.
I will let you know when I check the instructions from you
hi jjethwa,
i started with your icinga2-docker-container some days ago and configured my home-net. so far, so good.
now i want to move the database from the docker to external mysql-db, running on my synology (MariaDB 10)
first i exporte the three databases and import them into the maria-db (incl. user 'icinga2'). next, i tested from the icinga-container the access to the new databases - ok.
then i stopped the container, set the enviroment-variables MYSQL_ROOT_PASSWORD, DEFAULT_MYSL_PASS to ther correkt new values, DEFAULT_MYSQL_HOST & DEFAULT_MYSQL_PORT
but the container dont' start any more
i mad fresh copies and testing around ... in the moment, when setting MYSQL_ROOT_PASSWORD, its not possible to start the container.
sudo docker start -i icinga2_bad
Generating locales (this might take a while)...
de_DE.UTF-8...[....] Starting MariaDB database server: mysqld done
Generation complete.
[ ok . ..
Pinging localhost:3306
mysqld is alive
Site 000-default already enabled
Site icingaweb2-ssl already disabled
Site icingaweb2-ssl-redirect already disabled
Pinging localhost:3306
mysqld is alive
warning/cli: Feature 'ido-mysql' already enabled.
warning/cli: Feature 'livestatus' already enabled.
warning/cli: Feature 'compatlog' already enabled.
warning/cli: Feature 'command' already enabled.
ERROR 1045 (28000): Access denied for user 'root'@'172.17.0.4' (using password: YES)
run-parts: /opt/setup/50-icinga2 exited with return code 1
so tried your description
$ sudo docker exec jordan-icinga21 i2-port-mysqldb
/usr/local/bin/i2-port-mysqldb: line 5: MYSQL_ROOT_PASSWORD: No MySQL Root password set
i don't wonder, the env-variable isn't set ... when i set it, the contaner doesn't start ...
what's my mistake? can you guve me an hint?
i made a mistake creating the container - i forgot to create th suggeted volumes. i am not sure, is it possible to make the volumes later?
thank you for your time regards christian
Hi @demel42
Just to make sure, your MYSQL_ROOT_PASSWORD is not set to a null/empty value, right? Also, by default, most MySQL installs do not allow the root account to log in remotely, only local. Can you make sure root is allowed to login remotely?
hi jjethwa,
thanks for your fast answer,
looking in the database of a fresh container, the root has no password ( the column 'password' in the table 'user' is empty). calling mysql, its asks for a password but hitting [enter] ist needed.
i've tried to set up a container with given MYSQL_ROOT_PASSWORD in the docker enviroment - the contaner don't start's.
i have changed the password of root with the normal mysql-statement, don't help.
the root-access to the remote maria-db is possible and checked with a msql-call in the container.
the (new) root-mysl-password contains only char's and number's to avoid problems with special characters.
thanks a lot demel
Am 11.03.2019 um 22:10 schrieb Jordan Jethwa notifications@github.com:
Hi @demel42
Just to make sure, your MYSQL_ROOT_PASSWORD is not set to a null/empty value, right? Also, by default, most MySQL installs do not allow the root account to log in remotely, only local. Can you make sure root is allowed to login remotely?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @demel42
That's really strange that https://github.com/jjethwa/icinga2/blob/master/content/opt/setup/50-icinga2 is complaining that MYSQL_ROOT_PASSWORD is not set. Are the other vars getting set? Do you mind sharing the docker run command (masking the passwords)?
That's really strange that https://github.com/jjethwa/icinga2/blob/master/content/opt/setup/50-icinga2 is complaining that MYSQL_ROOT_PASSWORD is not set. Are the other vars getting set?
@jjethwa You probably mean this error message?
$ sudo docker exec jordan-icinga21 i2-port-mysqldb /usr/local/bin/i2-port-mysqldb: line 5: MYSQL_ROOT_PASSWORD: No MySQL Root password set
If so, this is the porting script. The porting script requires to have a MYSQL_ROOT_PASSWORD
.
But it is not coupled to the initialisation scripts (50-icinga2
). It actually just creates a mysql root user with a specified password, that icinga can login later, too.
@demel42 Is the data important? I guess not, as you're stating you just started to use it. Just throw your mysql data away and setup a fresh mysql container with no data. This will trigger the mysql
image to initialize a fresh container.
If you're interested to take the data from your icinga2 container to the external mysql DB, you have to copy your volume data and not another snapshot. We can't help you with other techniques.
hi jjethwa
whatbdo you mean with 'other'? there are some variables, set initially when creatong the container. not included are MYSQL_ROOT_PASSWORD and the DEFAULTMYSQL* variables.
i'm running the docker on a actual synology-system.
demel
Am 11.03.2019 um 23:13 schrieb Jordan Jethwa notifications@github.com:
Hi @demel42
That's really strange that https://github.com/jjethwa/icinga2/blob/master/content/opt/setup/50-icinga2 is complaining that MYSQL_ROOT_PASSWORD is not set. Are the other vars getting set?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
hi,
Am 12.03.2019 um 00:15 schrieb Benedikt Heine notifications@github.com:
If so, this is the porting script. The porting script requires to have a MYSQL_ROOT_PASSWORD.
yes, its the porting script. i used it for one of my tries to put the database to an other database-server. i wanted to follow your description a this point - excepted i dont' can copy the mysql-files but use dump/load as described below.
@demel42 Is the data important? I guess not, as you're stating you just started to use it. Just throw your mysql data away and setup a fresh mysql container with no data. This will trigger the mysql image to initialize a fresh container.
i have the configuration of my network with ~25 hosts and about 60 services. work of some days :-( and i have to install a new check-script (check_synology.py and to use it also python) to check via smtp - not a good way to change the content of docker-container, i knew and i will have to find a other way...
i had duplicated the container before playing around so i have a running icinga with all of my data and local configuration.
after i shot down my first container, i made my tries with fresh containers to get a sufficient way to a icinga with external db.
If you're interested to take the data from your icinga2 container to the external mysql DB, you have to copy your volume data and not another snapshot. We can't help you with other techniques.
starting with this aktion, this ware my steps
- dumping the three databases from the icinga
- setting up the user 'icinga2' with the password, i found in resource.ini with complete rights
- loading the 3 databases
- switching the icinga in the running container (with 'service icinga2 restart') it works .... until i rebooted the container.
the password of 'icinga2' seems to change every reboot, so i thought to set a fix password with DEFALUT_MYSQL_PASS?
if i find a way, to set up a fresh container with a external mysql-db, i think, i can copy all my changed configuration to the new container and load the actual database-content.
thanx a lot demel
You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
hi jjethwa,
this is the complete enviroment of the container
root@icinga2:/# env
ICINGA2_FEATURE_DIRECTOR_USER=icinga2-director
ICINGA2_FEATURE_GRAPHITE=false
HOSTNAME=icinga2
ICINGA2_USER_FULLNAME=Icinga2
ICINGA2_FEATURE_DIRECTOR=true
ICINGA2_FEATURE_GRAPHITE_HOST=graphite
PWD=/
HOME=/root
ICINGA2_FEATURE_GRAPHITE_PORT=2003
APACHE2_HTTP=REDIRECT
TERM=xterm
ICINGA2_FEATURE_DIRECTOR_KICKSTART=true
SHLVL=1
ICINGA2_FEATURE_GRAPHITE_URL=http://graphite
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
root@icinga2:/#d
Ok then. However you port the data. I guess you can do it.
- setting up the user 'icinga2' with the password, i found in resource.ini with complete rights
resources.ini
fields get adapted to the env on startup. You have to set the env variables.i have the configuration of my network with ~25 hosts and about 60 services. work of some days :-( and i have to install a new check-script (check_synology.py and to use it also python) to check via smtp - not a good way to change the content of docker-container, i knew and i will have to find a other way...
Do you use director? If not, there's only perfdata and check logs in it. IMHO not worth to port while one's in a bootstrap phase.
hi bebehei,
i have don e the following
root@jordan-icinga2:/# env
ICINGA2_FEATURE_DIRECTOR_USER=icinga2-director
ICINGA2_FEATURE_GRAPHITE=false
HOSTNAME=jordan-icinga2
ICINGA2_USER_FULLNAME=Icinga2
ICINGA2_FEATURE_DIRECTOR=true
ICINGA2_FEATURE_GRAPHITE_HOST=graphite
PWD=/
HOME=/root
ICINGA2_FEATURE_GRAPHITE_PORT=2003
APACHE2_HTTP=REDIRECT
TERM=xterm
ICINGA2_FEATURE_DIRECTOR_KICKSTART=true
SHLVL=1
ICINGA2_FEATURE_GRAPHITE_URL=http://graphite
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
root@jordan-icinga2:/# mysql --user=root --password=xxxx --host=homeserver --port=3307
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.3.7-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> Bye
root@jordan-icinga2:/# mysql --user=icinga2 --password=yyyy --host=homeserver --port=3307 --database=icingaweb2
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 54
Server version: 10.3.7-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [icingaweb2]> use icinga2idomysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [icinga2idomysql]> use icingaweb2_director
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
=> it works !!
There was still some effort to transfer the changes to / etc / incinga2 etc but now all seems to be good.
i don't know, what's my mistake was. thank a lot for your help.
at this point, i have two last questions
what's the recommended way to solve such requirements?
thanx demel
Hi @demel42
You would want to use a volume for your check scripts so they persist. For the python pre-reqs, you can install those using the custom_run script: https://github.com/jjethwa/icinga2/blob/master/content/opt/setup/10-customrun
Hi bebehei,
i have made an directory /etc/icinga2/plugins and set in constants.conf:
const CustomPluginDir = "/etc/icinga2/plugins"
i have moved _synologychecked.py to this point and changed the field command in the tab commands - setting the complete path, because the CustomPluginDir seems not to be supported. check is running, all ok.
but the command _checkmem.pl is one of the predefined external commands, but the script check_mem.pl ist missing. Is this a mistake or intention? if it's intention, i would make a copy of the predefined check_mem-command as check_mem.local with the local path. it is no problem, but if it would be a mistake and fixed sometime, it would be good to know.
thank you demel42
Hi @demel42
/usr/lib/nagios/plugins/check_memory is the script I am familiar with, not check_mem.pl
hi jjethwa,
ich took check_mem, because ist was the only in your delivered, predefind commands.
i defined e a new command, calling the installed check_memory.
result is this:
Can't call method "new" on an undefined value at /usr/lib/nagios/plugins/check_memory line 55.
at this line
my $np = $plugin_module->new()
is called.
it's no problem for me, but perhaps interesting for this cool project.
regards demel
Am 15.03.2019 um 17:23 schrieb Jordan Jethwa notifications@github.com:
Hi @demel42
/usr/lib/nagios/plugins/check_memory is the script I am familiar with, not check_mem.pl
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hmm, what happens if you try to execute the script manually?
the same. i tried it first by hand when looking for the options ... using options make no difference
for testing i just generated a complete fresh container - the same result
Am 15.03.2019 um 18:31 schrieb Jordan Jethwa notifications@github.com:
Hmm, what happens if you try to execute the script manually?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks @demel42
Looks like libmonitoring-plugin-perl needs installing. I'll add it now
ok.
is it possible to add also pysnmp.hlapi?
thx
Am 15.03.2019 um 19:07 schrieb Jordan Jethwa notifications@github.com:
Thanks @demel42
Looks like libmonitoring-plugin-perl needs installing. I'll add it now
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Not sure what that is? Do you mean libnet-snmp-perl ?
hi,
it's a library form python for snmp http://snmplabs.com/pysnmp/docs/pysnmp-hlapi-tutorial.html
i had installed it with:
apt-get install python-pip && pip install -U pysnmp
demel
Am 15.03.2019 um 20:19 schrieb Jordan Jethwa notifications@github.com:
Not sure what that is? Do you mean libnet-snmp-perl ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @demel42
I would suggest adding that to the custom run script mentioned above 😄
Hi For now my icinga2 (lastest) work on "docker-host" and has configured external mariadb server "mysql-host", icinga2 connect to new server but after that: