Ad Widget

Collapse

DataBase Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mohammadjuve
    Junior Member
    • Mar 2018
    • 24

    #1

    DataBase Monitoring

    Hello Everybody,

    could you please tell me the Best way to monitor Database Server based on OS Linux and Microsoft

    Thaaaanks
  • aigars.kadikis
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2018
    • 208

    #2
    Please clarify what is in your interest scope?
    Would you like to monitor database server by itself in "operating system" level? Then you can proceed with templates like "Template OS Windows" or "Template OS Linux"
    If you have running MySQL under linux you can advance from built-in "Template DB MySQL".

    Regards,
    Aigars

    Comment

    • Mohammadjuve
      Junior Member
      • Mar 2018
      • 24

      #3
      Originally posted by aigars.kadikis
      Please clarify what is in your interest scope?
      Would you like to monitor database server by itself in "operating system" level? Then you can proceed with templates like "Template OS Windows" or "Template OS Linux"
      If you have running MySQL under linux you can advance from built-in "Template DB MySQL".

      Regards,
      Aigars
      Hello Aigars,
      I'm sorry, i have taken my Holidy and today i work again normally.
      i mean mysql in linux and what the most important Databse is the SQL Server.

      Regards,

      Comment

      • aigars.kadikis
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Mar 2018
        • 208

        #4
        Hello Mohammadjuve,

        Here is workflow how to gather metrics form Zabbixs servers own database 'zabbix'. The most important part is put the database username and passowrd in '.my.cnf' file on 'zabbix' users HOME directory so the agent knows how to access the database.
        Code:
        [root@z347 ~]# getenforce #check SELinux status
        Enforcing
        [root@z347 ~]# setenforce 0 #trun off SELinux
        [root@z347 ~]# getenforce #check SELinux status
        Permissive
        [root@z347 ~]# grep zabbix /etc/passwd #note the home dir for user 'zabbix'
        zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin
        [root@z347 ~]# grep "^Hostname=" /etc/zabbix/zabbix_agentd.conf #note hostname if plan to use active checks
        Hostname=Zabbix server
        [root@z347 ~]# grep "^Include" /etc/zabbix/zabbix_agentd.conf #make sure 'zabbix_agentd.d' direcotry is enabled
        Include=/etc/zabbix/zabbix_agentd.d/*.conf
        [root@z347 ~]# grep -v "^$\|^#" /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf #output active content of MySQL metric query. note the HOME dir
        UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
        UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
        UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
        UserParameter=mysql.version,mysql -V
        [root@z347 ~]# ls -la /var/lib/zabbix/.my.cnf #necessary permissions and owner
        -rw-------. 1 zabbix zabbix 47 May  8 02:18 /var/lib/zabbix/.my.cnf
        [root@z347 ~]# cat /var/lib/zabbix/.my.cnf #direct content
        [client]
        user=zabbix
        password=TaL2gPU5U9FcCU2u
        [root@z347 ~]# sudo -H -u zabbix bash -c 'zabbix_agentd -t mysql.status[Uptime]' #test key from 'zabbix' user. in this way we ensure zabbix agent can reach the credentials to access DB
        mysql.status[Uptime]                          [t|3477]
        [root@z347 ~]# systemctl restart zabbix-agent #restart agent
        Assign 'Template DB MySQL' to host 'Zabbix server'
        Click image for larger version

Name:	assign-template-db-mysql-zabbix.png
Views:	2864
Size:	67.2 KB
ID:	358310

        Regards,

        Comment

        • Mohammadjuve
          Junior Member
          • Mar 2018
          • 24

          #5
          Hello Aigars,
          That was really Super.
          i works perfectly with MYSQL.

          have idea about MS SQL Server ?

          Regards,

          Comment

          • aigars.kadikis
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Mar 2018
            • 208

            #6
            Hi, Mohammadjuve,

            What kind of Windows version and MS SQL version you have?

            Please try out

            or


            Let us know how it goes and share the struggles you have.

            Regards,

            Comment

            • Mohammadjuve
              Junior Member
              • Mar 2018
              • 24

              #7
              Hello Aigars,
              How are you doing?

              Thank you for your Reply, I've tried the Template "App MSSQL 2008-2016" , the Scripts run perfectly, also the Discovery rules.

              the Issue occurred with Perf counter, I muss pass the parameters with $:
              for Example:
              perf_counter["\MSSQL$TestSQLatabases(master)\Active Transactions"]
              receive the message "Cannot obtain performance information from collector".I Think the problem related to $.

              I tried another perf_counter without $ and I got normal result.



              Regards,

              Comment

              • hicall
                Junior Member
                • Jul 2019
                • 1

                #8
                Originally posted by aigars.kadikis
                Hello Mohammadjuve,

                Here is workflow how to gather metrics form Zabbixs servers own database 'zabbix'. The most important part is put the database username and passowrd in '.my.cnf' file on 'zabbix' users HOME directory so the agent knows how to access the database.
                Code:
                [root@z347 ~]# getenforce #check SELinux status
                Enforcing
                [root@z347 ~]# setenforce 0 #trun off SELinux
                [root@z347 ~]# getenforce #check SELinux status
                Permissive
                [root@z347 ~]# grep zabbix /etc/passwd #note the home dir for user 'zabbix'
                zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin
                [root@z347 ~]# grep "^Hostname=" /etc/zabbix/zabbix_agentd.conf #note hostname if plan to use active checks
                Hostname=Zabbix server
                [root@z347 ~]# grep "^Include" /etc/zabbix/zabbix_agentd.conf #make sure 'zabbix_agentd.d' direcotry is enabled
                Include=/etc/zabbix/zabbix_agentd.d/*.conf
                [root@z347 ~]# grep -v "^$\|^#" /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf #output active content of MySQL metric query. note the HOME dir
                UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
                UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
                UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
                UserParameter=mysql.version,mysql -V
                [root@z347 ~]# ls -la /var/lib/zabbix/.my.cnf #necessary permissions and owner
                -rw-------. 1 zabbix zabbix 47 May 8 02:18 /var/lib/zabbix/.my.cnf
                [root@z347 ~]# cat /var/lib/zabbix/.my.cnf #direct content
                [client]
                user=zabbix
                password=TaL2gPU5U9FcCU2u
                [root@z347 ~]# sudo -H -u zabbix bash -c 'zabbix_agentd -t mysql.status[Uptime]' #test key from 'zabbix' user. in this way we ensure zabbix agent can reach the credentials to access DB
                mysql.status[Uptime] [t|3477]
                [root@z347 ~]# systemctl restart zabbix-agent #restart agent
                Assign 'Template DB MySQL' to host 'Zabbix server'
                Click image for larger version

Name:	assign-template-db-mysql-zabbix.png
Views:	2864
Size:	67.2 KB
ID:	358310

                Regards,
                Hi aigars, do you have any tutorial with PostgreSQL ?

                Thank you

                Comment

                • cesarsj
                  Senior Member
                  • Dec 2018
                  • 154

                  #9
                  I added the Template DB MySQL to the zabbix server host. What do you think of these values ​​below?

                  Queries per second: 54.11 qps
                  Slow queries: 873

                  Comment

                  Working...