Ad Widget

Collapse

Move history from one item to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vanyadog
    Junior Member
    • Jun 2018
    • 8

    #1

    Move history from one item to another

    Hello.
    i found host id

    Code:
    mysql> select hostid, host from hosts;
    |  13032 | test
    |  13033 | test2
    i found item id for each hosts

    Code:
    mysql> select itemid, name  from items where hostid = 13032;
    +--------+--------------------+
    | itemid | name               |
    +--------+--------------------+
    | 502778 | ICMP ping          |
    | 502779 | ICMP loss          |
    | 502780 | ICMP response time |
    | 502772 | System Temp        |
    | 502773 | CPU1 Temp          |
    | 502774 | CPU2 Temp          |
    | 502775 | PCH Temp           |
    | 502776 | Peripheral Temp    |
    | 502777 | VBAT               |
    +--------+--------------------+
    9 rows in set (0.00 sec)
    Code:
    mysql> select itemid, name  from items where hostid = 13033;
    +--------+--------------------+
    | itemid | name               |
    +--------+--------------------+
    | 502787 | ICMP ping          |
    | 502788 | ICMP loss          |
    | 502789 | ICMP response time |
    | 502781 | System Temp        |
    | 502782 | CPU1 Temp          |
    | 502783 | CPU2 Temp          |
    | 502784 | PCH Temp           |
    | 502785 | Peripheral Temp    |
    | 502786 | VBAT               |
    +--------+--------------------+
    9 rows in set (0.00 sec)

    i tryed to move history for CPU2 Temp from test to test2

    Code:
    UPDATE history SET itemid = 502783 WHERE itemid = 502774;
    Code:
    mysql> UPDATE history SET itemid = 502783 WHERE itemid = 502774;
    Query OK, 377497 rows affected (12 min 54.16 sec)
    Rows matched: 377497  Changed: 377497  Warnings: 0
    a part of history was transferred and other part was not

    I use partitioning for mysql

    Have I done something wrong?
    Could you explain me how to move history correctly? How about trends?

    Thanks
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    You need to do the same for trends* tables data.
    Zabbix adds trends point basing only on last hour data so when history* tables data will be expired by dropping oldest history* tables partitions your item data will be with trends data from before history table update query.
    When you are switching to view monitoring data to longer time scale zabbix web frontend automatically switches to present not history data but those from trends* tables and this you see that at some point you don't see not updated data.
    Last edited by kloczek; 17-10-2018, 02:23.
    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

    • vanyadog
      Junior Member
      • Jun 2018
      • 8

      #3
      Ok, it's clear. Thanks.
      How about problems|triggers|events?
      I mean... for example 2 month ago CPU temperature was high and trigger "told" me about that. Now I can't see that in Monitoring->Problems

      Comment

      • kloczek
        Senior Member
        • Jun 2006
        • 1771

        #4
        I'm not going to describe whole set of such changes because I never done such migration.
        Nevertheless if you are reusing the same HW to install new system instead moving all host data to new monitored host you should just change host interface (hostname/IP).
        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

        Working...