Saturday, March 22, 2014

RPi-Monitor Interactive Configuration Helper

Version 2.6 introduced a new feature named RPi-Monitor Interactive Configuration Helper. This article is detailling how to use it to monitor a ntfs volume.

First execute the following command:

rpimonitord -i


Press Enter



Enter : df -t ntfs


RPi-Monitor will tell you how it will process the source.
In our example, it will execute the command df.
If it is correct, press Enter, if not, enter no ( or No or n or ) to go back to previous screen.


RPi-Monitor show you the ouput of the command as defined as source. If the output is the one expected press Enter, if not, RPi-Monitor will ask you to define the source again.


By default the regulare expression is (.*). This will return all the data given by the source.
In the following screen you will see how we will find the regular expression extracting the available space of our ntfs drive step by step.

Step one, hit Enter to see what is given by the source by default.


The output is not the one expected hit Enter to define a new Regular expression.
The data is located after sda1. Lets enter the following regular expression: sda1(.*) to get what is after sda1.


The output is not the one expected yet hit Enter to define a new Regular expression.
The data is located after sda1 after some spaces \s+, some numbers \d+, some spaces \s+, some numbers \d+, some spaces \s+ and is composed of numbers (\d+).
Enter then the following regulare expression: sda1\s+\d+\s+\d+\s+(\d+)


The result is now the one expected , enter Yes ( or yes or Y or y )


We want the value in MB while is it given in kB. We then need to devide it by 1024.
The formula is then: $1/1024


This is the expected value, enter yes


The value extracted is variable so dynamic so enter No.


RPi-Monitor gives you the template of configuration. You now have to copy it into an existing configuration file or  add anew file into /etc/rpimonitord.conf.d/ and update the text inside <>.

dynamic.20.name=storage2_available
dynamic.20.source=df -t ntfs
dynamic.20.regexp=sda1\s+\d+\s+\d+\s+(\d+)
dynamic.20.postprocess=$1/1024
dynamic.20.rrd=GAUGE

Once the configuration will be apply, restart RPi-Monitor with the command:

/etc/init.d/rpimonitor restart

I hope this post is detailled enough to help you to configure RPi-Monitor to define the correct sources and regular expression.

12 comments :

  1. rpimonitor: command not found
    The rpimonitord is working... :)

    ReplyDelete
    Replies
    1. Fixed...
      I use to use completion with TAB... This is maybe the source of my mistake ;-)

      Delete
  2. Thx a lot - now i've all my data for USB HDD

    I also include: WebIF Status and Statistic ;-)

    ReplyDelete
  3. Hi!
    Thanks a lot for this very nice tool. However I have a problem: when I try the command "rpimonitord -i" I received this answer: "Web server not started because of error: Address already in use rpimonitord stopped because respawning too fast.". Could you please help me?

    ReplyDelete
    Replies
    1. Hello, you have to stop rpimonitord (/etc/init.d/rpimonitord stop) before executing the command. I'll add an issue un gighub and fix it for the next release.

      Delete
    2. Are you sure to use the latest version of RPi-Monitor?.
      This issue is not occuring in version 2.6 and should happen in previous version since "-i" parameter is unknown.

      Delete
  4. This helper is excellent. Much appreciated as I already heard some 'horror'-stories about regexp :)
    I was able to pull the voltage-readings from the pi in this manner ..
    Thanks :)

    ReplyDelete
  5. Can we increase the frequency with which the RPI monitor collects the data. I required better resolutions of the reading provided by the RPI monitor.

    ReplyDelete
    Replies
    1. Answer is now in the FAQ. The modification is not easy, I'll think to make it a little bit easier in future version (and avoid code modification...).

      Delete
    2. The next release of RPi-Monitor will allow the customisation of RRD and will then answer to your needs.
      Beta version is already available for test. You can install it and try it right now. Feedbacks are welcome.

      Delete
  6. Hi,
    I am working on a custom configuration to get the input & output values of disk writing. So far I can only get the total MB read/written from /proc/diskstats:

    dynamic.24.name=sda_read1
    dynamic.24.source=/proc/diskstats
    dynamic.24.regexp=sda\s+\d+\s+\d+\s+(\d+)
    dynamic.24.postprocess=( ( ( $1 * 512 ) / 1024 ) / 1024 ) * -1
    dynamic.24.rrd=DERIVE

    dynamic.25.name=sda_write1
    dynamic.25.source=/proc/diskstats
    dynamic.25.regexp=sda\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)
    dynamic.25.postprocess=( ( $1 * 512 ) / 1024 ) / 1024
    dynamic.25.rrd=DERIVE

    web.statistics.1.content.12.name=SDA Input Output
    web.statistics.1.content.12.graph.1=sda_read1
    web.statistics.1.content.12.graph.2=sda_write1
    web.statistics.1.content.12.ds_graph_options.sda_read1.label=Read (MB)
    web.statistics.1.content.12.ds_graph_options.sda_read1.color="#7777FF"
    web.statistics.1.content.12.ds_graph_options.sda_write1.label=Write (MB)
    web.statistics.1.content.12.ds_graph_options.sda_write1.color="#77FF77"

    Is there a better configuration that just gauges the current MB/s reading?

    ReplyDelete
    Replies
    1. have a look at this File:
      /etc/rpimonitor/template/network.conf
      There you can see how to calculate MB/sec
      Maybe you find that usefull.

      Good Luck...

      Delete