Troubleshoot Nagios MariaDB check - KeegMitch/Operations-Engineering-group-c GitHub Wiki

Carrying on from the last lab here

As the service appears to not be working, we need to check the config:

image

image

This command check below is the same command we put in our nagios service for MariaDB:

/usr/lib/nagios/plugins/check_mysql -H '$HOSTADDRESS$' -u '$ARG1$' -p '$ARG2$' '$ARG3$'

  1. To do this, log onto your database server and open a MariaDB shell, then run the following SQL statement:

sudo mysql -u root -p

Password is whatever your sudo password is

image

CREATE USER 'nagios'@'mgmt-c' IDENTIFIED BY 'mypasswd';


GRANT SELECT ON nagiosdb.* to 'nagios'@'mgmt-c' IDENTIFIED BY 'mypasswd';
  1. Command to see if changes let db-c connect, try restarting mariadb on the db server

/usr/lib/nagios/plugins/check_mysql -H db-c -u nagios -p mypasswd

image

  1. Replace the check command in the mariadb service from config.pp file to this: check_command => 'check_mysql_cmdlinecred!nagios!mypasswd',

Now the MariaDB critical error is resolved:

image