4 History and trends

    Overview

    Whereas history keeps each collected value, trends keep averaged information on hourly basis and therefore are less resource-hungry.

    Keeping history

    You can set for how many days history will be kept:

    • when mass-updating items
    • when setting up housekeeper tasks

    Any older data will be removed by the housekeeper.

    The general strong advice is to keep history for the smallest possible number of days and that way not to overload the database with lots of historical values.

    Instead of keeping a long history, you can keep longer data of trends. For example, you could keep history for 14 days and trends for 5 years.

    While keeping shorter history, you will still be able to review older data in graphs, as graphs will use trend values for displaying older data.

    If history is set to ‘0’, the item will update only dependent items and inventory. No trigger functions will be evaluated because trigger evaluation is based on history data only.

    As an alternative way to preserve history consider to use functionality of loadable modules.

    Trends is a built-in historical data reduction mechanism which stores minimum, maximum, average and the total number of values per every hour for numeric data types.

    You can set for how many days trends will be kept:

    • in the item properties
    • when setting up Housekeeper tasks

    Zabbix server accumulates trend data in runtime in the trend cache, as the data flows in. Server flushes previous hour trends of every item into the database (where frontend can find them) in these situations:

    • server receives the first current hour value of the item
    • 5 or less minutes of the current hour left and still no current hour values of the item

    To see trends on a graph you need to wait at least to the beginning of the next hour (if item is updated frequently) and at most to the end of the next hour (if item is updated rarely), which is 2 hours maximum.

    When server flushes trend cache and there are already trends in the database for this hour (for example, server has been restarted mid-hour), server needs to use update statements instead of simple inserts. Therefore on a bigger installation if restart is needed it is desirable to stop server in the end of one hour and start in the beginning of the next hour to avoid trend data overlap.

    History tables do not participate in trend generation in any way.

    If trends are set to ‘0’, Zabbix server does not calculate or store trends at all.

    Also restarting server might result in the precision loss of unsigned data type average value calculations for the current hour.