1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
:titles.underlines: "__","==","--","~~","^^"
Network UPS Tools Developer Guide
_________________________________
:Author: Russell_Kroll,_Arnaud_Quette,_Charles_Lepple,_Peter_Selinger,_Jim_Klimov_and_NUT_project_community_contributors
:Author Initials: RK, AQ, CL, PS & JK
Introduction
============
NUT is both a powerful toolkit and framework that provides support for Power
Devices, such as Uninterruptible Power Supplies, Power Distribution Units
and Solar Controllers.
This document intends to describe how NUT is designed, and the way to
develop new device drivers and client applications.
[[design]]
include::design.txt[]
[[versioning]]
include::nut-versioning.adoc[]
[[developers]]
include::developers.txt[]
[[new-drivers]]
include::new-drivers.txt[]
[[sock-protocol]]
include::sock-protocol.txt[]
[[augeas]]
include::../scripts/augeas/README.adoc[]
[[devscan]]
include::../tools/nut-scanner/README.adoc[]
[[new-clients]]
include::new-clients.txt[]
[[net-protocol]]
include::net-protocol.txt[]
[[dev-tools]]
NUT developers tools
====================
NUT provides several tools for clients and core developers, and QA people.
[[dev-simu]]
Device simulation
-----------------
The dummy-ups driver propose a simulation mode, also known as 'Dummy Mode'.
This mode allows to simulate any kind of devices, even non existing ones.
Using this method, you can either replay a real life sequence,
<<dev-recording,recorded from an actual device>>, or directly interact
through `upsrw` or by editing the device file, to modify the variables'
values.
Here is an example to setup a device simulation:
- install NUT as usual, if not already done
- get a simulation file (`.dev`) or sequence (`.seq`), or generate one using
the <<dev-recording,device recorder>>. Sample files are provided in the
`data` directory of the NUT source. You can also download these from
the development repository, such as the
link:https://github.com/networkupstools/nut/raw/master/data/evolution500.seq[evolution500.seq]
or from link:https://github.com/networkupstools/nut-ddl/[NUT DDL] collection.
- copy the simulation file to your sysconfig directory, like `/etc/nut`
or `/etc/ups`
- configure NUT for simulation (linkman:ups.conf[5]):
+
[dummy]
driver = dummy-ups
port = evolution500.dev
desc = "dummy-ups in dummy mode"
+
- now start NUT, at least `dummy-ups` and `upsd`:
+
:; upsdrvctl start dummy
:; upsd
+
- and check the data:
+
:; upsc dummy
...
+
- you can also use `upsrw` to modify the data in memory:
+
:; upsrw -s ups.status="OB LB" -u user -p password dummy
+
- or directly edit your copy of `/etc/nut/evolution500.seq`.
In this case, modification will only apply according to the `TIMER`
events and the current position in the sequence.
For more information, refer to linkman:dummy-ups[8] manual page.
[[dev-simu-disco]]
Simulated devices discovery
---------------------------
Any simulation file that is saved in the sysconfig directory can be
automatically discovered and configured using nut-scanner:
----
:; nut-scanner -n
:; nut-scanner --nut_simulation_scan
----
[[dev-recording]]
Device recording
----------------
To complete `dummy-ups`, NUT provides a device recorder script called
`nut-recorder.sh` and located in the 'tools/' directory of the
NUT source tree.
This script uses `upsc` to record device information, and stores
these in a differential fashion every 5 seconds (by default).
Its usage is the following:
Usage: dummy-recorder.sh <device-name> [output-file] [interval]
For example, to record information from the device 'myups' every 10 seconds:
:; nut-recorder.sh myups@localhost myups.seq 10
During the recording, you will want to generate power events, such as power
failure and restoration. These will be tracked in the simulation files, and
be eventually be replayed by the <<dev-simu,dummy-ups>> driver.
NUT core development and maintenance
====================================
This section is intended to people who want to develop new core features,
or to do some maintenance.
include::macros.txt[]
[[roadmap]]
include::../TODO.adoc[]
[[nut-names]]
Appendix A: NUT command and variable naming scheme
==================================================
include::nut-names.txt[]
[[daisychain]]
Appendix B: NUT daisychain support notes
========================================
include::daisychain.txt[]
[[lib-info]]
Appendix C: NUT libraries complementary information
===================================================
include::../lib/README.adoc[]
|