# Module monitor

- Description
- Data Types
- Function Index
- Function Details

Monitors data from different processes, e.g.

Copyright © 2011-2015 Zuse Institute Berlin

Version: $Id$

Behaviours: `gen_component`.

Authors: Nico Kruber (`kruber@zib.de`).

## Description

Monitors data from different processes, e.g. for performance evaluations.

## Data Types

### key()

    key() = atom()

### message()

    message() =
        {report_rrd,
         Process :: atom(),
         Key :: key(),
         OldValue :: rrd:rrd(),
         Value :: rrd:rrd()} |
        {report_single,
         Process :: atom(),
         Key :: key(),
         NewValue_or_UpdateFun ::
             term() | fun((Old :: Value | undefined) -> New :: Value)} |
        {check_timeslots} |
        {web_debug_info, Requestor :: comm:erl_local_pid()}

### state()

    state() =
        {Table :: ets:tid() | atom(), ApiTxReqList :: rrd:rrd()}

### table_index()

    table_index() = {Process :: atom(), Key :: key()}

## Function Index

check_config/0 | Checks whether config parameters of the monitor process exist and are valid.
check_report/4 |
clear_rrds/2 |
client_monitor_set_value/3 | Sets the value at Key inside the monitor process of the 'clients_group'.
get_rrd_keys/0 | Get the available RRD keys.
get_rrd_keys/1 |
get_rrds/2 | Retrieve individual RRDs from monitor.
init/1 | Initialises the module with an empty state.
monitor_set_value/3 | Sets the value at Key inside the monitor process of the current group.
on/2 | Message handler when the rm_loop module is fully initialized.
proc_check_all_timeslot/0 | Advances the stored timeslots of the value at Key inside the current process (if necessary) to the current time.
proc_check_timeslot/2 | Advances the stored timeslots of the value at Key inside the current process (if necessary) to the current time.
proc_clear_value/2 |
proc_exists_value/2 | Checks whether a value exists at Key.
proc_get_value/2 | Gets the value stored at Key.
proc_set_value/3 | Sets the value at Key inside the current process.
start_gen_component/5 |
start_link/1 | Starts the monitor process, registers it with the process dictionary and returns its pid for use by a supervisor.
web_debug_info_merge_values/2 |

## Function Details

### start_gen_component/5

    start_gen_component(Module :: module(),
                        Handler :: gen_component:handler(),
                        Args :: term(),
                        Options :: [gen_component:option()],
                        Self :: pid()) ->
                           no_return() | ok

### check_report/4

    check_report(Process :: atom(),
                 Key :: key(),
                 Old :: Value,
                 New :: Value) ->
                    ok

### proc_set_value/3

    proc_set_value(Process :: atom(),
                   Key :: key(),
                   NewValue_or_UpdateFun ::
                       term() |
                       fun((Old :: Value | undefined) -> New :: Value)) ->
                      ok

Sets the value at Key inside the current process. Either specify a new value or an update function which generates the new value from the old one. If a new time slot is started by updating the value, then the rrd() record is send to the monitor process.

### monitor_set_value/3

    monitor_set_value(Process :: atom(),
                      Key :: key(),
                      NewValue_or_UpdateFun ::
                          term() |
                          fun((Old :: Value | undefined) ->
                                  New :: Value)) ->
                         ok

Sets the value at Key inside the monitor process of the current group. Either specify a new value or an update function which generates the new value from the old one.

### proc_check_timeslot/2

    proc_check_timeslot(Process :: atom(), Key :: key()) -> ok

Advances the stored timeslots of the value at Key inside the current process (if necessary) to the current time. If a new time slot is started by updating the value, then the rrd() record is send to the monitor process.

### proc_check_all_timeslot/0

    proc_check_all_timeslot() -> ok

Advances the stored timeslots of the value at Key inside the current process (if necessary) to the current time. If a new time slot is started by updating the value, then the rrd() record is send to the monitor process.

### client_monitor_set_value/3

    client_monitor_set_value(Process :: atom(),
                             Key :: key(),
                             NewValue_or_UpdateFun ::
                                 term() |
                                 fun((Old :: Value | undefined) ->
                                         New :: Value)) ->
                                ok

Sets the value at Key inside the monitor process of the 'clients_group'. Either specify a new value or an update function which generates the new value from the old one.

### proc_exists_value/2

    proc_exists_value(Process :: atom(), Key :: key()) -> boolean()

Checks whether a value exists at Key.

### proc_get_value/2

    proc_get_value(Process :: atom(), Key :: key()) -> rrd:rrd()

Gets the value stored at Key. The key must exist, otherwise no rrd() structure is returned!

### proc_clear_value/2

    proc_clear_value(Process :: atom(), Key :: key()) -> ok

### get_rrds/2

    get_rrds(MonitorPid :: comm:erl_local_pid(),
             Keys :: [table_index()]) ->
                [{atom(), key(), rrd:rrd() | undefined}]

Retrieve individual RRDs from monitor

### clear_rrds/2

    clear_rrds(MonitorPid :: comm:erl_local_pid(),
               Keys :: [table_index()]) ->
                  ok

### on/2

    on(X1 :: message(), State :: state()) -> state()

Message handler when the rm_loop module is fully initialized.

### web_debug_info_merge_values/2

    web_debug_info_merge_values(Key :: table_index(),
                                Data :: rrd:rrd()) ->
                                   {Key :: string(),
                                    LastNValues :: string()}

### start_link/1

    start_link(DHTNodeGroup :: pid_groups:groupname()) -> {ok, pid()}

Starts the monitor process, registers it with the process dictionary and returns its pid for use by a supervisor.

### init/1

    init(X1 :: null) -> state()

Initialises the module with an empty state.

### check_config/0

    check_config() -> boolean()

Checks whether config parameters of the monitor process exist and are valid.

### get_rrd_keys/0

    get_rrd_keys() -> [table_index()] | timeout

Get the available RRD keys

### get_rrd_keys/1

    get_rrd_keys(MonitorPid :: comm:erl_local_pid()) ->
                    [table_index()] | timeout

Generated by EDoc, Feb 29 2016, 16:12:21.