Translate NUT (Network UPS Tools) protocol to 42ity-proto
C++ M4 Shell C Makefile
Switch branches/tags
Nothing to show
Clone or download
michal42 Merge pull request #132 from bstepankova/log4nut
Problem: fty-nut still uses old verbose approach
Latest commit ea6d779 Jul 19, 2018
Permalink
Failed to load latest commit information.
builds Problem: We need to integrate fty-common-logging Jul 13, 2018
doc Regenerated zproject with current latest templates, applying recent r… Jun 5, 2018
include Problem: fty-nut still uses old verbose approach Jul 19, 2018
packaging Problem: We need to integrate fty-common-logging Jul 13, 2018
src Merge pull request #132 from bstepankova/log4nut Jul 19, 2018
.clang-format Regen zproject Apr 28, 2018
.editorconfig Problem: obsolete zproject template in use Oct 13, 2017
.gitattributes Regenerate with current zproject; update reference to czmq, malamute … Jun 9, 2017
.gitignore Regenerated zproject with current latest templates, applying recent r… Jun 5, 2018
.travis.yml Regenerated zproject with current latest templates, applying recent r… Jun 5, 2018
AUTHORS Fix the documentation files and other requirements of "make distcheck" Jan 4, 2017
CONTRIBUTING.md Fix the documentation files and other requirements of "make distcheck" Jan 4, 2017
Jenkinsfile
LICENSE Fix the documentation files and other requirements of "make distcheck" Jan 4, 2017
Makefile.am
README.md Drop the fty-nut state file May 9, 2018
autogen.sh
ci_build.sh Problem: We need to integrate fty-common-logging Jul 13, 2018
ci_deploy.sh Problem: can't build under czmq4 Apr 26, 2017
ci_deploy_obs.sh
configure.ac Problem: We need to integrate fty-common-logging Jul 13, 2018
fty-dmf Apply bios=>fty renaming for paths (wave one) Jan 16, 2017
fty-nutconfig fty-nutconfig: Fix removing the last device Jul 4, 2018
generate.sh Separation of agent-nut from core Mar 29, 2016
install.xml Problem: mapping file not installed Jan 16, 2017
license.xml license.xml : Promote to (C) 2018 Jun 5, 2018
project.xml

README.md

fty-nut

fty-nut is a family of agents responsible for 42ITy interaction with NUT (see [http://www.networkupstools.org]) including both collection of device data and configuration of NUT to monitor new devices as assets are created.

To build fty-nut project run:

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

Compilation of fty-nut creates two binaries fty-nut and fty-nut-configurator, which are run by systemd service.

How to run

To run fty-nut project:

  • from within the source tree, run:
./src/fty-nut --mapping-file <path_to_mapping_file>
./src/fty-nut --mapping-file /usr/share/fty-nut/mapping.conf

./src/fty-nut-configurator
  • from an installed base, using systemd, run:
systemctl start fty-nut
systemctl start fty-nut-configurator

Configuration file

To configure fty-nut, a two configuration files exist: fty-nut.cfg and fty-nut-configurator.cfg. Both contain standard configuration directives, under the server sections. Additional parameter

  • fty-nut.cfg
    • polling_interval - polling interval in seconds. Default value: 30 s

Mapping file

Mapping between NUT and fty-nut is saved in:

/usr/share/fty-nut/mapping.conf

State File

The fty-nut-configurator state file is located in

/var/lib/fty/fty-autoconfig/state

Architecture

Overview

fty-nut is composed of three actors:

  • fty_nut_server - server actor
  • alert_actor - actor handling device alerts and thresholds coming from NUT
  • sensor_actor - actor handling sensor measurements coming from NUT.

fty-nut-configurator is composed of 1 actor:

  • fty_nut_configurator_server - server actor which configures nut-server (upsd) based on results from nut scanner

Protocols

Publishing Metrics

  • sensor_actor produces metrics from sensors connected to power devices on FTY_PROTO_STREAM_METRICS_SENSOR.
stream=_METRICS_SENSOR
sender=agent-nut-sensor
subject=humidity.0@epdu-77
D: 17-11-02 12:18:16 FTY_PROTO_METRIC:
D: 17-11-02 12:18:16     aux=
D: 17-11-02 12:18:16         port=0
D: 17-11-02 12:18:16     time=1509625096
D: 17-11-02 12:18:16     ttl=60
D: 17-11-02 12:18:16     type='humidity.0'
D: 17-11-02 12:18:16     name='epdu-77'
D: 17-11-02 12:18:16     value='37.60'
D: 17-11-02 12:18:16     unit='%'
stream=_METRICS_SENSOR
sender=agent-nut-sensor
subject=status.GPI1.0@epdu-76
D: 17-11-13 15:21:57 FTY_PROTO_METRIC:
D: 17-11-13 15:21:57     aux=
D: 17-11-13 15:21:57         sname=sensorgpio-81
D: 17-11-13 15:21:57         port=0
D: 17-11-13 15:21:57         ext-port=1
D: 17-11-13 15:21:57     time=1510586517
D: 17-11-13 15:21:57     ttl=60
D: 17-11-13 15:21:57     type='status.GPI1.0'
D: 17-11-13 15:21:57     name='epdu-76'
D: 17-11-13 15:21:57     value='closed'
D: 17-11-13 15:21:57     unit=''

alerts for sensors are managed by fty-alert-engine (environmental sensors) and fty-alert-flexible (GPI sensors)

  • fty_nut_server produces metrics on FTY_PROTO_STREAM_METRICS.
stream=METRICS
sender=fty-nut
subject=status.outlet.2@ups-52
D: 17-11-13 12:53:21 FTY_PROTO_METRIC:
D: 17-11-13 12:53:21     aux=
D: 17-11-13 12:53:21     time=1510577601
D: 17-11-13 12:53:21     ttl=60
D: 17-11-13 12:53:21     type='status.outlet.2'
D: 17-11-13 12:53:21     name='ups-52'
D: 17-11-13 12:53:21     value='42'
D: 17-11-13 12:53:21     unit=''

Publishing Alerts

  • alert_actor produces metrics on FTY_PROTO_STREAM_ALERT_SYS.
stream=_ALERTS_SYS
sender=bios-nut-alert
subject=outlet.group.1.voltage@epdu-54/OKG@epdu-54
D: 17-11-13 15:05:57 FTY_PROTO_ALERT:
D: 17-11-13 15:05:57     aux=
D: 17-11-13 15:05:57     time=1510560758
D: 17-11-13 15:05:57     ttl=90
D: 17-11-13 15:05:57     rule='outlet.group.1.voltage@epdu-54'
D: 17-11-13 15:05:57     name='epdu-54'
D: 17-11-13 15:05:57     state='RESOLVED'
D: 17-11-13 15:05:57     severity='OK'
D: 17-11-13 15:05:57     description='outlet.group.1.voltage is resolved'
D: 17-11-13 15:05:57     action=''

Consuming Assets

  • fty_nut_server, sensor_actor and alert_actor listen on FTY_PROTO_STREAM_ASSETS stream.

Mailbox Requests

No mailbox commands implemented