Skip to content

Commit

Permalink
added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
riley206 committed Jul 31, 2024
1 parent 1316f0a commit 0420153
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
59 changes: 59 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*- {{{
# ===----------------------------------------------------------------------===
#
# Installable Component of Eclipse VOLTTRON
#
# ===----------------------------------------------------------------------===
#
# Copyright 2022 Battelle Memorial Institute
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# ===----------------------------------------------------------------------===
# }}}

# Configuration file for the Sphinx documentation builder.

# -- Project information

project = 'VOLTTRON Log Statistics Agent'
copyright = '2024, Pacific Northwest National Lab'
author = 'Pacific Northwest National Lab'

release = '0.1'
version = '0.1.0'

# -- General configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ['std']

templates_path = ['_templates']

# -- Options for HTML output

html_theme = 'sphinx_rtd_theme'

# -- Options for EPUB output
# epub_show_urls = 'footnote'
84 changes: 84 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
volttron-log-statistics
=======================

.. image:: https://github.com/eclipse-volttron/volttron-log-statistics/actions/workflows/run-tests.yml/badge.svg
:alt: Passing?
.. image:: https://img.shields.io/pypi/v/volttron-log-statistics.svg
:target: https://pypi.org/project/volttron-log-statistics/

The Log Statistics agent periodically reads ".log" files based on the configured interval, computes the size delta from the previous interval and publishes the difference in bytes with a timestamp. It also publishes the standard deviation and mean of the size delta every 24 hours. This agent can be useful for detecting unexpected changes to the system which may be an indication of some sort of failure or breach.

Requires
--------

* python >= 3.10
* volttron >= 10.0

Installation
------------

Before installing, VOLTTRON should be installed and running. Its virtual environment should be active. Information on how to install the VOLTTRON platform can be found `here <https://github.com/eclipse-volttron/volttron-core>`_.

Create a directory called ``config`` and use the change directory command to enter it.

.. code-block:: shell
mkdir config
cd config
After entering the config directory, create a file called ``log_stat_config.json``. Use the below configuration section to populate your new file.

Configuration
~~~~~~~~~~~~~

The Log Statistics agent has 4 configuration parameters, all of which are required:

- ``file_path``: The file path to the log file. If no config provided, defaults to ``'volttron.log'`` located within your VOLTTRON_HOME environment variable.
- ``analysis_interval_secs``: The interval in seconds between publishes of the size delta statistic to the message bus. If no config provided, defaults to 60 seconds.
- ``publish_topic``: Used to specify a topic to publish log statistics to which does not get captured by the historian framework (topics not prefixed by any of: "datalogger", "record", "analysis", "devices"). If no config provided, defaults to ``"platform/log_statistics"``.
- ``historian_topic``: Can be used to specify a topic to publish log statistics to which gets captured by the historian framework ("datalogger", "record", "analysis", "devices"). If no config provided, defaults to ``record/log_statistics``.
- ``unit``: Can be used to specify units. Defaults to ``bytes``. Possible values are "bytes", "kb", "mb", "gb".

Here is an example configuration file named ``log_stat_config.json``.

.. code-block:: json
{
"analysis_interval_sec": 60,
"file_path": "path/to/.log",
"historian_topic": "analysis/log_statistics",
"publish_topic": "platform/log_statistics",
"unit": "bytes"
}
Store the configuration in the config store:

.. code-block:: bash
vctl config store platform.log_statistics config /path/to/config
Install and start the log statistics agent:

.. code-block:: bash
vctl install volttron-log-statistics --vip-identity platform.log_statistics --start
View the status of the installed agent:

.. code-block:: shell
vctl status
Development
-----------

Please see the following for contributing guidelines `contributing <https://github.com/eclipse-volttron/volttron-core/blob/develop/CONTRIBUTING.md>`_.

Please see the following helpful guide about `developing modular VOLTTRON agents <https://github.com/eclipse-volttron/volttron-core/blob/develop/DEVELOPING_ON_MODULAR.md>`_.

Disclaimer Notice
-----------------

This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights.

Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

0 comments on commit 0420153

Please sign in to comment.