Ad Widget

Collapse

mariadb monitoring - Zabbix agent ignoring .my.cnf

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • x5wt3xxmz@mozmail.com
    Junior Member
    • Aug 2024
    • 2

    #1

    mariadb monitoring - Zabbix agent ignoring .my.cnf

    Greetings all,

    I have two RHEL8 servers both running mariadb, one replicating to the other. I'm new to Zabbix so I've been following the provided tutorials. Using that information I have mysql monitoring on the replicated server returning information correctly, which is great to see. I went on to configure the master server and although Zabbix is working for the OS level reporting, it will not connect to the database

    When the zabbix-agent starts the following appears in /var/log/messages

    Code:
    Aug 10 17:10:04 localhost mariadbd[1216595]: 2024-08-10 17:10:04 182 [Warning] Aborted connection 182 to db: 'unconnected' user: 'unauthenticated' host: 'localhost' (This connection closed normally without authentication)
    This will repeat until I stop the zabbix service stops, so I'm fairly certain this is zabbix failing to login using the .my.cnf file found in /var/lib/zabbix

    .my.cnf contains the following;

    Code:
    [client]
    protocol=tcp
    user='zbx_monitor'
    password='REMOVED'
    I have tried completely removing the agent and starting from scratch at least twice now with no luck, so I was wondering how I might better go about fault finding this problem?

    Thanks.



  • Answer selected by [email protected] at 01-10-2024, 15:15.
    x5wt3xxmz@mozmail.com
    Junior Member
    • Aug 2024
    • 2

    I’m pleased to say I have resolved my problem, maybe the following information will be useful for someone. As I couldn't see useful information in the logs I ran the following as the zabbis user to observe any errors messages that might appear;

    Code:
    sudo -u zabbix mysqladmin ping   
    error: 'TLS/SSL error: No such file or directory'
    The error is indicating that mysqladmin is trying to connect via SSL without suitable certificates. The source MariaDB server is configured for both encrypted and non-encrypted access, but when zabbix runs mysqladmin it always trys to connect via SSL. Forcing SSL off using –ssl=OFF shows the server responding.

    Code:
    sudo -u zabbix mysqladmin --ssl=OFF ping
    mysqld is alive
    This lead me to make some changes to the template to force connections to be unencrypted.

    Code:
    UserParameter=mysql.ping[*], mysqladmin --ssl=OFF -h"$1" -P"$2" ping
    UserParameter=mysql.get_status_variables[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show global status"
    UserParameter=mysql.version[*], mysqladmin --ssl=OFF -s -h"$1" -P"$2" version
    UserParameter=mysql.db.discovery[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sN -e "show databases"
    UserParameter=mysql.dbsize[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sN -e "SELECT COALESCE(SUM(DATA_LENGTH + INDEX_LENGTH),0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
    UserParameter=mysql.replication.discovery[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show slave status"
    UserParameter=mysql.slave_status[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show slave status"
    I now have a dashboard filling up with stats

    Comment

    • x5wt3xxmz@mozmail.com
      Junior Member
      • Aug 2024
      • 2

      #2
      I’m pleased to say I have resolved my problem, maybe the following information will be useful for someone. As I couldn't see useful information in the logs I ran the following as the zabbis user to observe any errors messages that might appear;

      Code:
      sudo -u zabbix mysqladmin ping   
      error: 'TLS/SSL error: No such file or directory'
      The error is indicating that mysqladmin is trying to connect via SSL without suitable certificates. The source MariaDB server is configured for both encrypted and non-encrypted access, but when zabbix runs mysqladmin it always trys to connect via SSL. Forcing SSL off using –ssl=OFF shows the server responding.

      Code:
      sudo -u zabbix mysqladmin --ssl=OFF ping
      mysqld is alive
      This lead me to make some changes to the template to force connections to be unencrypted.

      Code:
      UserParameter=mysql.ping[*], mysqladmin --ssl=OFF -h"$1" -P"$2" ping
      UserParameter=mysql.get_status_variables[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show global status"
      UserParameter=mysql.version[*], mysqladmin --ssl=OFF -s -h"$1" -P"$2" version
      UserParameter=mysql.db.discovery[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sN -e "show databases"
      UserParameter=mysql.dbsize[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sN -e "SELECT COALESCE(SUM(DATA_LENGTH + INDEX_LENGTH),0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
      UserParameter=mysql.replication.discovery[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show slave status"
      UserParameter=mysql.slave_status[*], mysql --protocol=TCP --skip-ssl -h"$1" -P"$2" -sNX -e "show slave status"
      I now have a dashboard filling up with stats

      Comment

      Working...