diff --git a/VERSION b/VERSION
index dedcc7d..37989bd 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.9.1
+2.10
diff --git a/rpimonitor/rpimonitord b/rpimonitor/rpimonitord
index 1955014..950bb6a 100755
--- a/rpimonitor/rpimonitord
+++ b/rpimonitor/rpimonitord
@@ -16,7 +16,7 @@
# along with this program. If not, see
$path not in
". join ('
',@{$this->{'paths'}} )) and return;
$isvalid or $this->SendError(404);
@@ -485,12 +491,17 @@ sub Run
unshift ( @{$this->{'paths'}}, $1);
}
@{$this->{'paths'}} = ( @{ $configuration->{'rrdlist'}}, @{$this->{'paths'}} );
- $this->{'status'} = encode_json(\@{$configuration->{'web'}->{'status'}});
- $this->{'statistics'} = encode_json(\@{$configuration->{'web'}->{'statistics'}});
- $this->{'friends'} = encode_json(\@{$configuration->{'web'}->{'friends'}});
- $this->{'page'} = encode_json(\%{$configuration->{'web'}->{'page'}});
- $this->{'static'} = encode_json(\%{$monitor->{'static'}});
- $this->{'menu'} = encode_json(\%{$configuration->{'menu'}});
+ $this->{'status'} = to_json(\@{$configuration->{'web'}->{'status'}});
+ $this->{'statistics'} = to_json(\@{$configuration->{'web'}->{'statistics'}});
+ $this->{'friends'} = to_json(\@{$configuration->{'web'}->{'friends'}});
+ $this->{'page'} = to_json(\%{$configuration->{'web'}->{'page'}});
+ $this->{'static'} = to_json(\%{$monitor->{'static'}});
+ $this->{'menu'} = to_json(\%{$configuration->{'web'}->{'menu'}});
+ $this->{'addons'} = to_json(\@{$configuration->{'web'}->{'addons'}});
+ my $json = JSON->new;
+ $json = $json->allow_blessed([$configuration]);
+ $json = $json->convert_blessed([$configuration]);
+ $this->{'all'} = $json->encode( \%{$configuration} );
$this->{'version'} = "{\"version\":\"$configuration->{'version'}\"}";
#print Data::Dumper->Dump([$this->{'paths'}]);
@@ -563,27 +574,31 @@ sub Run
# write json if server is not running
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/static.json")
or warn $!;
- print FILE encode_json \%{$this->{'static'}} ;
+ print FILE to_json \%{$this->{'static'}} ;
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/status.json")
or warn $!;
- print FILE encode_json \@{$configuration->{'web'}->{'status'}} ;
+ print FILE to_json \@{$configuration->{'web'}->{'status'}} ;
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/page.json")
or warn $!;
- print FILE encode_json \%{$configuration->{'web'}->{'page'}} ;
+ print FILE to_json \%{$configuration->{'web'}->{'page'}} ;
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/statistics.json")
or warn $!;
- print FILE encode_json \@{$configuration->{'web'}->{'statistics'}} ;
+ print FILE to_json \@{$configuration->{'web'}->{'statistics'}} ;
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/friends.json")
or warn $!;
- print FILE encode_json(\@{$configuration->{'web'}->{'friends'}});
+ print FILE to_json(\@{$configuration->{'web'}->{'friends'}});
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/menu.json")
or warn $!;
- print FILE encode_json(\%{$configuration->{'menu'}});
+ print FILE to_json(\%{$configuration->{'web'}->{'menu'}});
+ close(FILE);
+ open(FILE, "> $configuration->{'daemon'}->{'webroot'}/addons.json")
+ or warn $!;
+ print FILE to_json(\@{$configuration->{'web'}->{'addons'}});
close(FILE);
open(FILE, "> $configuration->{'daemon'}->{'webroot'}/version.json")
or warn $!;
@@ -668,7 +683,7 @@ sub Status
my ($sec,$min,$hour,$mday,$mon,$year) = (localtime)[0,1,2,3,4,5];
@{$this->{'dynamic'}->{'localtime'}}=($year+1900,$mon+1,$mday,$hour,$min,$sec);
- my $json=encode_json \%{$this->{'dynamic'}};
+ my $json=to_json \%{$this->{'dynamic'}};
$this->Debug(4,"\n$json");
# if embeded server is not used, we write the json file else the
diff --git a/rpimonitor/template/bananian.conf b/rpimonitor/template/bananian.conf
new file mode 100644
index 0000000..8271352
--- /dev/null
+++ b/rpimonitor/template/bananian.conf
@@ -0,0 +1,16 @@
+web.page.icon='img/logo.png'
+web.page.menutitle='BPi-Monitor ('+data.hostname+')'
+web.page.pagetitle='BPi-Monitor ('+data.hostname+')'
+
+web.status.1.name=Banana Pi
+web.statistics.1.name=Banana Pi
+
+include=/etc/rpimonitor/template/version.conf
+include=/etc/rpimonitor/template/uptime.conf
+include=/etc/rpimonitor/template/cpu_bananian.conf
+include=/etc/rpimonitor/template/pmu_bananian.conf
+include=/etc/rpimonitor/template/temperature_bananian.conf
+include=/etc/rpimonitor/template/memory.conf
+include=/etc/rpimonitor/template/swap.conf
+include=/etc/rpimonitor/template/sdcard.conf
+include=/etc/rpimonitor/template/network.conf
diff --git a/rpimonitor/template/cpu.conf b/rpimonitor/template/cpu.conf
index a4eba49..1235fd2 100644
--- a/rpimonitor/template/cpu.conf
+++ b/rpimonitor/template/cpu.conf
@@ -37,6 +37,7 @@ web.status.1.content.1.icon=cpu.png
web.status.1.content.1.line.1=JustGageBar("Load", "1min", 0, data.load1, 3, 100, 80)+" "+JustGageBar("Load", "5min", 0, data.load5, 3, 100, 80)+" "+JustGageBar("Load", "15min", 0, data.load15, 3, 100, 80)
web.status.1.content.1.line.2="CPU frequency: " + data.cpu_frequency + "MHz Voltage: " + data.cpu_voltage + "V"
web.status.1.content.1.line.3="Scaling governor: " + data.scaling_governor + ""
+#web.status.1.content.1.line.4=InsertHTML("/addons/top3/top3.html")
web.statistics.1.content.1.name=CPU Loads
web.statistics.1.content.1.graph.1=load1
diff --git a/rpimonitor/template/cpu_bananian.conf b/rpimonitor/template/cpu_bananian.conf
new file mode 100644
index 0000000..0877641
--- /dev/null
+++ b/rpimonitor/template/cpu_bananian.conf
@@ -0,0 +1,69 @@
+########################################################################
+# Extract CPU information
+# Page: 1
+# Information Status Statistics
+# - cpu frequency - yes - yes
+# - pmu voltage - no - yes
+# - cpu load 1, 5, 15 - yes - yes
+# - cpu scaling governor - yes - no
+# - pmu current - yes - yes
+# - pmu consumption (V * A) - no - yes
+########################################################################
+dynamic.1.name=cpu_frequency
+dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
+dynamic.1.regexp=(.*)
+dynamic.1.postprocess=$1/1000
+dynamic.1.rrd=GAUGE
+
+dynamic.2.name=pmu_voltage
+dynamic.2.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now
+dynamic.2.regexp=(.*)
+dynamic.2.postprocess=$1/1000000
+dynamic.2.rrd=GAUGE
+
+dynamic.3.name=load1,load5,load15
+dynamic.3.source=/proc/loadavg
+dynamic.3.regexp=^(\S+)\s(\S+)\s(\S+)
+dynamic.3.postprocess=
+dynamic.3.rrd=GAUGE
+
+dynamic.4.name=scaling_governor
+dynamic.4.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+dynamic.4.regexp=(.*)
+dynamic.4.postprocess=
+dynamic.4.rrd=
+
+dynamic.5.name=pmu_current
+dynamic.5.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
+dynamic.5.regexp=(.*)
+dynamic.5.postprocess=$1/1000
+dynamic.5.rrd=GAUGE
+
+dynamic.6.name=pmu_consumption
+dynamic.6.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
+dynamic.6.regexp=(.*)
+dynamic.6.postprocess=$1/1000000 * $this->{'dynamic'}->{'pmu_voltage'}
+dynamic.6.rrd=GAUGE
+
+web.status.1.content.1.name=CPU / PMU
+web.status.1.content.1.icon=cpu.png
+web.status.1.content.1.line.1="Loads: " + data.load1 + " [1min] - " + data.load5 + " [5min] - " + data.load15 + " [15min]"
+web.status.1.content.1.line.2="CPU frequency: " + data.cpu_frequency + "MHz PMU Current: " + data.pmu_current + "mA"
+web.status.1.content.1.line.3="Scaling governor: " + data.scaling_governor + ""
+
+web.statistics.1.content.1.name=Load / Clock speed / PMU
+web.statistics.1.content.1.graph.1=load1
+web.statistics.1.content.1.graph.2=load5
+web.statistics.1.content.1.graph.3=load15
+web.statistics.1.content.1.graph.4=pmu_consumption
+web.statistics.1.content.1.graph.5=cpu_frequency
+web.statistics.1.content.1.graph.6=pmu_current
+web.statistics.1.content.1.ds_graph_options.load1.label=Load 1 min
+web.statistics.1.content.1.ds_graph_options.load5.label=Load 5 min
+web.statistics.1.content.1.ds_graph_options.load15.label=Load 15 min
+web.statistics.1.content.1.ds_graph_options.pmu_consumption.label=PMU consumption (W)
+web.statistics.1.content.1.ds_graph_options.cpu_frequency.label=Clock speed (MHz)
+web.statistics.1.content.1.ds_graph_options.pmu_current.label=PMU Current (mA)
+web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
+web.statistics.1.content.1.ds_graph_options.pmu_current.yaxis=2
+web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
diff --git a/rpimonitor/template/pmu_bananian.conf b/rpimonitor/template/pmu_bananian.conf
new file mode 100644
index 0000000..04e46e3
--- /dev/null
+++ b/rpimonitor/template/pmu_bananian.conf
@@ -0,0 +1,84 @@
+########################################################################
+# Extract PMU information
+# Page: 1
+# Information Status Statistics
+# - pmu usb voltage - no - yes
+# - pmu pwr voltage - no - yes
+# - pmu usb current - no - yes
+# - pmu pwr current - no - yes
+# - PWR consumption - yes - no
+# - USB consumption - yes - no
+#
+# logo from http://www.apkdad.com/wp-content/uploads/2013/01/Battery-Icon1.png
+########################################################################
+dynamic.1.name=pmu_usb_voltage
+dynamic.1.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/usb/voltage_now
+dynamic.1.regexp=(.*)
+dynamic.1.postprocess=$1/1000000
+dynamic.1.rrd=GAUGE
+
+dynamic.2.name=pmu_ac_voltage
+dynamic.2.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now
+dynamic.2.regexp=(.*)
+dynamic.2.postprocess=$1/1000000
+dynamic.2.rrd=GAUGE
+
+dynamic.3.name=pmu_usb_current
+dynamic.3.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/usb/current_now
+dynamic.3.regexp=(.*)
+dynamic.3.postprocess=$1/1000
+dynamic.3.rrd=GAUGE
+
+dynamic.4.name=pmu_ac_current
+dynamic.4.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
+dynamic.4.regexp=(.*)
+dynamic.4.postprocess=$1/1000
+dynamic.4.rrd=GAUGE
+
+dynamic.5.name=pmu_usb_consumption
+dynamic.5.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/usb/current_now
+dynamic.5.regexp=(.*)
+dynamic.5.postprocess=$this->{'dynamic'}->{'pmu_usb_voltage'} * $1 / 1000
+dynamic.5.rrd=GAUGE
+
+dynamic.6.name=pmu_ac_consumption
+dynamic.6.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
+dynamic.6.regexp=(.*)
+dynamic.6.postprocess=$this->{'dynamic'}->{'pmu_ac_voltage'} * $1 / 1000
+dynamic.6.rrd=GAUGE
+
+dynamic.7.name=pmu_cur_temp
+dynamic.7.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
+dynamic.7.regexp=(.*)
+dynamic.7.postprocess=$1/1000
+dynamic.7.rrd=GAUGE
+
+web.status.1.content.1.name=Consumption
+web.status.1.content.1.icon=pmu.png
+web.status.1.content.1.line.1="PWR in: " + data.pmu_ac_consumption + " mW USB OTG in: " + data.pmu_usb_consumption + " mW"
+
+web.statistics.1.content.1.name=PMU current/voltage
+web.statistics.1.content.1.graph.1=pmu_ac_voltage
+web.statistics.1.content.1.graph.2=pmu_usb_voltage
+web.statistics.1.content.1.graph.3=pmu_ac_current
+web.statistics.1.content.1.graph.4=pmu_usb_current
+web.statistics.1.content.1.ds_graph_options.pmu_ac_voltage.label=Voltage PWR in (V)
+web.statistics.1.content.1.ds_graph_options.pmu_usb_voltage.label=Voltage USB in (V)
+web.statistics.1.content.1.ds_graph_options.pmu_ac_current.label=Current PWR in (mA)
+web.statistics.1.content.1.ds_graph_options.pmu_usb_current.label=Current USB in (mA)
+web.statistics.1.content.1.ds_graph_options.pmu_ac_voltage.yaxis=1
+web.statistics.1.content.1.ds_graph_options.pmu_usb_voltage.yaxis=1
+web.statistics.1.content.1.ds_graph_options.pmu_ac_current.yaxis=2
+web.statistics.1.content.1.ds_graph_options.pmu_usb_current.yaxis=2
+web.statistics.1.content.1.graph_options.y1axis={ position: "left", min: 4.5, max: 5.5 }
+web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
+
+web.statistics.1.content.2.name=Consumption / temperature
+web.statistics.1.content.2.graph.1=pmu_ac_consumption
+web.statistics.1.content.2.graph.2=pmu_usb_consumption
+web.statistics.1.content.2.graph.3=pmu_cur_temp
+web.statistics.1.content.2.ds_graph_options.pmu_ac_consumption.label=Consumption (W)
+web.statistics.1.content.2.ds_graph_options.pmu_usb_consumption.label=USB devices (W)
+web.statistics.1.content.2.ds_graph_options.pmu_cur_temp.label="Current PMU temp (°C)"
+web.statistics.1.content.2.ds_graph_options.pmu_cur_temp.yaxis=2
+web.statistics.1.content.2.graph_options.y2axis={ position: "right" }
diff --git a/rpimonitor/template/raspbian.conf b/rpimonitor/template/raspbian.conf
index 07a1996..6f70f39 100644
--- a/rpimonitor/template/raspbian.conf
+++ b/rpimonitor/template/raspbian.conf
@@ -209,6 +209,10 @@
# level : 'default' (grey), 'primary' (blue label/grey badge),
# 'success' (green), 'info' (cyan), 'warning' (orange)
# or 'danger' (red)
+#
+# InsertHTML(url)
+# This function is used to insert an HTML information inside
+# a page. (Ref Top3 example showing top most process cpu usage)
#
# The statistic page is fully configurable.
# It is possible to define multiple pages. Each page is identified by
@@ -260,7 +264,31 @@ web.page.menutitle='RPi-Monitor ('+data.hostname+')'
web.page.pagetitle='RPi-Monitor ('+data.hostname+')'
web.status.1.name=Raspberry Pi
+#web.status.2.name=Home
web.statistics.1.name=Raspberry Pi
+#web.statistics.2.name=page 2
+
+web.addons.1.name=Addons
+web.addons.1.addons=about
+#web.addons.1.name=Shellinabox
+#web.addons.1.addons=shellinabox
+
+#web.addons.2.name=Addons example
+#web.addons.2.addons=example
+#web.addons.2.showTitle=0
+
+#web.addons.3.name=Webcam - Hawkeye
+#web.addons.3.showTitle=0
+#web.addons.3.addons=custom
+#web.addons.3.url=http://0:8000/
+
+#web.addons.4.name=Custom addons
+#web.addons.4.addons=custom
+#web.addons.4.showTitle=0
+#web.addons.4.url=/addons/custom/custominfo.html
+
+#web.addons.5.name=Top3
+#web.addons.5.addons=top3
#include=/etc/rpimonitor/template/example.justgage.conf
#include=/etc/rpimonitor/template/example.badge_and_label.conf
diff --git a/rpimonitor/template/services.conf b/rpimonitor/template/services.conf
index 4d25da7..ad55067 100644
--- a/rpimonitor/template/services.conf
+++ b/rpimonitor/template/services.conf
@@ -6,6 +6,7 @@
# - rpimonotor port (8888) - yes - no
# - http port (80) - yes - yes
# - https port (443) - yes - yes
+# - mysql port (3306) - yes - no
########################################################################
dynamic.1.name=ssh
dynamic.1.source=netstat -nlt
@@ -23,6 +24,10 @@ dynamic.4.name=https
dynamic.4.source=netstat -nlt
dynamic.4.regexp=tcp .*:(443).*LISTEN
+dynamic.5.name=mysql
+dynamic.5.source=netstat -nlt
+dynamic.5.regexp=tcp .*:(3306).*LISTEN
+
web.status.1.content.1.name=Servers
web.status.1.content.1.icon=daemons.png
-web.status.1.content.1.line.1="ssh : "+Label(data.ssh,"==22","OK","success")+Label(data.ssh,"!=22","KO","danger")+" rpimonitor : "+Label(data.rpimonitor,"==8888","OK","success")+Label(data.rpimonitor,"!=8888","KO","danger")+" nginx http : "+Label(data.http,"==80","OK","success")+Label(data.http,"!=80","KO","danger")+" nginx https : "+Label(data.https,"==443","OK","success")+Label(data.https,"!=443","KO","danger")
+web.status.1.content.1.line.1="ssh : "+Label(data.ssh,"==22","OK","success")+Label(data.ssh,"!=22","KO","danger")+" rpimonitor : "+Label(data.rpimonitor,"==8888","OK","success")+Label(data.rpimonitor,"!=8888","KO","danger")+" nginx http : "+Label(data.http,"==80","OK","success")+Label(data.http,"!=80","KO","danger")+" nginx https : "+Label(data.https,"==443","OK","success")+Label(data.https,"!=443","KO","danger")+" mysql : "+Label(data.mysql,"==3306","OK","success")+Label(data.mysql,"!=3306","KO","danger"
diff --git a/rpimonitor/template/temperature.conf b/rpimonitor/template/temperature.conf
index 7b878a4..76e421c 100644
--- a/rpimonitor/template/temperature.conf
+++ b/rpimonitor/template/temperature.conf
@@ -13,9 +13,9 @@ dynamic.12.rrd=GAUGE
web.status.1.content.4.name=Temperature
web.status.1.content.4.icon=cpu_temp.png
#web.status.1.content.4.line.1="CPU Temperature: "+data.soc_temp+"°C"
-#web.status.1.content.4.line.1=JustGageBar("CPU Temperature", data.soc_temp+"°C", 40, data.soc_temp, 80, 100, 80)
-web.status.1.content.4.line.1=JustGageBar("Temperature", "°C", 40, data.soc_temp, 80, 100, 80)
+#web.status.1.content.4.line.1=JustGageBar("CPU Temperature", data.soc_temp+"°C", 40, data.soc_temp, 80, 100, 80)
+web.status.1.content.4.line.1=JustGageBar("Temperature", "°C", 40, data.soc_temp, 80, 100, 80)
web.statistics.1.content.8.name=Temperature
web.statistics.1.content.8.graph.1=soc_temp
-web.statistics.1.content.8.ds_graph_options.soc_temp.label=Core temperature (°C)
+web.statistics.1.content.8.ds_graph_options.soc_temp.label=Core temperature (°C)
diff --git a/rpimonitor/template/temperature_bananian.conf b/rpimonitor/template/temperature_bananian.conf
new file mode 100644
index 0000000..3a5ad40
--- /dev/null
+++ b/rpimonitor/template/temperature_bananian.conf
@@ -0,0 +1,37 @@
+########################################################################
+# Extract CPU Temperature information
+# Page: 1
+# Information Status Statistics
+# - soc temperature - yes - yes
+# - pmu temperature - yes - yes
+# - disk temperature - yes - yes
+########################################################################
+dynamic.1.name=soc_temp
+dynamic.1.source=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input
+dynamic.1.regexp=(.*)
+dynamic.1.postprocess=$1/1000
+dynamic.1.rrd=GAUGE
+
+dynamic.2.name=hddtemp
+dynamic.2.source=/run/hdd-temp
+dynamic.2.regexp=(.*)
+dynamic.2.postprocess=
+dynamic.2.rrd=GAUGE
+
+dynamic.3.name=cputemp
+dynamic.3.source=/run/soc-temp
+dynamic.3.regexp=(.*)
+dynamic.3.postprocess=
+dynamic.3.rrd=GAUGE
+
+web.status.1.content.4.name=Temperature
+web.status.1.content.4.icon=cpu_temp.png
+web.status.1.content.4.line.1=JustGageBar("CPU", "°C",0, data.cputemp , 100,100,80,percentColors,50,60)+" "+JustGageBar("PMU", "°C",0, data.soc_temp , 100,100,80,percentColors,35,45)+" "+JustGageBar("Disk", "°C",0, data.hddtemp , 100,100,80,percentColors,40,45)
+
+web.statistics.1.content.8.name=Temperature
+web.statistics.1.content.8.graph.1=soc_temp
+web.statistics.1.content.8.graph.2=hddtemp
+web.statistics.1.content.8.graph.3=cputemp
+web.statistics.1.content.8.ds_graph_options.soc_temp.label=PMU temperature (deg C)
+web.statistics.1.content.8.ds_graph_options.hddtemp.label=HDD temperature (deg C)
+web.statistics.1.content.8.ds_graph_options.cputemp.label=CPU temperature (deg C)
diff --git a/rpimonitor/web/shellinabox.html b/rpimonitor/web/addons.html
similarity index 80%
rename from rpimonitor/web/shellinabox.html
rename to rpimonitor/web/addons.html
index f6fae7d..1f5c1cc 100644
--- a/rpimonitor/web/shellinabox.html
+++ b/rpimonitor/web/addons.html
@@ -35,23 +35,26 @@