Arduinosysmonitor

From Brisa

Jump to: navigation, search

Arduinosysmonitor is a system to keep your computer status checked through external gauges driven by an arduino. It is essentially a daemon on your Linux box that writes over the usb serial port created by the arduino the status of variables you wish to keep under control. The arduino set it's pwm (Or analogical) output according to the value and a gauge attached to the output will move according.

Example of information useful to keep monitored are:

  • Free space on a partition
  • Throughput (read or write) of an Hard disk
  • CPU utilization
  • memory consumption
  • whatever you wish....

Settings for monitoring are done through a simple xml configuration file.

Please, for comments, suggestions or problems, [contact me]

Contents

License

The Arduinosysmonitor is release under the [GPLv3 license].

Download

You can download either the source code or the debian/ubuntu package:

Installation

On PC

Debian/Ubuntu

since there is a debian package you can install it just downloading the last debian/ubuntu package version and installing it with dpkg: For debian as root:

dpkg -i arduinosysmonitor-0.1.deb

For ubuntu:

sudo dpkg -i arduinosysmonitor-0.1.deb

Other Linux distributions

You don't have to compile anything, the software running on the pc is written entirely in python, so after you have checked you have python installed (Which mostly of you will already have) download the source code and extract it:

tar zxvf arduinosysmonitor.tar.gz

now enter the ./arduinosysmonitor/arduinosysmonitorpc directory

cd ./arduinosysmonitor/arduinosysmonitorpc

optional: move the arduinosysmonitor.xml to /etc folder so the program will search for it there (If not found in its same directory)

mv arduinosysmonitor.xml /etc

On Arduino Diecimila

Software

You just need to upload the software that you find in the source package under the arduinosysmonitorplc directory with the arduino ide to the arduino board as every normal arduino project.

Hardware

According to your xml configuration file you have to attach to the arduino pwm outputs the gauges you wish to handle. Remember how a pwm output works first. However, if you wish to try it and you don't have a gauge in your hand, you can still use a simple led with a 1K resistor.

Important !!! Pin 2 in set as input pin !

Connect it like this schema:

         1K res.  - led +
GND |---/\/\/\/\----|<|---| PWM

The led will vary it's intensity according to the variable under monitoring

XML Configuration

The xml configuration is very simple, let's see an example:

<conf>
    <port>/dev/ttyUSB0</port>
    <service>
        <description>seconds</description>
        <command><![CDATA[date +%S]]></command>
        <interval>1</interval>
        <output>5</output>
        <min>0</min>
        <max>59</max>
    </service>
</conf>

The port tag indicates which is the usb port where the arduino is attached (Usually when you attach the arduino board the port is created on the fly).

Now, for every monitor you wish to add, you create a new section tag, the example where:

  • description is a generic optional description you gave to it
  • command is the command used by the program to extract the value you need to monitor, in this example we monitor the seconds of the current time
  • interval is the time in seconds for checking for the monitor
  • output is the arduino output that will be used to display this monitor
  • min is the minimum value the monitor can assume
  • max is the maximum value the monitor can assume (It sets the full scale value).
    • Leaving it blank will make the software self recognize it:every time a new value is grater then every value received, it becomes the new max value.
    • you can even use a custom command to get the max value (i.e. echo "123" )

note: The command you give can either exit or remain active always, it does not matter, the only important thing is that it must print on stdout the value of the monitor (followed by a carriage return \n). Let's see some example:

  • date +%S is a valid command, it outputs a value (i.e. 30) followed by a \n and exits
  • df 2>/dev/null | awk -F" " '/sda3/{print $4}{fflush()}' - is a valid command, it outputs a value (i.e. 123232) followed by a \n and exits, this check for used space on the partition sda3
  • iostat /dev/sda 2 | awk -F" " '/sda/{print $5}{fflush()}' - is a valid command, it outputs a value (i.e. 3213) followed by a \n and never exits, it keeps printing the value every 2 seconds. This example show the disk read throughput.

Categoria:Progetti