User:Frogging101/OWTG

This is a work-in-progress

This is the documentation page for the external rack temperature monitoring system; a system for monitoring the temperature of the racks in the computing cluster.

Components

 * Maxim DS9490R USB to 1-Wire RJ11 bridge | Product Page | Datasheet
 * Maxim DS18B20 1-Wire thermal sensor | Product Page | Datasheet

Pin Configuration
1USB makes available 100mA to a non-enumerated device. By design specification, the adapter uses 58mA. This leaves 42mA of available current for any slave devices. Each sensor uses 1.5mA when active, therefore unless we putting a very large number of sensors (25+) on one line, this should not be a problem.

2GND is connected directly to USB ground, and GND_OW is connected through an ESD protection device/diode. It is simpler to use GND as there are no resistors on it, and any ESD would safely short to USB ground.

Compiling and installing OWFS 2.9p1
Due to (mostly alias-related) bugs in the version on the Ubuntu repositories, it is necessary to compile a later version. Compiling OWFS from source is fairly straightforward.

Dependencies:
 * libusb-dev

You must install these before proceeding; they are available in the Ubuntu repositories.

To compile and install OWFS:


 * 1) Make sure that the repository version of OWFS and all related components have been removed.
 * 2) Download owfs-2.9p1.tar.gz
 * 3) Extract it and cd into the directory
 * 4) Configure it: ./configure --enable-usb=yes
 * 5) Install it: sudo make install

It is now installed in /opt/owfs/, and the binary files are in /opt/owfs/bin/.

Installing OWTG
To allow sensors in multiple areas and connected to different computers to be accessible from one machine and web interface, we use a feature of owserver that allows one to use another server address as a bus master, which makes any sensors seen by a remote server accessible as if they were connected locally.

The machine that hosts the web interface and generates the graphs will be called the "master", and the machines that only run owserver will be called "slaves". Slave machines use no owfs.conf (as they don't need to have servers added), and they don't really run any OWTG scripts; they run owserver and listen for connections from a master which will connect to them and track their sensors.

Both masters and slaves can be connected to sensors.

Master
There should be only one machine configured in this way.

Run these commands (you can copy and paste them into the terminal):

sudo mkdir /opt/owtg sudo chmod 666 /opt/owtg mkdir /opt/owtg/etc mkdir /opt/owtg/bin sudo touch /opt/owtg/etc/owfs.conf touch /opt/owtg/etc/sensors chmod 666 /opt/owtg/etc/sensors

This will create the necessary directories for owtg to function and a blank owfs.conf. Now some configuration is required.

If apache and PHP are not installed, install them. You will also need python-rrdtool to interface with owserver. This command should work on Debian-based distros:

sudo apt-get install apache2 php5 python-rrdtool

Also, if you havent't already, compile and install OWFS by following the instructions in the section


 * 1) Download and extract this file, which contains the OWTG-related scripts and webpages
 * 2) Open /opt/owtg/etc/owfs.conf with a text editor as root, and paste the outlined contents of this page into it. Save the file.
 * 3) Now open /etc/rc.local with a text editor, again as root, and add this line: sudo /opt/owfs/bin/owserver -c /opt/owtg/etc/owfs.conf somewhere before "exit 0". This will start owserver when the machine is booted.
 * 4) Open a terminal and cd to the directory where you downloaded the file in step 1. Run these commands: unzip -jq OWTG-master.zip OWTG-master/scripts/* -d /opt/owfs/bin/&#10;unzip -jq OWTG-master.zip OWTG-master/web/* -d /var/www/ Or manually copy the contents of "scripts" to /opt/owfs/bin/ and "web" to /var/www (or whatever the root directory is on your webserver)
 * 5) Run this command to change the permissions of the scripts: chmod 0755 /opt/owtg/bin/*
 * 6) Add these two lines to the bottom of your crontab (To do this you can use "crontab -e"): * * * * * /opt/owtg/bin/minute.sh >> /dev/null 2>&1&#10;*/5 * * * * /opt/owtg/bin/rrdgraph.py > /dev/null 2>&1
 * 7) Open rrdgen.py in /opt/owtg/bin and configure the options you want (do so at your own risk; most of these options are largely untested)
 * 8) Execute rrdgen.py: /opt/owtg/rrdgen.py

Slave
Slave machines make sensors connected to them available to the master. They do not host the web interface or update the database; and therefore configuring them is much easier.


 * 1) Follow the instructions in the section . You *may* be able to just copy the /opt/owfs directory from the master to the same place on the slave, but I have not tested this.
 * 2) Open /etc/rc.local with a text editor and add this text somewhere before "exit 0": sudo /opt/owfs/bin/owserver --usb=scan --port=localhost:4304
 * 3) Run the above command or restart the machine
 * 4) On the master, add the IP address of this slave to /opt/owtg/owfs.conf; the format for doing so should be apparent upon viewing this file.