-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from simonsobs/develop
v0.4.1
- Loading branch information
Showing
31 changed files
with
1,547 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/pre-commit/mirrors-autopep8 | ||
rev: v2.0.0 | ||
rev: v2.0.1 | ||
hooks: | ||
- id: autopep8 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 5.0.4 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
.. highlight:: rst | ||
|
||
.. _ups: | ||
|
||
==================== | ||
UPS Agent | ||
==================== | ||
|
||
The UPS Agent is an OCS Agent which monitors various UPS models via SNMP. | ||
|
||
.. argparse:: | ||
:filename: ../socs/agents/ups/agent.py | ||
:func: add_agent_args | ||
:prog: python3 agent.py | ||
|
||
Configuration File Examples | ||
--------------------------- | ||
|
||
Below are configuration examples for the ocs config file and for running the | ||
Agent in a docker container. | ||
|
||
OCS Site Config | ||
``````````````` | ||
|
||
To configure the UPS Agent we need to add a UPSAgent | ||
block to our ocs configuration file. Here is an example configuration block | ||
using all of the available arguments:: | ||
|
||
{'agent-class': 'UPSAgent', | ||
'instance-id': 'ups', | ||
'arguments': [['--address', '10.10.10.50'], | ||
['--port', 161], | ||
['--mode', 'acq'], | ||
['--snmp-version', 1]]}, | ||
|
||
.. note:: | ||
The ``--address`` argument should be the address of the UPS on the network. | ||
|
||
Docker Compose | ||
`````````````` | ||
|
||
The UPS Agent should be configured to run in a Docker container. An | ||
example docker-compose service configuration is shown here:: | ||
|
||
ocs-ups: | ||
image: simonsobs/socs:latest | ||
hostname: ocs-docker | ||
network_mode: "host" | ||
volumes: | ||
- ${OCS_CONFIG_DIR}:/config:ro | ||
environment: | ||
- INSTANCE_ID=ups | ||
- SITE_HUB=ws://127.0.0.1:8001/ws | ||
- SITE_HTTP=http://127.0.0.1:8001/call | ||
- LOGLEVEL=info | ||
|
||
|
||
The ``LOGLEVEL`` environment variable can be used to set the log level for | ||
debugging. The default level is "info". | ||
|
||
Description | ||
----------- | ||
|
||
Various UPS models will be used to power various components on the SO site. | ||
The UPS Agent allows the monitoring of a UPS model. It provides information | ||
on the manufacturer and model of the UPS. It monitors the state of each | ||
output, as well as several stats of the battery. The UPS has an Simple Network | ||
Management Protocol (SNMP) interface. The agent has been tested on the | ||
following Falcon models: SSG3K-2T, SSG3KRM-2. These models require a SNMP | ||
interface add-on card to be installed. | ||
|
||
The UPS Agent actively issues SNMP GET commands to request the status from | ||
several Object Identifiers (OIDs) specified by the provided Management | ||
Information Base (MIB). We sample only a subset of the OIDs defined by the MIB. | ||
The MIB has been converted from the original .mib format to a .py format that | ||
is consumable via pysnmp and is provided by socs. | ||
|
||
Agent Fields | ||
```````````` | ||
|
||
The fields returned by the Agent are built from the SNMP GET responses from the | ||
UPS. The field names consist of the OID name and the last value of the OID, | ||
which often serves as an index for duplicate pieces of hardware that share a | ||
OID string, i.e. outputs on the OID "upsOutputVoltage". This results in field | ||
names such as "upsOutputVoltage_0" and "upsOutputVoltage_1". | ||
|
||
These queries mostly return integers which map to some state. These integers | ||
get decoded into their corresponding string representations and stored in the | ||
OCS Agent Process' session.data object. For more details on this structure, see | ||
the Agent API below. For information about the states corresponding to these | ||
values, refer to the MIB file. | ||
|
||
Agent API | ||
--------- | ||
|
||
.. autoclass:: socs.agents.ups.agent.UPSAgent | ||
:members: | ||
|
||
Supporting APIs | ||
--------------- | ||
|
||
.. autoclass:: socs.agents.ups.agent.update_cache | ||
:members: | ||
:noindex: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.