Ad Widget

Collapse

Monitoring MariaDB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • V.N.
    Member
    • Oct 2015
    • 37

    #1

    Monitoring MariaDB

    I found a lot of information how to monitor MySQL but despite MariaDB is the continuation of it, I can't make Zabbix and MariaDB to be friends.
    So I have a clean installation of MariaDB and Zabbix 2.2. I have the template in Zabbix for monitoring MySQL and a couple of MySQL servers, which are successfully monitored.
    I connected this template to the server with MariaDB but nothing works. In log of agent messages
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)'
    Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
    But mysqld is running and socket exists! I tried to insert command
    mysqladmin ping | grep -c alive
    and answer was 1.
    Root password is blank.
  • V.N.
    Member
    • Oct 2015
    • 37

    #2
    Add info

    Config file of agent is attached.

    Of course, I have .my.cnf in /etc/zabbix, but I don't understand the error. Debug level in agent_conf didn't clarify anything, the same phrase and that's all concerning mysqladmin.

    P.S. I uninstalled Mariadb and installed MySQL instead.... But the same error, so MariaDB is not guilty. Any ideas?

    Comment

    • V.N.
      Member
      • Oct 2015
      • 37

      #3
      Config

      Forgot to attach config
      Attached Files

      Comment

      • V.N.
        Member
        • Oct 2015
        • 37

        #4
        My OS is Centos 7.
        Seems to me that the problem is OS, not mysql or mariadb.
        On Centos 6.7 everything works.

        Comment

        • ingus.vilnis
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Mar 2014
          • 908

          #5
          Hello and welcome to Zabbix forums!

          First thing I would start on CentOS 7 is to check if SELinux is not in your way.
          Check the current status.
          Code:
          getenforce
          If the mode is "Enforcing" then temporary disable it.
          Code:
          setenforce 0
          Try if everything works now.

          If it does then set SELinux back to Enforcing and check /var/log/audit for detailed error messages. Additionally learn how to allow all that stuff though SELinux filters.

          If that is not the case and SELinux is in "Permissive" mode already then it is something else but first try above.

          Best Regards,
          Ingus

          Comment

          • V.N.
            Member
            • Oct 2015
            • 37

            #6
            Hello!
            Thanks for the reply. Really the problem is SELinux. But if I don't want to disable it do I need make custom policy?
            I found built-in module in SELinux named Zabbix and version 1.6.
            Code:
            [root@mos-sr-rm0106bs ~]# semodule -l | grep zabbix
            zabbix  1.6.0
            [root@mos-sr-rm0106bs ~]#
            Is it OK? Does it work or should it to work?

            Comment

            • ingus.vilnis
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Mar 2014
              • 908

              #7
              Hi,

              SELinux is not that difficult to manage.
              First check what settings do you have.
              Code:
              getsebool -a
              getsebool -a | grep zabbix
              Check all Zabbix related and of they are off, turn them on. (use -P to make the change permanent also after reboot)
              Code:
              setsebool -P zabbix_can_network=1
              Then you probably have something more than that in the audit log. Check what else is blocked and try to create a policy.
              Here is a nice tutorial how to do so.


              Best Regards,
              Ingus

              Comment

              • V.N.
                Member
                • Oct 2015
                • 37

                #8
                Well, I have made them friends at last.
                I made the new police for SELinux. In my case the problem was in Zabbix agent attempting to access mysql, so the policy text is below
                Code:
                module zabbix-mysql 1.0;
                
                require {
                        type mysqld_var_run_t;
                        type mysqld_etc_t;
                        type zabbix_agent_t;
                        type mysqld_t;
                        class sock_file write;
                        class unix_stream_socket connectto;
                        class file { read open };
                }
                
                #============= zabbix_agent_t ==============
                allow zabbix_agent_t mysqld_etc_t:file read;
                
                #!!!! This avc is allowed in the current policy
                allow zabbix_agent_t mysqld_etc_t:file open;
                
                #!!!! This avc is allowed in the current policy
                allow zabbix_agent_t mysqld_t:unix_stream_socket connectto;
                allow zabbix_agent_t mysqld_var_run_t:sock_file write;
                Using this info it's possible to compile the policy.
                I hope this info will be useful to somebody.

                Comment

                Working...