Storm Package: synapse-metrics

The following Commands are available from this package. This documentation is generated for version 3.15.0 of the package.

Storm Commands

This package implements the following Storm Commands.

metrics.edits.byedge

Get edits for a specific light edge.

This command takes a light edge name and displays edits involving that edge.

Examples:

  // Get edits for a specific edge
  metrics.edits.byedge seen

  // Get edits where a specific edge was removed from a node
  metrics.edits.byedge seen --unset


Usage: metrics.edits.byedge [options] <edge>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --unset                     : Only return edits where the edge was removed from a destination node.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <edge>                      : Edge to get edits for.

metrics.edits.bynode

Get the edit history of a node.

This command takes any nodes as input and will display the edit history
of those nodes.

Examples:

  test:str=foo | metrics.edits.bynode


Usage: metrics.edits.bynode [options]

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of edits returned. (default: None)
  --back                      : Retrieve edits in reverse order.

metrics.edits.byprop

Get edits of a specific property.

This command takes a property name as input and displays edits involving that property.
Property names must be in form:prop or .universal form.

Examples:

  // Get edits of the .created property
  metrics.edits.byprop ".created"

  // Get edits where inet:fqdn:domain was set to 'link'
  metrics.edits.byprop inet:fqdn:domain --newv link


Usage: metrics.edits.byprop [options] <prop>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the property to this value. (default: None)
  --oldv <oldv>               : Only return edits where the property was changed from this value. (default: None)
  --init                      : Only return edits where the property initialized from None.
  --unset                     : Only return edits where the property was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <prop>                      : Property to get edits for.

metrics.edits.bytag

Get edits of a specific tag.

This command takes a tag name as input and displays edits involving that tag.

Examples:

  // Get edits for a specific tag
  metrics.edits.bytag cool.tag

  // Get edits where a specific tag was deleted
  metrics.edits.bytag cool.tag --unset


Usage: metrics.edits.bytag [options] <tag>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the tag to this value. (default: None)
  --oldv <oldv>               : Only return edits where the tag was changed from this value. (default: None)
  --init                      : Only return edits where the tag initialized from None.
  --unset                     : Only return edits where the tag was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <tag>                       : Tag to get edits for.

metrics.edits.bytagprop

Get edits of a specific tag property.

This command takes a tag property name as input and displays edits involving that property.

Examples:

  // Get edits of a specific tagprop
  metrics.edits.bytagprop coolprop

  // Get edits where the tagprop 'coolprop' was set to 'awesome'
  metrics.edits.bytagprop coolprop --newv awesome


Usage: metrics.edits.bytagprop [options] <prop>

Options:

  --help                      : Display the command usage.
  --tag <tag>                 : Filter edits to a specific tag. (default: None)
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the tag property to this value. (default: None)
  --oldv <oldv>               : Only return edits where the tag property was changed from this value. (default: None)
  --init                      : Only return edits where the tag property initialized from None.
  --unset                     : Only return edits where the tag property was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <prop>                      : Tag property to get edits for.

metrics.edits.bytime

Get the edit history for a specified time range.

This command takes a time or ival as input and displays the edit history for that
time range. If a single time value is provided, all edits after that time will be
displayed, or all edits before that time when using the --back flag.

Examples:

  // Display all edits in a time range
  metrics.edits.bytime (2020-01-01 10:00, 2020-01-01 11:00)

  // Specify time range with relative value
  metrics.edits.bytime (2020-01-01 10:00, +1hour)

  // Display edits after a specific time
  metrics.edits.bytime 2020-01-01


Usage: metrics.edits.bytime [options] <time>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.

Arguments:

  <time>                      : Time window to get edits for.

metrics.edits.byuser

Get the edit history for a user.

This command takes a username as input and displays the edit history for that
user.

Examples:

  metrics.edits.byuser exampleuser


Usage: metrics.edits.byuser [options] <user>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <user>                      : Username to get edits for.

metrics.nodes.byedge

Yield nodes for a specific light edge.

This command takes a light edge name and yields source nodes from
edits involving that light edge.

Examples:

  // Yield nodes for a specific edge
  metrics.nodes.byedge seen

  // Yield nodes where a specific edge was removed
  metrics.nodes.byedge seen --unset


Usage: metrics.nodes.byedge [options] <edge>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --unset                     : Only return edits where the edge was removed from a destination node.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <edge>                      : Edge to get edits for.

metrics.nodes.byprop

Yield nodes from edits of a specific property.

This command takes a property name as input and yields nodes from edits involving that property.
Property names must be in form:prop or .universal form.

Examples:

  // Yield nodes from edits of the .created property
  metrics.nodes.byprop ".created"

  // Yield nodes from edits where inet:fqdn:domain was set to 'link'
  metrics.nodes.byprop inet:fqdn:domain --newv link


Usage: metrics.nodes.byprop [options] <prop>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the property to this value. (default: None)
  --oldv <oldv>               : Only return edits where the property was changed from this value. (default: None)
  --init                      : Only return edits where the property initialized from None.
  --unset                     : Only return edits where the property was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <prop>                      : Property to get edits for.

metrics.nodes.bytag

Yield nodes from edits of a specific tag.

This command takes a tag name as input and yields nodes from edits involving that tag.

Examples:

  // Yield nodes from edits for a specific tag
  metrics.nodes.bytag cool.tag

  // Yield nodes from edits where a specific tag was deleted
  metrics.nodes.bytag cool.tag --unset


Usage: metrics.nodes.bytag [options] <tag>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the tag to this value. (default: None)
  --oldv <oldv>               : Only return edits where the tag was changed from this value. (default: None)
  --init                      : Only return edits where the tag initialized from None.
  --unset                     : Only return edits where the tag was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <tag>                       : Tag to get edits for.

metrics.nodes.bytagprop

Yield nodes from edits of a specific tag property.

This command takes a tag property name as input and yields nodes from edits involving that property.

Examples:

  // Yield nodes from edits of a specific tagprop
  metrics.nodes.bytagprop coolprop

  // Yield nodes from edits where the tagprop 'coolprop' was set to 'awesome'
  metrics.nodes.bytagprop coolprop --newv awesome


Usage: metrics.nodes.bytagprop [options] <prop>

Options:

  --help                      : Display the command usage.
  --tag <tag>                 : Filter edits to a specific tag. (default: None)
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --newv <newv>               : Only return edits which set the tag property to this value. (default: None)
  --oldv <oldv>               : Only return edits where the tag property was changed from this value. (default: None)
  --init                      : Only return edits where the tag property initialized from None.
  --unset                     : Only return edits where the tag property was deleted.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <prop>                      : Tag property to get edits for.

metrics.nodes.bytime

Yield nodes from the edit history for a specified time range.

This command takes a time or ival as input and yields the nodes in the edit history for that
time range. If a single time value is provided, all edits after that time will be
retrieved, or all edits before that time when using the --back flag.

Examples:

  // Yield nodes from edits in a time range
  metrics.nodes.bytime (2020-01-01 10:00, 2020-01-01 11:00)

  // Specify time range with relative value
  metrics.nodes.bytime (2020-01-01 10:00, +1hour)

  // Yield nodes from edits after a specific time
  metrics.nodes.bytime 2020-01-01


Usage: metrics.nodes.bytime [options] <time>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.

Arguments:

  <time>                      : Time window to get edits for.

metrics.nodes.byuser

Yield nodes from the edit history for a user

Examples:

  metrics.nodes.byuser exampleuser


Usage: metrics.nodes.byuser [options] <user>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --layr <layr>               : Filter edits to a single layer. (default: None)
  --size <size>               : Limit the number of results returned. (default: None)
  --back                      : Retrieve edits in reverse order.
  --time <time>               : Filter edits to a specified time window. (default: None)

Arguments:

  <user>                      : Username to get edits for.

metrics.status

Display the current status of the metrics service.

This command will output whether a Cortex has been configured, and an
estimated progress of the metrics service in indexing a configured Cortex's
edits.

Examples:

  metrics.status


Usage: metrics.status [options]

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.

Storm Modules

This package implements the following Storm Modules.

metrics

getStatus()

Retrieve the current indexing status.

Returns:

A status dictionary with a bool success key and offset information. The return type is dict.

getLayersInfo()

Retrieve indexing layers for all layers.

Returns:

A status dictionary with layer idens as keys. The return type is dict.

waitIndxOffs(offs, timeout=(null))

Wait for the service to index edits at the given Nexus offset.

Args:

offs (int): The Nexus offset to wait for.

timeout (int): Optional timeout in seconds.

Returns:

Whether the service reached the offset or timeout out. The return type is bool.

waitIndxLive(timeout=(null))

Waits for the service to index edits at the current Nexus offset.

Args:

timeout (int): Optional timeout in seconds.

Returns:

Whether the service reached the current Nexus offset or timeout out. The return type is bool.

aggStatsByTime(ival, scope=view, window=(60))

Retrieve statistics aggregated across the specified layers within the provided window.

Args:

ival (list): The timestamp interval to retrieve results for.

scope (str): One of “cortex” (all layers), “view” (current view), “layer” (current write layer).

window (int): The aggregation window time in seconds.

Yields:

List of (time, counts), where counts is a dictionary of count dictionaries. The return type is list.

editsByNode(n, back=(false), layr=(null), size=(null))

Retrieve edits by node.

Args:

n (node): The node to retrieve edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

editsByUser(uname, back=(false), layr=(null), time=(null), size=(null))

Retrieve edits by user.

Args:

uname (str): A user name or iden.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByUser(uname, back=(false), layr=(null), time=(null), filters=(null))

Yield nodes that had edits made by the user.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

uname (str): A user name or iden.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.

editsByTime(time=(null), back=(false), layr=(null), size=(null))

Retrieve edits by a specified time range.

Args:

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByTime(time=(null), back=(false), layr=(null), filters=(null))

Yield nodes by edits made within a specified time range.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.

editsByProp(prop, back=(false), layr=(null), time=(null), size=(null))

Retrieve edits of a specific property.

Args:

prop (str): Property name, formatted as form:prop or .universal.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByProp(prop, back=(false), layr=(null), time=(null), filters=(null))

Yield nodes by edits of a specific property.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

prop (str): Property name, formatted as form:prop or .universal.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.

editsByEdge(edge, back=(false), layr=(null), time=(null), size=(null))

Retrieve edits for a specific light edge.

Args:

edge (str): The edge name to get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByEdge(edge, back=(false), layr=(null), time=(null), filters=(null))

Yield nodes by edits for a specific light edge.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

edge (str): The edge name to get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.

editsByTag(tag, back=(false), layr=(null), time=(null), size=(null))

Retrieve edits for a specific tag.

Args:

tag (str): The tag to get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByTag(tag, back=(false), layr=(null), time=(null), filters=(null))

Yield nodes by edits for a specific tag.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

tag (str): The tag to get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.

editsByTagProp(tagprop, back=(false), layr=(null), time=(null), size=(null))

Retrieve edits for a specific tag property.

Args:

tagprop (str): The tag property get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

size (int): Limit the number of edits to yield.

Returns:

A generator which yields edit dictionaries. The return type is generator.

nodesByTagProp(tagprop, back=(false), layr=(null), time=(null), filters=(null))

Yield nodes by edits for a specific tag property.

The filters argument accepts a dictionary with the following optional keys:

({
  "tag": "Only return edits for a specific tag.",
  "unset": "If $lib.true, only return edits where the value was deleted.",
  "init": "If $lib.true, only return edits where the value was initialized from $lib.null.",
  "newv": "Only return edits which set the property to this value.",
  "oldv": "Only return edits where the property was changed from this value.",
})
Args:

tagprop (str): The tag property get edits for.

back (bool): If $lib.true, yield results in reverse order.

layr (str): Retrieve edits for a specific layer instead of all layers in the view.

time: A time or ival to bound the edits by. The input type may be one of the following: str, list.

filters (dict): Only return edits that match all the specified criteria

Yields:

Nodes with edits matching the input criteria. The return type is node.