Ad Widget

Collapse

Monitoring zabbix[history] parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ysus
    Senior Member
    • Mar 2016
    • 100

    #1

    Monitoring zabbix[history] parameter

    Hi,

    Official Zabbix manual says "Do not use if MySQL InnoDB, Oracle or PostgreSQL is used!" for zabbix[history] parameter.



    Any idea why they put this restriction?

    I would like to monitor the size of database tables without any select count queries which take a long time to execute.

    Thanks,
    Yuri
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    Originally posted by ysus
    Hi,

    Official Zabbix manual says "Do not use if MySQL InnoDB, Oracle or PostgreSQL is used!" for zabbix[history] parameter.



    Any idea why they put this restriction?

    I would like to monitor the size of database tables without any select count queries which take a long time to execute.
    None of those engines provides current counter with number table rows. Only way to count those rows is by do full scan of whole table and this operation is very heavy. Effectively started full scan can block other write and read operations on such table.
    history* tables are biggest part of the zabbix DB and scanning them almost instantly is causing that all MFU/MRU cached data are flushed away and whole interaction with database even with quite fast storage is causing big slowdown interaction with database.
    Bigger database than this impact is even bigger.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • ysus
      Senior Member
      • Mar 2016
      • 100

      #3
      Only way to count those rows is by do full scan of whole table and this operation is very heavy
      Sure not. See simple query below and how long it takes.

      Code:
      # time mysql -u*** -p*** -e 'SELECT table_name "Table Name", table_rows "Rows Count" FROM information_schema.TABLES WHERE table_schema = "zabbix"' | grep history
      
      history 1544123
      history_log     0
      history_str     108011
      history_text    0
      history_uint    26837319
      proxy_dhistory  0
      proxy_history   0
      
      real    0m0.021s
      user    0m0.004s
      sys     0m0.002s
      I could run this command and parse the output as agent's UserParamenter but prefer to use build-in functions which for some reasons are not recommended by developers.

      Comment

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        Originally posted by ysus
        I could run this command and parse the output as agent's UserParamenter but prefer to use build-in functions which for some reasons are not recommended by developers.
        Yes you are right that it is possible queries against information_schema.TABLES. Problem only is that vales stored in this table IIRC are not real values (cannot find ATM documentation abut this).
        http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
        https://kloczek.wordpress.com/
        zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
        My zabbix templates https://github.com/kloczek/zabbix-templates

        Comment

        • ysus
          Senior Member
          • Mar 2016
          • 100

          #5
          vales stored in this table IIRC are not real values
          Could you please explain? Sorry I do not understand what you mean, my databases experience is very limited :-(

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            Originally posted by ysus
            Could you please explain? Sorry I do not understand what you mean, my databases experience is very limited :-(
            Values representing number of rows and other like free space in tables are IIRC kind of estimations.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • ysus
              Senior Member
              • Mar 2016
              • 100

              #7
              Yes, now I found it in documentation - "For InnoDB tables, the row count is only a rough estimate used in SQL optimization. (This is also true if the InnoDB table is partitioned.)"

              http://dev.mysql.com/doc/refman/5.7/...les-table.html

              However for big tables those estimations are quite close to SELECT COUNT(*), see last column below:

              Code:
              | history                    |    1828857 |          145.23 | |  1827233 |
              | history_uint               |   25447767 |         2218.25 | | 23431635 |
              
              | trends                     |      34266 |            6.52 | |    50825 |
              | trends_uint                |     587116 |           90.63 | |   632559 |
              | triggers                   |       1559 |            0.50 | |     1612 |
              Thanks.
              Thread closed.

              Comment

              Working...