How to configure mysql plugins check mk agent
Before you read the following section, make sure you have install check mk agent and work properly, if yet, you can find the tutorial how to install check mk agent here
Create check_mk user on mysql with select only permission
Create check_mk user on mysql with select only permission
sysop@cloud:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 289
Server version: 5.5.60-0+deb7u1 (Debian)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> GRANT SELECT ON *.* to check_mk@'localhost' IDENTIFIED BY 'P@55w0rd';
Query OK, 0 rows affected (0.29 sec)
mysql> exit
Bye
sysop@cloud:~$
Execute check mk agent and read the text result, find out where is the agent directory and plugins directory
sysop@cloud:~$ nc -v localhost 6556
Connection to localhost 6556 port [tcp/*] succeeded!
<<<check_mk>>>
Version: 1.5.0p4
AgentOS: linux
Hostname: vta-cloud
AgentDirectory: /etc/check_mk
DataDirectory: /var/lib/check_mk_agent
SpoolDirectory: /var/lib/check_mk_agent/spool
PluginsDirectory: /usr/lib/check_mk_agent/plugins
LocalDirectory: /usr/lib/check_mk_agent/local
<<<df>>>
udev devtmpfs 4059644 0 4059644 0% /dev
tmpfs tmpfs 815768 50488 765280 7% /run
/dev/sda4 ext4 495251272 85974012 384096896 19% /
tmpfs tmpfs 4078820 80 4078740 1% /dev/shm
tmpfs tmpfs 5120 0 5120 0% /run/lock
Create mysq.cfg new file on check mk agent directory with following content, use mysql user and password that created before
sysop@cloud:~$ sudo vi /etc/check_mk/mysql.cfg
[sudo] password for sysop:
sysop@cloud:~$
sysop@cloud:~$ sudo cat /etc/check_mk/mysql.cfg
[client]
user=check_mk
password=P@55w0rd
sysop@cloud:~$
Create mysq.cfg new file on check mk agent directory with following content, use mysql user and password that created before
sysop@cloud:~$ sudo vi /etc/check_mk/mysql.cfg
[sudo] password for sysop:
sysop@cloud:~$
sysop@cloud:~$ sudo cat /etc/check_mk/mysql.cfg
[client]
user=check_mk
password=P@55w0rd
sysop@cloud:~$
Change working directory to check mk agent plugins and download the check mk mysql plugins
sysop@cloud:~$ cd /usr/lib/check_mk_agent/plugins/
sysop@cloud:/usr/lib/check_mk_agent/plugins$ ls
sysop@cloud:/usr/lib/check_mk_agent/plugins$
sysop@cloud:/usr/lib/check_mk_agent/plugins$ sudo wget https://monitoring.wachid.web.id/monitoring/check_mk/agents/plugins/mk_mysql
--2018-10-30 18:21:49-- https://monitoring-wachid.web.id/monitoring/check_mk/agents/plugins/mk_mysql
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 200 OK
Length: 3518 (3.4K) [text/plain]
Saving to: ‘mk_mysql’
mk_mysql 100%[===========================================================>] 3.44K --.-KB/s in 0s
2018-10-30 18:21:50 (23.6 MB/s) - ‘mk_mysql’ saved [3518/3518]
sysop@cloud:/usr/lib/check_mk_agent/plugins$ ls
mk_mysql
sysop@cloud:/usr/lib/check_mk_agent/plugins$
Add execution privileges to the mysql plugins file
sysop@cloud:/usr/lib/check_mk_agent/plugins$ sudo chmod 775 mk_mysql
sysop@cloud:/usr/lib/check_mk_agent/plugins$
sysop@cloud:/usr/lib/check_mk_agent/plugins$ ls -l
total 4
-rwxrwxr-x 1 root root 3518 Sep 11 00:27 mk_mysql
sysop@cloud:/usr/lib/check_mk_agent/plugins$
Execute the check mk agent by telnet localhost on port 6556 and read out the result, you fill find mysql under the local result text, it's mean the check mk mysql plugins work properly
...
...
<<<local>>>
<<<<>>>>
<<<local>>>
<<<mysql_ping>>>
[[mysql]]
mysqld is alive
<<<mysql>>>
[[mysql]]
Aborted_clients 3
Aborted_connects 16
Binlog_cache_disk_use 0
Binlog_cache_use 0
Binlog_stmt_cache_disk_use 0
Binlog_stmt_cache_use 0
Bytes_received 29721010161
Bytes_sent 186671796
Com_admin_commands 58
Com_assign_to_keycache 0
Com_alter_db 0
Com_alter_db_upgrade 0
Com_alter_event 0
Com_alter_function 0
Thanks a lot. So helpful.
BalasHapus