Portál AbcLinuxu, 29. října 2025 20:48
/usr/lib/nagios/plugins/check_mysql
/usr/lib/nagios/plugins/check_mysql -d mysql -u root
/root/.my.cnf. Pak mame na serveru systemoveho uzivatele nagios (nema home tudiz nema odkud tahat heslo) pod kterym porebuju spustit prikaz:
/usr/lib/nagios/plugins/check_mysql -d mysql -u root -p "heslo"
nagios@server:/$ sudo /usr/lib/nagios/plugins/check_mysql -d mysql -u root -p /root/.my.cnf Access denied for user 'root'@'localhost' (using password: YES)
/usr/lib/nagios/plugins/check_mysql --help
check_mysql v1991 (nagios-plugins 1.4.12)
This program tests connections to a MySQL server
Usage: check_mysql [-d database] [-H host] [-P port] [-s socket]
[-u user] [-p password] [-S]
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-P, --port=INTEGER
Port number (default: 3306)
-s, --socket=STRING
Use the specified socket (has no effect if -H is used)
-d, --database=STRING
Check database with indicated name
-u, --username=STRING
Connect using the indicated username
-p, --password=STRING
Use the indicated password to authenticate the connection
==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==
Your clear-text password could be visible as a process table entry
-S, --check-slave
Check if the slave thread is running properly.
-w, --warning
Exit with WARNING status if slave server is more than INTEGER seconds
behind master
-c, --critical
Exit with CRITICAL status if slave server is more then INTEGER seconds
behind master
There are no required arguments. By default, the local database is checked
using the default unix socket. You can force TCP on localhost by using an
IP address or FQDN ('localhost' will use the socket as well).
Send email to nagios-users@lists.sourceforge.net if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to nagiosplug-devel@lists.sourceforge.net
$HOME na /root?
nagios ALL=NOPASSWD:/usr/lib/nagios/plugins/check_mysql
$ mysql --defaults-extra-file=/root/.my.cnf. Více v dokumentaci Using Option Files. Pak už je jedno, kde bude soubor s uživatelem a heslem uložen.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.