Problem


There are no statistics for a certain period and you need to re-collect the statistics for that time.

Solution


The statistics are written to the itemstat table and collected by the processing module once a day according to the task in cron. In the processing module's log, running the operation appear as follows:

An example of a log entry

Feb 15 00:20:01 [5977:1] processing INFO RUN with: processing/pmispmgr5 --command stat --module 1
CODE

pmispmgr5 — processing module;

module 1 —  processing module id.

An example of a log entry

Feb 15 00:20:03 [5977:1] db EXTINFO Query: 'INSERT INTO itemstat(item, statdate, param, value, measure) VALUES (15, '2020-02-14', 'webdomainlimit', '1', 7) ON DUPLICATE KEY UPDATE
param='webdomainlimit', value='1', measure=7'
CODE

To re-collect the statistics:

  1. Find the records for the days needed.

    Find records

    select * from itemstat where statdate="2020-02-14";
    CODE

    statdate — the date for which the statistics were collected.


    To find records on a particular service:

    Find records on a particular service

    select * from itemstat where statdate="2020-02-14" and item=15;
    CODE

    statdate — the date for which the statistics were collected;

    item — service code.

  2. Delete the found records.

    Delete records

    delete from itemstat where statdate="2020-02-14";
    CODE

    statdate — the date for which the statistics will be deleted.


    To delete records on a particular service:

    Delete records

    delete from itemstat where statdate="2020-02-14" and item=15;
    CODE

    statdate — the date for which the statistics will be deleted;

    item — service code.

  3. In the laststatdate field of the processingmodule table, set the date for which you want to collect the statistics.

    Shift the date

    update processingmodule set laststatdate="2020-03-18" where id=1;
    CODE

    id — server id.

  4. Start statistics collection manually:

    Statistics collection

    /usr/local/mgr5/processing/pmispmgr5 --command stat --module 1
    CODE
  5. If the statistics are not collected, check the processing module. Most often, the problem with collecting statistics occurs due to errors on the processing module side or due BILLmanager server being unable to access the processing module.