You are here
Fpmmm Nagios plug-ins
Table of Contents
- Converting Nagios plug-ins to
fpmmm
- Set-up Nagios NRPE Agent
- Set-up Nagios Monitoring Server
- Sources
The FromDual Performance Monitor for MariaDB and MySQL (fpmmm
) can also be used for supplying your Nagios Monitoring infrastructure. fpmmm
v2.0.0 replaces the former FromDual Nagios plug-ins for MariaDB and MySQL.
Converting Nagios plug-ins to fpmmm
Converting your former FromDual Nagios plug-ins to fpmmm
is quite simple. You have to convert the Nagios plugin command to an fpmmm
command. Here a simple example:
# ./check_db_mysql.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306
should be changed to:
# ./fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_db
The former FromDual Nagios plug-in options will be placed in the fpmmm
configuration file (/etc/nagios_fpmmm.conf
) and should be converted to:
from | --user | to | Username |
from | --password | to | Password |
from | --host | to | MysqlHost |
from | --port | to | MysqlPort |
from | --socket | to | Socket |
A complete fpmmm
configuration file converted from the FromDual Nagios plug-ins should look as follows:
# # /etc/nagios_fpmmm.conf # [default] AgentLockFile = /run/lock/fpmmm/fpmmm.lock OutputFormat = nagios CacheFileBase = /var/cache/fpmmm/fpmmm Hostname = my_machine Username = fpmmm_agent Password = secret MysqlHost = 127.0.0.1 MysqlPort = 3306 Socket = /var/lib/mysql/mysql.sock
Now we have a list of all commands how the should be converted from Nagios plug-ins to fpmmm
:
# ./check_db_mysql.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_db # ./check_repl_mysql_cnt_slave_hosts.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 --expected=3 --critical=1 --warning=2 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_cnt_slave_hosts --expected=3 --critical=1 --warning=2 # ./check_repl_mysql_io_thread.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_io_thread # ./check_repl_mysql_sql_thread.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_sql_thread # ./check_repl_mysql_read_exec_pos.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 --critical=100000 --warning=10000 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_read_exec_pos --critical=100000 --warning=10000 # ./check_repl_mysql_seconds_behind_master.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 --critical=60 --warning=10 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_seconds_behind_master --critical=60 --warning=10 # ./check_repl_mysql_readonly.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_readonly # ./check_galera_nodes.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 --nodes=3 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_galera_nodes --nodes=3 # ./check_repl_mysql_heartbeat.pl --master-user=nagios --master-password=secret --master-host=192.168.1.1 --master-port=3306 --slave-user=nagios --slave-password=secret --slave-host=192.168.1.2 --slave-port=3306 --heartbeat-schema=test --heartbeat-table=heartbeat --heartbeat-beat-field=beat --heartbeat-id-field=id --heartbeat-id=1 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_repl_heartbeat --master-user=nagios --master-password=secret --master-host=192.168.1.1 --master-port=3306 --slave-user=nagios --slave-password=secret --slave-host=192.168.1.2 --slave-port=3306 --heartbeat-schema=test --heartbeat-table=heartbeat --heartbeat-beat-field=beat --heartbeat-id-field=id --heartbeat-id=1 # ./check_errorlog_mysql.pl --error-log=/var/log/mysql/chef_mariadb-107_error.log --configuration=/var/lib/fpmmm/fpmmm_error_log.state --instance=mariadb-107 # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=check_errorlog --error-log=/var/log/mysql/chef_mariadb-107_error.log --configuration=/var/lib/fpmmm/fpmmm_error_log.state --instance=mariadb-107 # ./perf_mysql.pl --user=nagios --password=secret --host=127.0.0.1 --port=3306 --output=nagios --module=uptime # ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=perf --output=nagios --module=uptime
If you seek for Nagios plug-in specific help you can run the following command:
# ./bin/fpmmm --config=/etc/nagios_fpmmm.conf --nagios-plugin=perf --output=nagios --module=uptime --help
Set-up Nagios NRPE Agent
This should be done on the machine to monitor (client) - where the database resides.
# apt-get install nagios-nrpe-server nagios-plugins-basic # systemctl status nagios-nrpe-server # systemctl start nagios-nrpe-server # /usr/lib/nagios/plugins/check_nrpe --host=localhost --command=check_users USERS OK - 1 users currently logged in |users=1;5;10;0
Add Nagios Monitoring Server:
# vi /etc/nagios/nrpe.cfg allowed_hosts=127.0.0.1,::1,192.168.56.102
Add fpmmm agent commands:
# vi /etc/nagios/nrpe_local.cfg command[fpmmm_check_db]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_db command[fpmmm_check_repl_cnt_slave_hosts]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_cnt_slave_hosts --expected=3 --critical=1 --warning=2 command[fpmmm_check_repl_io_thread]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_io_thread command[fpmmm_check_repl_sql_thread]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_sql_thread command[fpmmm_check_repl_read_exec_pos]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_read_exec_pos --critical=100000 --warning=10000 command[fpmmm_check_repl_seconds_behind_master]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_seconds_behind_master --critical=60 --warning=10 command[fpmmm_check_repl_readonly]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_readonly command[fpmmm_check_repl_heartbeat]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_repl_heartbeat --master-user=nagios --master-password=secret --master-host=192.168.1.2 --master-port=3306 --slave-user=nagios --slave-password=secret --slave-host=192.168.1.2 --slave-port=3306 --heartbeat-schema=test --heartbeat-table=heartbeat --heartbeat-beat-field=beat --heartbeat-id-field=id --heartbeat-id=1 command[fpmmm_check_galera_nodes]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_galera_nodes --nodes=3 command[fpmmm_check_errorlog]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_errorlog --error-log=/var/log/mysql/mysqld.log --configuration=/tmp/fpmmm_error_log.state --instance=mariadb-107 command[fpmmm_perf_uptime]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=uptime command[fpmmm_perf_connections]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=connections command[fpmmm_perf_galera]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=galera command[fpmmm_perf_thread_cache]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=thread_cache command[fpmmm_perf_network_traffic]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=network_traffic command[fpmmm_perf_queries]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=queries command[fpmmm_perf_query_cache]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=query_cache command[fpmmm_perf_myisam_key_buffer]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=myisam_key_buffer command[fpmmm_perf_table_cache]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=table_cache command[fpmmm_perf_temporary_tables]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=temporary_tables command[fpmmm_perf_tables]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=tables command[fpmmm_perf_slow_queries]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=slow_queries command[fpmmm_perf_bin_log]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=bin_log command[fpmmm_perf_innodb_buffer_pool]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_buffer_pool command[fpmmm_perf_innodb_buffer_pool_io]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_buffer_pool_io command[fpmmm_perf_innodb_io]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_io command[fpmmm_perf_innodb_data]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_data command[fpmmm_perf_innodb_logfile]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_logfile command[fpmmm_perf_innodb_row_locking]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_row_locking command[fpmmm_perf_innodb_queries]=/opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=perf --output=nagios --module=innodb_queries
Then restart the Nagios NRPE server:
# systemctl restart nagios-nrpe-server
Fpmmm agent running with Nagios plug-ins:
# sudo -u nagios /opt/fpmmm/bin/fpmmm --config=/etc/fpmmm.conf --nagios-plugin=check_db Database seems up and running...
Check for errors:
# tail /var/log/fpmmm/fpmmm.log
Combination of both:
# chown nagios: /etc/fpmmm.conf # chown -R nagios: /var/log/fpmmm # chown -R nagios: /run/lock/fpmmm # /usr/lib/nagios/plugins/check_nrpe --host=localhost --command=fpmmm_check_db Database seems up and running... # /usr/lib/nagios/plugins/check_nrpe --host=localhost --command=fpmmm_check_repl_readonly ... # /usr/lib/nagios/plugins/check_nrpe --host=localhost --command=fpmmm_perf_uptime ...
Set-up Nagios Monitoring Server
# apt-get install nagios-nrpe-server # /usr/lib/nagios/plugins/check_nrpe --host=192.168.56.108 NRPE v4.0.3
Set the NRPE Check on the Server Configuration file:
# /usr/lib/nagios/plugins/check_nrpe --host=192.168.56.108 --unknown-timeout --timeout=5 --command=fpmmm_check_db Database seems up and running... # /usr/lib/nagios/plugins/check_nrpe --host=192.168.56.108 --command=fpmmm_check_repl_readonly ... # /usr/lib/nagios/plugins/check_nrpe --host=192.168.56.108 --command=fpmmm_perf_uptime ...
Define your database machine and the services to monitor:
# vi /etc/nagios4/nagios.cfg cfg_file=/etc/nagios4/objects/nrpeclient.cfg # vi /etc/nagios4/objects/nrpeclient.cfg define host { use linux-server host_name debian11 alias debian11.rebenweg address 192.168.56.108 max_check_attempts 3 contact_groups admins } define hostgroup { hostgroup_name databases alias MariaDB and MySQL databases members debian11 } define service { use generic-service host_name debian11 service_description fpmmm check_db check_command check_nrpe!fpmmm_check_db } define service { use generic-service host_name debian11 service_description fpmmm check_repl_readonly check_command check_nrpe!fpmmm_check_repl_readonly } define service { use generic-service host_name debian11 service_description fpmmm perf_uptime check_command check_nrpe!fpmmm_perf_uptime }
Test configuration and restart Nagios
# /usr/sbin/nagios4 -v /etc/nagios4/nagios.cfg # systemctl restart nagios4
Then you should see the results in your web-browser.