Raspberry Pi monitor: Difference between revisions

From WickyWiki
Line 140: Line 140:
</blockquote>
</blockquote>


== Link from main page to corresponding graph ==
== Link from the main page directly to the corresponding graph ==


Modify function Start() of "rpimonitor.statistics.js" to read a parameter 'graph':
Modify the function Start() in "rpimonitor.statistics.js" to read a parameter 'graph':


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
Line 174: Line 174:
</blockquote>
</blockquote>


Then modified "uptime.conf" to include a link to the graph. Same for for "cpu.conf" (graph=1), "temperature.conf" (graph=2), etc:
Then modify "uptime.conf" (graph=0) to include a link to the graph. Same for for "cpu.conf" (graph=1), "temperature.conf" (graph=2), etc:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>

Revision as of 21:20, 24 January 2018


Links

With Rpi-monitor you can monitor various aspects of your Raspberry Pi. The package has its own simple webserver. It works well for smaller screens (mobile phone) and history can be visualized with some graphs. If it still isn't to your liking it allows for some serious tinkering.

Local webservice, access within the local network with:

Install

sudo wget http://goo.gl/vewCLL -O /etc/apt/sources.list.d/rpimonitor.list
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F 
sudo apt-get update
sudo apt-get install rpimonitor

Remove

Repository:

sudo rm /etc/apt/sources.list.d/rpimonitor.list
sudo apt-key del 2C0D3C0F

Monitor package:

sudo apt-get purge rpimonitor
rm -fr /etc/rpimonitor
rm -fr /usr/share/rpimonitor

Configure

cd /etc/rpimonitor/template
ls -l
sudo nano /etc/rpimonitor/template/version.conf
sudo nano /etc/rpimonitor/template/uptime.conf
sudo nano /etc/rpimonitor/template/cpu.conf
sudo nano /etc/rpimonitor/template/temperature.conf
sudo nano /etc/rpimonitor/template/memory.conf
sudo nano /etc/rpimonitor/template/swap.conf
sudo nano /etc/rpimonitor/template/sdcard.conf
sudo nano /etc/rpimonitor/template/network.conf

Documentation

man rpimonitord
man rpimonitord.conf
rpimonitord -i

Modify interval

Default is 10 seconds, changed it to 60 seconds.

sudo nano /etc/rpimonitor/daemon.conf
daemon.delay=60
sudo systemctl restart rpimonitor

Network monitoring

Uncomment all lines that are commented and comment the lines that contain the configuration message.

sudo nano /etc/rpimonitor/template/network.conf

Tweaking

Reduce main page width

Search for the file we know to contain style we want to change:

find / -name "rpimonitor.css" 2>/dev/null
  1. changed width: 518px; into width: 300px;:
  2. changed nowrap into normal:
sudo nano -l +63 /usr/share/rpimonitor/web/css/rpimonitor.css
.Text {
  float: left;
  font-family: Tahoma, Helvetica;
  font-size: 13px;
  line-height: 13px;
  padding-left: 30px;
  padding-right: 30px;
  padding-top: 15px;
  width: 300px; // 518px
  white-space: normal ; // nowrap;
}

Reduce graph width

Changed graph_width:"750px" into graph_width:"400px":

sudo nano -l +174 /usr/share/rpimonitor/web/js/rpimonitor.statistics.js
...
rrdflot_defaults={ graph_width:"400px",graph_height:"285px", scale_width:"350px", scale_height:"90px", use_rra:true, rra:active_rra };
...

Link from the main page directly to the corresponding graph

Modify the function Start() in "rpimonitor.statistics.js" to read a parameter 'graph':

sudo nano -l +26 /usr/share/rpimonitor/web/js/rpimonitor.statistics.js

// ...

function Start() {
  static = getData('static')
  graphconf = getData('statistics')

  //modified: read activestat from url graph parameter
  activestat = GetURLParameter('graph');
  if (activestat == null){
    activestat = localStorage.getItem('activestat') || 0;
  }

  // ... unchanged ...

  activePage = GetURLParameter('activePage');

  // ...
}

// ...

Then modify "uptime.conf" (graph=0) to include a link to the graph. Same for for "cpu.conf" (graph=1), "temperature.conf" (graph=2), etc:

sudo nano /etc/rpimonitor/template/uptime.conf
web.status.1.content.1.name=<a target=_blank href=statistics.html?graph=0>Uptime</a>