{"id":268,"date":"2014-12-08T13:13:24","date_gmt":"2014-12-08T13:13:24","guid":{"rendered":"http:\/\/www.flat-planet.net\/?p=268"},"modified":"2014-12-08T14:07:27","modified_gmt":"2014-12-08T14:07:27","slug":"using-rpi-monitor-with-your-own-webserver-nginx","status":"publish","type":"post","link":"https:\/\/flat-planet.net\/?p=268","title":{"rendered":"Using RPi-Monitor with your own webserver (Nginx)"},"content":{"rendered":"<p>As I recently <a title=\"Migrating WordPress Tiny EC2 Instance to Raspberry Pi\" href=\"http:\/\/www.flat-planet.net\/?p=260\">moved this site<\/a> to a RPI for hosting purposes, I though it would be a good idea to have a nice web page to monitor the current status of the box. Some googling later and I found the excellent <a title=\"RPi Monitor\" href=\"http:\/\/rpi-experiences.blogspot.fr\/p\/rpi-monitor.html\">RPi-Monitor<\/a>.<\/p>\n<p>By default it has it&#8217;s own webserver, and it is not recommended to use anything other then that, but running a second webserver seemed a little bit untidy to my thinking so I set it to run on Nginx instead.<\/p>\n<p>The actual changes were quite simple, with one or two gotcha&#8217;s.<\/p>\n<p>RPi-Monitor stores the webpage in <code>\/usr\/share\/rpimonitor\/web<\/code> by default. Rather then play with that I just created a symbolic link between the root of the webserver and that point:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nln -s \/usr\/share\/rpimonitor\/web \/var\/www\/rpimonitor\r\n<\/pre>\n<p>and that is sorted.<\/p>\n<p>Next up is the configuration change to the rpimonitor daemon &#8211; config file located in \/etc\/rpimonitor\/daemon.conf. We need to set it into no-server mode and also change the user, as I&#8217;ve <a title=\"Raspberry Pi as a server\" href=\"http:\/\/www.flat-planet.net\/?p=253\">disabled the default &#8216;pi&#8217; account <\/a>on this box.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# daemon.noserver=1\r\n# Define that rpimonitor shouldn't start web server (default:0)\r\n# Note: A symbolic link from \/var\/lib\/rpimonitor\/stat to\r\n# \/usr\/share\/rpimonitor\/stat may be required\r\ndaemon.noserver=1\r\n\r\n# Define user used to run the server process (default:pi)\r\n# Note: If user is not existing, process will run with uid=1000\r\ndaemon.user=rpi-monitor\r\n#\r\n# daemon.group=pi\r\n# Define group used to run the server process (default:pi)\r\n# Note: If group is not existing, process will run with gid=1000\r\ndaemon.group=rpi-monitor\r\n#\r\n<\/pre>\n<p>Restart the service, and you should be able to access it from http:\/\/my-website.com\/rpi-monitor<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo service rpimonitor restart\r\n<\/pre>\n<p><a href=\"http:\/\/www.flat-planet.net\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-08-at-14.00.31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-270\" src=\"http:\/\/www.flat-planet.net\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-08-at-14.00.31.png\" alt=\"RPI-Monitor Status\" width=\"407\" height=\"398\" \/><\/a>However there is a slight issue in that the datastore is inaccessible to the webserver, so statistics are unavailable with error &#8220;File stat\/uptime.rrd is not a valid RRD archive&#8221;. To resolve this we need to go back to the <code>daemon.conf<\/code> file and move the datastore to somewhere under the root directory of the website<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# daemon.datastore=\/var\/lib\/rpimonitor\r\n# Define the data storage directory (Default:\/var\/lib\/rpimonitor)\r\ndaemon.datastore=\/var\/www\/rpimonitor\r\n<\/pre>\n<p>Restart the service again and all is worky.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ sudo service rpimonitor restart\r\n<\/pre>\n<p><a href=\"http:\/\/www.flat-planet.net\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-08-at-14.01.02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-271\" src=\"http:\/\/www.flat-planet.net\/wp-content\/uploads\/2014\/12\/Screen-Shot-2014-12-08-at-14.01.02.png\" alt=\"RPI-Monitor Statistics\" width=\"915\" height=\"426\" \/><\/a>Note: you could also just move the webroot in the same way, rather then using the symbolic link.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I recently moved this site to a RPI for hosting purposes, I though it would be a good idea to have a nice web page to monitor the current status of the box. Some googling later and I found the excellent RPi-Monitor. By default it has it&#8217;s own webserver, and it is not recommended [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[83,38,63],"tags":[42,33,64,124,123,53,125],"series":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-internet","category-linux","category-raspberry-pi","tag-linux-2","tag-projects-2","tag-raspberry-pi-2","tag-rpimonitor","tag-rrd","tag-services","tag-webserver"],"_links":{"self":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":3,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":273,"href":"https:\/\/flat-planet.net\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions\/273"}],"wp:attachment":[{"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/flat-planet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}