diff options
author | Stuart Shelton <stuart@shelton.me> | 2013-08-01 00:12:47 +0100 |
---|---|---|
committer | Stuart Shelton <stuart@shelton.me> | 2013-08-01 00:12:47 +0100 |
commit | a0dcb72e7b4c9dc8ee8fa2007a1087977e4479a9 (patch) | |
tree | a30489a248ba4541b79c464ad4978386515ee460 /www-apps | |
parent | net-analyzer/nessus-bin-5.2.1 (diff) | |
download | srcshelton-a0dcb72e7b4c9dc8ee8fa2007a1087977e4479a9.tar.gz srcshelton-a0dcb72e7b4c9dc8ee8fa2007a1087977e4479a9.tar.bz2 srcshelton-a0dcb72e7b4c9dc8ee8fa2007a1087977e4479a9.zip |
www-apps/rpi-monitor-2.2
Diffstat (limited to 'www-apps')
-rw-r--r-- | www-apps/rpi-monitor/Manifest | 6 | ||||
-rw-r--r-- | www-apps/rpi-monitor/files/default.conf.patch | 211 | ||||
-rw-r--r-- | www-apps/rpi-monitor/files/rpimonitor.confd | 2 | ||||
-rw-r--r-- | www-apps/rpi-monitor/files/rpimonitor.initd | 24 | ||||
-rw-r--r-- | www-apps/rpi-monitor/rpi-monitor-2.2.ebuild | 115 |
5 files changed, 358 insertions, 0 deletions
diff --git a/www-apps/rpi-monitor/Manifest b/www-apps/rpi-monitor/Manifest new file mode 100644 index 00000000..4cdf1515 --- /dev/null +++ b/www-apps/rpi-monitor/Manifest @@ -0,0 +1,6 @@ +AUX default.conf.patch 9161 SHA256 ea929ee56b97627c8eb09dfbae50c59b6332ca0f855614fd72ff90bc1ddf7412 SHA512 531c2d6e0c97e622d30b42eddc844d87b2755740b7ead90a9b641fdccaf4762eb974a5338b1ea7abc8bc0193b5e4fe059e433c0aa8978a7d31f8ab27e13687e8 WHIRLPOOL edce7f466a40239e7189e290753e6bd1d9261c5456bf6dd15a4c289ff37f0974d0bb23eb9b6c50aefd3541bf8f6d4107b46577559326f885be59bae42bad7352 +AUX rpimonitor.confd 112 SHA256 b683366153e78b3f2e3040036315ed4bb6e97f6963dde609b3099551dc84795a SHA512 46c2f4340023f8b7957f604f1baa661eb4a97f54a2f6a03abf25525d9c7db78135dc556866cea416080398e6af84c7ac6c935e4230154f5164cb1535607e3395 WHIRLPOOL 869fc2d100e725d3f171d509b6bd997b9f9ada00600c237b30f8e6951cd7dc4fe4be2d72e343dba9caaab1b61c741cd3422cf137dd94bd7571be0c837d447ece +AUX rpimonitor.initd 589 SHA256 4e722b442d49de1309797d015217984634368185e08e4805f35788ce1060c076 SHA512 59fea3c84080c0d6bf4354618e2156ea1d422f08a5e3cf329cb1187fa4105ed9929ddb2c6e05e12439217dc85bae520416e9e66938555f09033392126d66f1b1 WHIRLPOOL f229c339f194f535923063509a035147b29b3c457ebd8fb0570a4f21afe639e3df00d84ff27c361b584c47d4a7974b5a90d633b9c28bbe9d5ad16e38c3be60dc +DIST rpi-monitor-2.2.zip 292550 SHA256 e37f4be434c47a48c22e4db649e7960c9ab2e6c8851187a2628b71225121f25e SHA512 731a229097e7472e357af2b52ebebfeae65f73f91a44b3bb7c09c7ce72ddb55e2cdb1b03a9147094c359330a0e12e1b5ad9c754f2a3ce70e5a7287980643f4cc WHIRLPOOL 153e6e9a33c71255a787fceeb74d6f0c1ca15079682296f4971882781c62bc241a323ce9f1d91fa49cc5d2b4f541ae94b2da844bdc27ba2809cba1ffa02c1e5d +DIST rpi-monitor-deb-2.2.zip 2127268 SHA256 04bd659402cda83df2d34fb38efce4db710f1c63ec41e1905cca9d4d3b41f516 SHA512 ed51fec16b0c23fe73c9b733d4cf8f655089d13c408803970a834d1f5c3a71df026814dd2b6d2ea0759e533e154185beca70eb7048468566cef55fb4ac7b6c2f WHIRLPOOL 006bb1f20f1d6e54e73e1f7f8b6eeb85e75219190450dcd16d2104f555f75dc5751034b1f62af7923137da260f730390c2d668860825cd61d4d6548a23f0e1b3 +EBUILD rpi-monitor-2.2.ebuild 3069 SHA256 b5dea21a768e9fcf94a33a853ed36db6b5dad58af631fe3da547621dbfc101ee SHA512 247d132bcd7af9e0fd1b9e6e995a001103aba44b4ef4ccdf165614f06447c6a929ef4f0016a251cc2f2448dce62802dd6c13962829e18684c812ba5e6491eee0 WHIRLPOOL 34d4a75693b93d0d8f121fc0575494a770dc45c250f16e4cfcd1e330682704dbfc4603e2445ea3f0b6a8a71150ea6117b53e51703ddc6807f6abcd82353e6b69 diff --git a/www-apps/rpi-monitor/files/default.conf.patch b/www-apps/rpi-monitor/files/default.conf.patch new file mode 100644 index 00000000..f9bef279 --- /dev/null +++ b/www-apps/rpi-monitor/files/default.conf.patch @@ -0,0 +1,211 @@ +--- rpimonitor/default.conf.dist 2013-07-19 11:51:54.000000000 +0100 ++++ rpimonitor/default.conf 2013-07-31 23:30:31.475030708 +0100 +@@ -1,64 +1,73 @@ + ######################################################################## + # KPI extraction configuration + # +-# This part of the configuration file is defining which data to +-# extract how to extract then and when. ++# This configuration file defines how and when data should be ++# extracted. + # +-# Static KPI are extracted once at rpimonitord startup. Each statistic +-# is identified into the conf file by a line stating with the keyword +-# static and an identifier <static data id> ++# Static items are extracted once on rpimonitord startup. Each ++# statistic is specified below by a line starting with the keyword ++# 'static' and followed by a numerical unique identifier. + # +-# Each static KPI is defined by an id and with 4 parameters ++# Each static item has four further parameters: + # + # static.<static data id>.name=<data name> +-# <data name> is a string representing the KPI or the list of KPI +-# separated by comma. Each name has to be unique. +-# Only alpha numerical charter and underscore are accepted. +-# +-# static.<static data id>.source=<data source> +-# <data source> is a file or an executable file within the path. +-# If the file exists, rpimonitord will read its content. If the file +-# is not existing, rpimonirotd will try to execute it and will parse +-# the output. ++# <data name> is the string represention the item (or comma-separated ++# items) being defined. Each name must be unique. ++# Only alpha-numeric charaters and underscores are valid in item ++# names. ++# ++# static.<static data id>.source=<data source>[,<data source,...] ++# <data source> may be a file or an executable from which content ++# can be read. If a full path is not provided, rpimonitord will ++# first attempt to read from a file with the specified name and, ++# failing this, will attempt to execute a binary of the same name ++# within any directory specified in the contents of the PATH ++# vaiable. + # Warning: specifying an executable by its absolute name will tell + # rpimonitord to read the content of the executable.1.graph. + # +-# static.<static data id>.regexp=<data regexp> +-# <data regexp> is the regular expression extracting information from +-# data source. Regexp groups () has to be used to extract the data +-# In case of KPI list, each group will be affected to a KPI name. ++# static.<static data id>.regexp=<data regex> ++# <data regex> is an optional regular expression which may be ++# applied to extracting information from the designated source ++# value, above. Data matching a Perl-Compatible/Extended Regular ++# Expression group (e.g. matches within round-brackets) will be ++# selected to represent this <data source>. ++# Where a list of <data source>s is being defined, each sequential ++# group match will be assigned to each <data source> in turn. + # + # static.<static data id>.postprocess=<data postprocess> +-# <data postprocess> is an expression defining the postprocessing to +-# be applied on result. KPI are idendified by $1. In case of list, +-# other KPI are identified by $2, $3 .graph.. +-# This parameter will be evaluate by the command eval of perl. +-# +-# Dynamic KPI are extracted periodically (defined by daemon.delay) +-# Each statistic is identified into the conf file by a line stating +-# with the keyword dynamic and an identifier <dynamic data id> ++# <data postprocess> is an optional expression denoting any ++# postprocessing which should be applied to the raw <data source> or ++# the <data regex> output if defined. ++# The first <data source> is referenced as '$1', with further <data ++# source>s in a list being referred to as '$2', '$3', etc. ++# The expression will be evaluated via the Perl 'eval' command. ++# ++# Dynamic items are periodically evaluated with period specified by ++# 'daemon.delay' from /etc/rpimonitord.conf. Each statistic is ++# defined with the keyword 'dynamic' followed by a <dynamic data id> ++# identifier and five further parameters: + # +-# Each dynamic KPI is defined by an id and with 5 parameters +-# +-# dynamic.<dynamic data id>.name=<data name> ++# dynamic.<dynamic data id>.name=<data name>[,<data name>,...] + # dynamic.<dynamic data id>.source=<data source> +-# dynamic.<dynamic data id>.regexp=<data regexp> ++# dynamic.<dynamic data id>.regexp=<data regex> + # dynamic.<dynamic data id>.postprocess=<data postprocess> +-# <data name>, <data source>, <data regexp>, <data postprocess> +-# This 4 first parameters have the same signification as for static +-# parameters. +-# +-# dynamic.<dynamic data id>.rrd=<|GAUGE|COUNTER|DERIVE|ABSOLUTE|COMPUTE> +-# The 5th parameter is defining if the KPI has to be stored into a RRD +-# database and how <|GAUGE|COUNTER|DERIVE|ABSOLUTE|COMPUTE>. If the +-# parameter is defined as empty, no RRD database will be created. If +-# this parameter is defined, a RRD database will be created and data +-# will be stored at every extraction. +-# Ref http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html for RRD +-# parameter description. +-# Note: Static values are accessible for the post processing using the +-# variable $this->{'static'}->{'static_data_name'} and can be used. +-# You can refer to swap data extraction to see an example. ++# <data name>, <data source>, <data regex>, and <data postprocess> ++# have the same use as when used with static items. ++# ++# dynamic.<dynamic data id>.rrd=<GAUGE|COUNTER|DERIVE|ABSOLUTE|COMPUTE> ++# The fifth parameter determines whether the item's data should be ++# stored in an Round-Robin Database, and how it should be ++# represented. A blank entry will prevent RRD creation. ++# See http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html for ++# details of the RRD different RRD options. ++# ++# NB: Values associated with named static items are available for use ++# during post-processing with the notation: ++# ++# $this->{'static'}->{'static_data_name'} ++# ++# See the dynamic item named 'swap_used' for a real-world example. + # + ######################################################################## + static.1.name=distribution +@@ -78,7 +87,7 @@ + + static.4.name=processor + static.4.source=/proc/cpuinfo +-static.4.regexp=Processor\s+: (.*) ++static.4.regexp=model name\s+: (.*) + static.4.postprocess= + + static.5.name=scaling_governor +@@ -97,27 +106,27 @@ + static.7.postprocess=$1/1024 + + static.8.name=sdcard_root_total +-static.8.source=df -t ext4 +-static.8.regexp=root\s+(\d+) ++static.8.source=df / ++static.8.regexp=^[^\s]+\s+(\d+) + static.8.postprocess=$1/1024 + + static.9.name=sdcard_boot_total +-static.9.source=df -t vfat +-static.9.regexp=mmcblk0p1\s+(\d+) ++static.9.source=df /boot ++static.9.regexp=^[^\s]+\s+(\d+) + static.9.postprocess=$1/1024 + + ############################################################################## +-dynamic.1.name=upgrade +-dynamic.1.source=/usr/share/rpimonitor/updatestatus.txt +-dynamic.1.regexp=(\d+ upgraded, \d+ .*|.* .*) +-dynamic.1.postprocess= +-dynamic.1.rrd= +- +-dynamic.2.name=packages +-dynamic.2.source=/usr/share/rpimonitor/updatestatus.txt +-dynamic.2.regexp=^ (.*)\d+ upgraded, +-dynamic.2.postprocess= +-dynamic.2.rrd= ++#dynamic.1.name=upgrade ++#dynamic.1.source=/usr/share/rpimonitor/updatestatus.txt ++#dynamic.1.regexp=(\d+ upgraded, \d+ .*|.* .*) ++#dynamic.1.postprocess= ++#dynamic.1.rrd= ++# ++#dynamic.2.name=packages ++#dynamic.2.source=/usr/share/rpimonitor/updatestatus.txt ++#dynamic.2.regexp=^ (.*)\d+ upgraded, ++#dynamic.2.postprocess= ++#dynamic.2.rrd= + + dynamic.3.name=cpu_frequency + dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq +@@ -126,7 +135,7 @@ + dynamic.3.rrd= + + dynamic.4.name=cpu_voltage +-dynamic.4.source=vcgencmd measure_volts core ++dynamic.4.source=/opt/vc/bin/vcgencmd measure_volts core + dynamic.4.regexp=(\d+.\d+)V + dynamic.4.postprocess= + dynamic.4.rrd= +@@ -138,14 +147,14 @@ + dynamic.5.rrd=GAUGE + + dynamic.6.name=sdcard_root_used +-dynamic.6.source=df -t ext4 +-dynamic.6.regexp=root\s+\d+\s+(\d+) ++dynamic.6.source=df / ++dynamic.6.regexp=^[^\s]+\s+\d+\s+(\d+) + dynamic.6.postprocess=$1/1024 + dynamic.6.rrd=GAUGE + + dynamic.7.name=sdcard_boot_used +-dynamic.7.source=df -t vfat +-dynamic.7.regexp=mmcblk0p1\s+\d+\s+(\d+) ++dynamic.7.source=df /boot ++dynamic.7.regexp=^[^\s]+\s+\d+\s+(\d+) + dynamic.7.postprocess=$1/1024 + dynamic.7.rrd=GAUGE + +@@ -314,7 +323,7 @@ + web.status.1.content.1.line.2='Distribution: <b>'+ data.distribution + '</b>' + web.status.1.content.1.line.3='Kernel version: <b>' + data.kernel_version + '</b>' + web.status.1.content.1.line.4='Firmware: <b>' + data.firmware + '</b>' +-web.status.1.content.1.line.5='Package(s) to be: <b>' + data.upgrade + '</b>' + ShowInfo('packages','Package update',data.packages) ++#web.status.1.content.1.line.5='Package(s) to be: <b>' + data.upgrade + '</b>' + ShowInfo('packages','Package update',data.packages) + + web.status.1.content.2.name=Uptime + web.status.1.content.2.icon=uptime.png diff --git a/www-apps/rpi-monitor/files/rpimonitor.confd b/www-apps/rpi-monitor/files/rpimonitor.confd new file mode 100644 index 00000000..c3865420 --- /dev/null +++ b/www-apps/rpi-monitor/files/rpimonitor.confd @@ -0,0 +1,2 @@ +# Define configuration file to use +#CONFFILE="-c /etc/rpimonitord.conf -c /etc/rpimonitord.conf.d/default.conf" diff --git a/www-apps/rpi-monitor/files/rpimonitor.initd b/www-apps/rpi-monitor/files/rpimonitor.initd new file mode 100644 index 00000000..68d34c89 --- /dev/null +++ b/www-apps/rpi-monitor/files/rpimonitor.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Distributed under the terms of the GNU General Public License v2 + +PERL="$( type -pf perl )" +NAME=rpimonitord +PIDFILE=/var/run/$NAME.pid +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="-b ${PIDFILE}" + +depend() { + need net +} + +start() { + ebegin "Starting RPI Monitor" + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PERL -- $DAEMON $DAEMON_ARGS + eend $? "Unable to start Monitor" +} + +stop() { + ebegin "Stopping RPI Monitor" + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --interpreted --exec $PERL $DAEMON + eend $? "Unable to stop Monitor" +} diff --git a/www-apps/rpi-monitor/rpi-monitor-2.2.ebuild b/www-apps/rpi-monitor/rpi-monitor-2.2.ebuild new file mode 100644 index 00000000..07ca6b19 --- /dev/null +++ b/www-apps/rpi-monitor/rpi-monitor-2.2.ebuild @@ -0,0 +1,115 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="4" + +inherit eutils + +DESCRIPTION="RPi-Monitor always keep an eye on your Raspberry Pi" +HOMEPAGE="http://rpi-experiences.blogspot.fr" +SRC_URI="https://github.com/XavierBerger/RPi-Monitor/archive/v${PV}.zip -> ${P}.zip + https://github.com/XavierBerger/RPi-Monitor-deb/archive/v${PV}.zip -> ${PN}-deb-${PV}.zip" +RESTRICT="nomirror" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="-* arm" +IUSE="httpd tools" + +DEPEND="app-admin/webapp-config" +RDEPEND=" + httpd? ( + virtual/httpd-cgi + ) + !httpd? ( + dev-perl/HTTP-Daemon + ) + net-analyzer/rrdtool[perl] + || ( ( virtual/perl-JSON-PP dev-perl/JSON-Any ) dev-perl/JSON )" + +if use httpd; then + inherit webapp + + need_httpd_cgi +fi + +S="${WORKDIR}/RPi-Monitor-${PV}" + +src_prepare() { + epatch "${FILESDIR}"/default.conf.patch \ + || die "epatch failed" + + cp "${S}"/../RPi-Monitor-deb-"${PV}"/conf2man.pl . + cp "${S}"/../RPi-Monitor-deb-"${PV}"/help2man.pl . + chmod 755 conf2man.pl help2man.pl + + [[ -x ./help2man.pl && -x conf2man.pl ]] \ + || die "Portage temporary directory must not be mounted 'noexec'" + + cat rpimonitor/rpimonitord.conf rpimonitor/default.conf > rpimonitord.conf + + ./help2man.pl rpimonitor/rpimonitord "${PV}" > rpimonitord.1 + ./conf2man.pl rpimonitord.conf "${PV}" > rpimonitord.conf.5 +} + +src_install() { + use httpd && webapp_src_preinst + + doman rpimonitord.1 rpimonitord.conf.5 + + dodoc README.md + newdoc tools/reverseproxy nginx.conf.example + newdoc rpimonitor/custo.conf custom.conf + dodoc rpimonitor/default.conf + + dosbin rpimonitor/rpimonitord + if use tools; then + exeinto /usr/share/"${PN}"/tools + doexe tools/{addnginxuser.sh,make_ca.sh,make_cert.sh,netTraffic.sh,openssl.cnf} + fi + + newconfd "${FILESDIR}"/rpimonitor.confd rpimonitor + newinitd "${FILESDIR}"/rpimonitor.initd rpimonitor + dodir /etc/rpimonitord.conf.d + insinto /etc/rpimonitord.conf.d + doins rpimonitor/default.conf + + if use httpd; then + INSTROOT="${EROOT}/var/www/localhost/htdocs" + + insinto "${MY_HTDOCSDIR}" + doins -r rpimonitor/web/* + dodir "${MY_HTDOCSDIR}"/custom/net_traffic + dodir "${MY_HTDOCSDIR}"/stat + + webapp_serverowned "${MY_HTDOCSDIR}"/custom + webapp_serverowned "${MY_HTDOCSDIR}"/custom/net_traffic + webapp_serverowned "${MY_HTDOCSDIR}"/stat + else + INSTROOT="${EROOT}/usr/share" + + insinto /usr/share/rpi-monitor + doins -r rpimonitor/web/* + diropts -m 0775 -o nobody -g nogroup + + dodir /var/lib/rpi-monitor/custom/net_traffic + dodir /var/lib/rpi-monitor/stat + + dosym ../../../var/lib/rpi-monitor/stat /usr/share/rpi-monitor/stat + dosym ../../../var/lib/rpi-monitor/custom /usr/share/rpi-monitor/custom + fi + + sed -i \ + -e "s|^#daemon.webroot=./web$|daemon.webroot=${INSTROOT/\/\///}/rpi-monitor|" \ + -e "s|^#daemon.user=pi$|daemon.user=nobody|" \ + -e "s|^#daemon.group=pi$|daemon.group=nogroup|" \ + rpimonitor/rpimonitord.conf + insinto /etc/ + doins rpimonitor/rpimonitord.conf + + use httpd && webapp_src_install +} + +pkg_postinst() { + einfo "Edit the file /etc/rpimonitord.conf to configure RPI Monitor" +} |