<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>10. NUT developers tools</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Network UPS Tools Developer Guide" /><link rel="up" href="index.html" title="Network UPS Tools Developer Guide" /><link rel="prev" href="ar01s09.html" title="9. Network protocol information" /><link rel="next" href="ar01s11.html" title="11. NUT core development and maintenance" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="ar01s09.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ar01s11.html">Next</a></td></tr></table><hr /></div><div class="section" title="10. NUT developers tools"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dev-tools"></a>10. NUT developers tools</h2></div></div></div><p>NUT provides several tools for clients and core developers, and QA people.</p><div class="section" title="10.1. Device simulation"><div class="titlepage"><div><div><h3 class="title"><a id="dev-simu"></a>10.1. Device simulation</h3></div></div></div><p>The dummy-ups driver propose a simulation mode, also known as <span class="emphasis"><em>Dummy Mode</em></span>.
This mode allows to simulate any kind of devices, even non existing ones.</p><p>Using this method, you can either replay a real life sequence,
<a class="link" href="ar01s10.html#dev-recording" title="10.2. Device recording">recorded from an actual device</a>, or directly interact
through upsrw or by editing the device file, to modify the variables values.</p><p>Here is an example to setup a device simulation:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
install NUT as usual, if not already done
</li><li class="listitem">
get a simulation file (.dev) or sequence (.seq), or generate one using the
<a class="link" href="ar01s10.html#dev-recording" title="10.2. Device recording">device recorder</a>. Sample files are provided in the <span class="emphasis"><em>data</em></span>
directory of the NUT source. You can also download these from the development
repository, such as the
<a class="ulink" href="http://anonscm.debian.org/viewvc/nut/trunk/data/evolution500.seq?revision=2778&view=co" target="_top">evolution500.seq</a>.
</li><li class="listitem">
copy the simulation file to your sysconfig directory, like /etc/nut or
/etc/ups
</li><li class="listitem"><p class="simpara">
configure NUT for simulation (<a class="ulink" href="../man/ups.conf.html" target="_top">ups.conf(5)</a>):
</p><pre class="literallayout">[dummy]
        driver = dummy-ups
        port = evolution500.dev
        desc = "dummy-ups in dummy mode"</pre></li><li class="listitem"><p class="simpara">
now start NUT, at least dummy-ups and upsd:
</p><pre class="literallayout">$ upsdrvctl start dummy
$ upsd</pre></li><li class="listitem"><p class="simpara">
and check the data:
</p><pre class="literallayout">$ upsc dummy
...</pre></li><li class="listitem"><p class="simpara">
you can also use upsrw to modify the data:
</p><pre class="literallayout">$ upsrw -s ups.status="OB LB" -u user -p password dummy</pre></li><li class="listitem">
or directly edit /etc/nut/evolution500.seq. In this case, modification will
only apply according to the TIMER events and the current position in the
sequence.
</li></ul></div><p>For more information, refer to <a class="ulink" href="../man/dummy-ups.html" target="_top">dummy-ups(8)</a> manual page.</p></div><div class="section" title="10.2. Device recording"><div class="titlepage"><div><div><h3 class="title"><a id="dev-recording"></a>10.2. Device recording</h3></div></div></div><p>To complete dummy-ups, NUT provides a device recorder script called
<span class="emphasis"><em>device-recorder.sh</em></span> and located in the <span class="emphasis"><em>tools/</em></span> directory of the
NUT source tree.</p><p>This script uses <span class="emphasis"><em>upsc</em></span> to record device information, and stores
these in a differential fashion every 5 seconds (by default).</p><p>Its usage is the following:</p><pre class="literallayout">Usage: dummy-recorder.sh <device-name> [output-file] [interval]</pre><p>For example, to record information from the device <span class="emphasis"><em>myups</em></span> every 10 seconds:</p><pre class="literallayout">tools/device-recorder.sh myups@localhost myups.seq 10</pre><p>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 <a class="link" href="ar01s10.html#dev-simu" title="10.1. Device simulation">dummy-ups</a> driver.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s09.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ar01s11.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>