Edit: RPi-Monitor version 2.7 introduce a change in configuration name and location:- /etc/rpimonitor d.conf becomes /etc/rpimonitor/daemon.conf
- /etc/rpimonitord.conf.d becomes /etc/rpimonitor/data.conf
- /etc/rpimonitord.conf.d/*.conf becomes /etc/rpimonitor/*.conf
In this article we will see how to do the things described in
RPi-Monitor: Advance usage and customization and maybe, a little bit more...
We will then answer the same questions : How should I do if I want to...
- Customize RPi-Monitor v2.x to fit a particular needs?
- Use it with my own Web Server?
- Add "friends" linking RPi-Monitor v2.x running on different platform together?
- Use it into another Linux distribution than Raspbian?
- Add other graphs from additional sources (other mount point or external temperature probe)?
Note: A prerequisite is to install the latest version of RPi-Monitor v2.xCustomize RPi-Monitor v2.x to fit a particular needs
If you want to customize RPi-Monitor in a way not described bellow you just have to know 2 things:
- The man pages rpimonitord and rpimonitord.conf explains how to use and configure RPi-Monitor.
- The configuration file is documented to let you customize to your need.
You will find bellow some example of customization showing you the capababilities of RPi-Monitor v2.x
Use it with my own Web Server
In this example I will use
nginx server. You could use the same tactic with your preferred web server.
Let's first update the configuration file to disable the embedded web server. Edit the file
/etc/rpimonitord.conf and set
daemon.noserver=1.
Then restart RPi-Monitor with the command:
sudo service rpimonitor restartThe embedded server is no more running so, we will need to configure another server to access the data.
For
nginx we will create the file
/etc/nginx/sites-enabled/rpimonitor with the following content:
and restart the server with the command:
sudo service nginx restart
Now you can reach RPi-Monitor with your favorite browser on your favorite web server.
To go further, you can read the article
RPi-Monitor: Build a multi-sites SSL certificate to improve user experience.
Add "friends" linking RPi-Monitor running on different platform togetherFriends is a notion that comes in version 1.2. A friend is simply another computer running
RPi-Monitor. Configuring friends will add a drop down list on the right of the top menu with a links to
RPi-Monitor sitting on the other computer.
|
Friends menu is visible on the top right |
In
/etc/rpimonitord.conf.d/default.conf, each friend is identified by its
and is described by the 2 following parameters:
Here is an example of configuration for 3 friends:
Use it into another Linux distribution than Raspbian
RPi-Monitor has been designed to run into a Raspberry Pi but as it is using only standard Linux resources, it is not hardware dependent. A simple configuration update can make it run on
Ubuntu,
CentOS or any other distribution.
Ubuntu is a
Debian based distribution as Raspbian. The installation can then be done using the deb package available for each releases. Download and install the package as described in
this previous post.With
CentOS and withe any
non Debian based distribution it will required to perform a manual installation.
First install the perl dependencies:
HTTP::Daemon (
perl-libwww-perl),
RRD (
rrdtool-perl) and
JSON(perl-JSON)Connect to
github and select the latest stable branch on the top left dropdown list.
Then download the code as zip file from the link "Download zip" visible at the bottom of the right menu.
Unpack it.
unzip Version-2.x.zipFinally install rpimonitor manually:
su - mv Version-2.x/rpimonitor /usr/localYou can now start
RPi-Monitor with the following commands:
cd /usr/local/rpimonitor ./rpimonitird -c rpimonitor.conf -c default.confNote: I will not describe here how to configure the auto startup since each distribution has its own way to do so. An upstart script is available into RPi-Monitor github tools directory, it may help you in such an action.Once the installation is done you can start
RPi-Monitor and connect to it with your favorite browser.
You may notice that some values are
undefined or displayed as
NaN (Not a Number). To fix these issues, you will have to update the configuration file (
rpimonitord.conf or
default.conf in
/etc/ + /etc/rpimonitord.conf.d or
/usr/local/rpimonitor/ depending on your installation).
|
CentOS 6.3 before configuration file customisation |
Add other graphs from additional sources: other mount pointFor this section we will take the example of an additional disk on sda as described previous article
RPi-Monitor: Advance usage and customization.
The disk have a disk with two partition
/dev/sda1 and
/dev/sda3.
The command and regular expression will be the following:
- sda1 disk size command : df -t ext2, regular expression: sda1\s+(\d+)
- sda1 used space command : df -t ext2, regular expression: sda1\s+\d+\s+(\d+)
- sda3 disk size command : df -t ext4, regular expression: sda3\s+(\d+)
- sda3 used space command : df -t ext4, regular expression: sda3\s+\d+\s+(\d+)
First we need to configure the extraction of partitions sizes which are extracted once at
RPi-Monitor startup. We will create a file
/etc/rpimonitord.conf.d/custo.conf with the data configured as static data like this:
The id of the KPIs start at 10 since in my configuration files the previous KPI was 9. This comment is the same for next ids.
The post processing is configured to transform kB into MB by dividing the extracted result by 1024.
For dynamic values extracted every 10 seconds, the configuration will be:
Now we will add a status line for this disk whit the following icon:
|
Disk icon has been found here |
This icons has to be installed into the
img directory of
RPi-Monitor which is by default
/usr/share/rpimonitor/web/img/.
The configuration to add a new status strip will then be the following:
The configuration may need some explanation:
We do configure 4 lines. Each line is describing a javascript line using some predefined functions:
KMG,
Precent and
ProgressBar. This function are called by the browser while rendering the page. Some variable coming from the extracted data are also used. These variables are starting by the keyword '
data.'. For deeper detail about this configuration execute the command
man rpimonitord.conf
To see our modification we need to restart
RPi-Monitor and refresh the statistics page into our browser. sudo service rpimonitor restartThe result of the configuration is at the bottom of the following screenshot:
The status page is working, let's now add a graphic of the disk usage. This is done with the following configuration:
The configuration may also need some explanation
We do configure 2 graphs each having 2 curves. The first curve represent the total and is using static data extracted previously. This curve will be represented as a light red line.
The second curve is representing the usage of disk and is represented as a light blue line filled. The parameters defining the curve are define by the keyword ds_graph_options. Details of this parameter can be found in
javascriptrrd help page. Restart rpimonitor to activate the new graph.
After waiting a little time to let the system extract data you will see this kind of graph.
Add other graphs from additional sources: external temperature probe
Let's build a little electronic device to measure the room temperature and add this in the temperature graph.
Do do that, you will need:
- 1 x DS18B20
- 1 x 4.7k resistor
Plug them as described in the following schema extracted from
Adafruit Lesson 11:
Lets first load the kernel module required to get the information from this probe:
sudo modprobe gpio sudo modprobe w1-gpio sudo modprobe w1-therm
First we have to identify the id of our probe:
ls /sys/bus/w1/devices/ 28-000004fe1847 w1_bus_master1
the id is:
28-000004fe1847. Let's now check if we can get the temperature:
cat /sys/bus/w1/devices/28-000004fe1847/w1_slave 5a 01 4b 46 7f ff 06 10 a3 : crc=a3 YES 5a 01 4b 46 7f ff 06 10 a3 t=21625
It looks to work. So now we need to extract the the numbers ending the second line (21625). The regular expression will then be t=(\d+)$. I'll not do a course about what a regexp is there are many site on the internet explaining it.
The following configuration have to be added at the end of
/etc/rpi-monitord.conf.d/custo.conf. It will extract the temperature measured by the external probe:
We will then add the livingroom temperature as
Ambient temperature into the existing
Temperature status strip by adding the following line at the end of the file
custo.conf:
After restarting
RPi-Monitor, you will see the
Ambient temperature into the status page as in the screenshot bellow:
We will then add the
Ambiant temperature into the existing
Temperature graph by adding the following line to
custo.conf:
After restarting
RPi-Monitor, you will see the
Ambient temperature as an additional curve into the Temperature graph of the statistics page as in the screenshot bellow: