Persistent storage for metrics
C++ M4 Shell C Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
builds
doc
include
packaging
src
.clang-format
.editorconfig
.gitattributes
.gitignore
.travis.yml
COPYING
Jenkinsfile
Makefile.am
README.md
autogen.sh
ci_build.sh
ci_deploy.sh
ci_deploy_obs.sh
configure.ac
fty-metric-store-cleaner
license.xml
project.xml

README.md

fty-metric-store

Agent fty-metric-store stores metrics to DB and provides an interface to request them.

How to build

To build fty-metric-store project run:

./autogen.sh
./configure
make
make check # to run self-test

How to run

To run fty-metric-store project:

  • from within the source tree, run:
./src/fty-metric-store

For the other options available, refer to the manual page of fty-metric-store

  • from an installed base, using systemd, run:
systemctl start fty-metric-store

Agent also contains script set up as timer service for cleaning up old metrics: fty-metric-store-cleaner.

For further information, refer to the manual page of fty-metric-store-cleaner.

Configuration file

Configuration file - fty-metric-store.cfg - is currently ignored.

Agent reads environment variable BIOS_LOG_LEVEL to set verbosity level.

Architecture

Overview

fty-metric-store has 1 actor:

  • fty-metric-store-server: main actor

It also has one built-in timer, which checks the cache of pending metrics every second.
If it contains too much data/enough time passed, inserts metrics into DB.

Protocols

Published metrics

Agent doesn't publish any metrics.

Published alerts

Agent doesn't publish any alerts.

Mailbox requests

Agent fty-metric-store can be requested for:

  • getting metrics for specified device and topic, of specified type and step,
    from the specified time interval

Getting metrics

The USER peer sends the following message using MAILBOX SEND to FTY-METRIC-STORE-SERVER ("fty-metric-store") peer:

  • zuuid/GET/asset/topic/step/type/start/end/ordering_flag
    • request metrics for specified device and topic, of specified type and step,
      from the specified time interval

where

  • '/' indicates a multipart string message
  • 'asset' is internal name of an asset
  • 'topic' is what the metric measures. e.g. realpower.default
  • 'step' is interval over which the metric was computed (15m, 24h, 7d, 30d)
  • 'type' MUST be one of the (min, max, arithmetic_mean)
  • 'start' MUST be UTC unix timestamp
  • 'end' MUST be UTC unix timestamp
  • 'start' < 'end'
  • 'ordering_flag' MUST be 0 or 1
  • subject of the message MUST be "aggregated data".

The FTY-METRIC-STORE-SERVER peer MUST respond with one of these messages back to USER peer using MAILBOX SEND.

  • zuuid/OK/asset/topic/step/type/start/end/ordering_flag/unit/[timestamp-i/value-i]
  • zuuid/ERROR/reason

where

  • '/' indicates a multipart frame message
  • 'zuuid','asset','topic','step','type','start','end','ordering_flag' MUST be repeated from request
  • 'unit' MUST be unit of requested metric
  • 'timestamp' MUST be timestamp of the metric sent
  • 'value' MUST be value of the metric sent
  • 'reason' MUST be reason for error
  • subject of the message MUST be "aggregated data".

Stream subscriptions

METRICS stream

If the metric did not come from fty-metric-compute, ignore it.

If it did, insert it into DB.

ASSETS stream

If ASSET DELETE came, delete all topics and measurements for this asset.