Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/bin/mysql: unknown variable 'login-path=monitoring' #17

Open
JeroenOmaha opened this issue Oct 27, 2018 · 3 comments
Open

/usr/bin/mysql: unknown variable 'login-path=monitoring' #17

JeroenOmaha opened this issue Oct 27, 2018 · 3 comments

Comments

@JeroenOmaha
Copy link

I get a /usr/bin/mysql: unknown variable 'login-path=monitoring' on all items in Zabbix.

Executing on host:
zabbix_agentd -t "mysql.version"
gives proper response:
mysql.version [t|mysql Ver 15.1 Distrib 10.3.10-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2]

@kloczek
Copy link
Owner

kloczek commented Nov 1, 2018

Ha you just hit something which I forgot to document :/
Service MySQL template has macro:

{$MYSQL_CMD} => HOME=/var/lib/zabbix /usr/bin/mysql --login-path=monitoring -Nse

You need to create /var/lib/zabbix directory and using mysql_config_editor program store in it .mylogin.cnf file with details about username, password and address of the mysql server.

Just use command like below:

[root@domek ~]# HOME=/var/lib/zabbix mysql_config_editor set --user=monitoring --host=localhost --password
Enter password: 
[root@domek ~]# HOME=/var/lib/zabbix mysql_config_editor print
[client]
user = monitoring
password = *****
host = localhost

Than you need to change ownership of the /var/lib/zabbix
[root@domek ~]# chown -R zabbix:zabbix /var/lib/zabbix; chmod 700 /var/lib/zabbix; chmod 600 /var/lib/zabbix/.*

FYI I've started writing my own agent loadable module to provide template template items abstractions but this module is not finished yet. https://github.com/kloczek/zbx_mod_mysql
Whit this module will be not necessary to use external commands.

@xainty
Copy link

xainty commented Nov 9, 2018

@kloczek after I do those steps I lost connection to my DB on zabbix, and coudn't open zabbix's website:

Error connecting to database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111).

Any idea why this happened? And how can I avoid it?

@kloczek
Copy link
Owner

kloczek commented May 28, 2019

First: are you able to connect to the mysql database using mysql client command?
I suppose that you not been able to do that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants