NUT provides several tools for clients and core developers, and QA people.
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, 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:
.dev
) or sequence (.seq
), or generate one using
the 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
evolution500.seq.
/etc/nut
or /etc/ups
configure NUT for simulation (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
/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 dummy-ups(8) manual page.
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
+
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 dummy-ups driver.