first commit
This commit is contained in:
475
external/packages/bsp/orangepimonitor/orangepimonitor-daemon
vendored
Normal file
475
external/packages/bsp/orangepimonitor/orangepimonitor-daemon
vendored
Normal file
@@ -0,0 +1,475 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# orangepimonitor-daemon
|
||||
#
|
||||
# This script relies on information gathered in armhwinfo. It
|
||||
# calls armhwinfo in query mode and relies then on the exported
|
||||
# variables: HARDWARE ARCH KERNELID MACHINE ID VERSION
|
||||
#
|
||||
# The purpose is to create an environment for rpimonitord so that
|
||||
# relevant hardware informations can be monitored easily. This
|
||||
# script starts uses configuration files in /etc/orangepimonitor/,
|
||||
# collects data sources below /etc/orangepimonitor/datasources/ and
|
||||
# adjusts templates for RPi-Monitor on the fly. Only if the file
|
||||
# /etc/orangepimonitor/start-monitoring exists this script relinks
|
||||
# /etc/rpimonitor/data.conf and starts rpimonitord if not already
|
||||
# running.
|
||||
#
|
||||
# In case the script detects that not all necessary data sources
|
||||
# are available through sysfs it will act as a daemon to collect
|
||||
# data on its own and to write it to the approriate file. As an
|
||||
# example the SoC's temperature: Running on an AXP209 based board
|
||||
# the script will check /sys/class/thermal/thermal_zone0/temp and
|
||||
# if existing link it to /etc/orangepimonitor/datasources/soctemp.
|
||||
# In case it does not exist the script will create a normal file
|
||||
# at this location and writes the thermal value to it using the
|
||||
# sunxi_axp209_temp binary in an endless loop.
|
||||
#
|
||||
# At least the following files/symlinks will be provided below
|
||||
# /etc/orangepimonitor/datasources/ depending on SoC/PMIC in question:
|
||||
#
|
||||
# soctemp (SoC's internal temp in degree Celsius * 1000)
|
||||
# pmictemp (PMIC's internal temp in degree Celsius * 1000)
|
||||
# ac_voltage (DC-IN voltage in V * 1000000)
|
||||
# usb_voltage (USB OTG voltage in V * 1000000)
|
||||
# battery_voltage (battery voltage in V * 1000000)
|
||||
# ac_current (DC-IN current in A * 1000000)
|
||||
# usb_current (USB OTG current in A * 1000000)
|
||||
# battery_current (battery current in A * 1000000)
|
||||
#
|
||||
# When extended debugging has been chosen (using _orangepi-monitoring_
|
||||
# this can be configured. Then /etc/orangepimonitor/start-monitoring
|
||||
# contains DEBUG) this script will also provide a few more files:
|
||||
#
|
||||
# cpustat (cpu_stat,system_stat,user_stat,nice_stat,iowait_stat,irq_stat
|
||||
# collected through /proc/cpustat in daemon mode)
|
||||
# cpu_count (number of active CPU cores)
|
||||
# vcorevoltage (Vcore in V * 1000 based on sysfs or script.bin/.dtb)
|
||||
#
|
||||
# Disk monitoring: For configured disks the following parameters can be
|
||||
# monitored: temperature, S.M.A.R.T. health, load cycle count and CRC
|
||||
# errors indicating connection/cable problems. The config file used is
|
||||
# /etc/orangepimonitoring/disks.conf
|
||||
#
|
||||
# Filesystem monitoring: In /etc/orangepimonitoring/filesystems.conf
|
||||
# mountpoints and trigger values can be defined that will be used to
|
||||
# create the template stuff for these fs at startup of this script.
|
||||
#
|
||||
# The behaviour of this script can be configured through another tool
|
||||
# called orangepi-monitoring. The latter will also check for connected
|
||||
# disks, get their name and GUID and let the user choose whether the
|
||||
# disk should be monitored or not. The information has to be stored in
|
||||
# /etc/orangepimonitor/disks.conf relying on the GUIDs of the disks.
|
||||
|
||||
# define some variables:
|
||||
CheckInterval=7.5 # time in seconds between two checks
|
||||
DiskCheckInterval=60 # time in seconds between disk checks
|
||||
|
||||
Main() {
|
||||
PreRequisits
|
||||
|
||||
case ${BOARD_NAME} in
|
||||
Cubieboard|Cubietruck|Orange|"Lamobo R1"|"Lime 2"|Lime|"Banana Pi"|Micro|"Banana Pi"|"Banana Pi Pro")
|
||||
DealWithAXP209
|
||||
;;
|
||||
"Banana M2")
|
||||
DealWithNewBoard
|
||||
# DealWithAXP221
|
||||
;;
|
||||
"Cubietruck Plus"|"Banana Pi M3"|"pcDuino8 Uno")
|
||||
DealWithNewBoard
|
||||
# DealWithAXP818
|
||||
;;
|
||||
Guitar|"Roseapple Pi")
|
||||
DealWithNewBoard
|
||||
# DealWithS500
|
||||
;;
|
||||
"Odroid XU4"|"Odroid XU3")
|
||||
DealWithNewBoard
|
||||
# DealWithExynos4
|
||||
;;
|
||||
"Odroid C1")
|
||||
DealWithNewBoard
|
||||
# DealWithS805
|
||||
;;
|
||||
Clearfog|"Turris Omnia")
|
||||
DealWithNewBoard
|
||||
# DealWithArmada38x
|
||||
;;
|
||||
"Cubox i4"|"HB i2eX"|"Cubox i2eX"|"HB i1"|"HB i2"|"Wandboard")
|
||||
DealWithNewBoard
|
||||
# DealWithiMX6
|
||||
;;
|
||||
"Orange Pi PC"|"Orange Pi Plus"|"Orange Pi 2"|"Orange Pi One"|"Orange Pi Lite")
|
||||
DealWithNewBoard
|
||||
# DealWithH3
|
||||
;;
|
||||
Geekbox)
|
||||
DealWithNewBoard
|
||||
# DealWithRK3368
|
||||
;;
|
||||
*)
|
||||
# No templates exist now. Combine sane defaults with some guessing
|
||||
DealWithNewBoard
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create the Orange Pi templates
|
||||
CreateTemplates
|
||||
|
||||
exit 0
|
||||
|
||||
# Decide depending on existence of /etc/orangepimonitor/start-monitoring
|
||||
ShouldMonitoringBeStarted
|
||||
|
||||
# Provide missing data in daemon mode
|
||||
LoopEndlessly
|
||||
} # Main
|
||||
|
||||
LoopEndlessly() {
|
||||
while true ; do
|
||||
# get VCore
|
||||
read CPUFreq </sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||
GetVCore ${CPUFreq} >/tmp/VCore
|
||||
|
||||
# check disk temperature(s). We execute this only every ${DiskCheckInterval} since
|
||||
# it's a bit costly (S.M.A.R.T. queries).
|
||||
TimeNow=$(( $(date "+%s") / ${DiskCheckInterval} ))
|
||||
if [[ ${TimeNow} -gt ${LastDiskCheck} ]]; then
|
||||
# time for a disk check. If ${CheckAllDisks} is FALSE and /dev/sda exists we
|
||||
# only query this device otherwise all available (might be none)
|
||||
CheckDisks
|
||||
# update check timestamp
|
||||
LastDiskCheck=${TimeNow}
|
||||
fi
|
||||
|
||||
# External temperature from weather stations
|
||||
# TimeNow=$(( $(date "+%s") / ${TempCheckInterval} ))
|
||||
# if [[ ${TimeNow} -gt ${LastTempCheck} ]]; then
|
||||
# read in external temp values from 2 different web sources
|
||||
# ExternalTemp=$(GetExternalTemp)
|
||||
# LastExternalTemp=$(SanitizeValue ${ExternalTemp} ${LastExternalTemp} | tee /tmp/externaltemp)
|
||||
# LastTempCheck=${TimeNow}
|
||||
# fi
|
||||
|
||||
# cpustat
|
||||
TimeNow=$(( $(date "+%s") / ${CpuStatCheckInterval} ))
|
||||
if [[ ${TimeNow} -gt ${LastCpuStatCheck} ]]; then
|
||||
ProcessStats
|
||||
LastCpuStatCheck=${TimeNow}
|
||||
fi
|
||||
sleep ${CheckInterval}
|
||||
done
|
||||
} # LoopEndlessly
|
||||
|
||||
CheckDisks() {
|
||||
# To be done based on new /etc/orangepimonitoring/disks.conf config file
|
||||
:
|
||||
} # CheckDisks
|
||||
|
||||
DealWithAXP209() {
|
||||
# check existence of sysfs nodes
|
||||
if [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then
|
||||
ln -fs /sys/devices/virtual/thermal/thermal_zone0/temp /etc/orangepimonitor/datasources/soctemp
|
||||
else
|
||||
if [ -L /etc/orangepimonitor/datasources/soctemp ]; then
|
||||
rm -f /etc/orangepimonitor/datasources/soctemp
|
||||
fi
|
||||
echo -n 25000 >/etc/orangepimonitor/datasources/soctemp
|
||||
export GetSoCTemp="${ARCH}-${BOARD_NAME}"
|
||||
fi
|
||||
if [ -d /sys/devices/platform/soc@01c00000/1c2ac00.i2c/i2c-0/0-0034 ]; then
|
||||
# mainline kernel and 'axp209 mainline sysfs interface' patch applied
|
||||
ln -fs /sys/power/axp_pmu/ac/voltage /etc/orangepimonitor/datasources/ac_voltage
|
||||
ln -fs /sys/power/axp_pmu/ac/amperage /etc/orangepimonitor/datasources/ac_current
|
||||
ln -fs /sys/power/axp_pmu/vbus/voltage /etc/orangepimonitor/datasources/usb_voltage
|
||||
ln -fs /sys/power/axp_pmu/vbus/amperage /etc/orangepimonitor/datasources/usb_current
|
||||
ln -fs /sys/power/axp_pmu/battery/voltage /etc/orangepimonitor/datasources/battery_voltage
|
||||
ln -fs /sys/power/axp_pmu/battery/amperage /etc/orangepimonitor/datasources/battery_current
|
||||
ln -fs /sys/power/axp_pmu/pmu/temp /etc/orangepimonitor/datasources/pmictemp
|
||||
ln -fs /sys/power/axp_pmu/battery/capacity /etc/orangepimonitor/datasources/battery_percent
|
||||
ln -fs /sys/power/axp_pmu/battery/charging /etc/orangepimonitor/datasources/battery_charging
|
||||
ln -fs /sys/power/axp_pmu/charger/amperage /etc/orangepimonitor/datasources/charger_current
|
||||
ln -fs /sys/power/axp_pmu/battery/connected /etc/orangepimonitor/datasources/battery_connected
|
||||
ln -fs /sys/power/axp_pmu/battery/charge /etc/orangepimonitor/datasources/battery_charge
|
||||
fi
|
||||
if [ -d /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply ]; then
|
||||
# sunxi 3.4 kernel
|
||||
SysFSPrefix=/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply
|
||||
ln -fs "${SysFSPrefix}"/ac/voltage_now /etc/orangepimonitor/datasources/ac_voltage
|
||||
ln -fs "${SysFSPrefix}"/ac/current_now /etc/orangepimonitor/datasources/ac_current
|
||||
ln -fs "${SysFSPrefix}"/usb/voltage_now /etc/orangepimonitor/datasources/usb_voltage
|
||||
ln -fs "${SysFSPrefix}"/usb/current_now /etc/orangepimonitor/datasources/usb_current
|
||||
ln -fs "${SysFSPrefix}"/battery/voltage_now /etc/orangepimonitor/datasources/battery_voltage
|
||||
ln -fs "${SysFSPrefix}"/battery/current_now /etc/orangepimonitor/datasources/battery_current
|
||||
ln -fs /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input /etc/orangepimonitor/datasources/pmictemp
|
||||
ln -fs /sys/class/power_supply/battery/capacity /etc/orangepimonitor/datasources/battery_percent
|
||||
ln -fs /sys/class/power_supply/battery/charging /etc/orangepimonitor/datasources/battery_charging
|
||||
ln -fs /sys/class/power_supply/battery/connected /etc/orangepimonitor/datasources/battery_connected
|
||||
ln -fs /sys/class/power_supply/battery/charge /etc/orangepimonitor/datasources/battery_charge
|
||||
fi
|
||||
# relink template
|
||||
if [ "X${DebugMode}" = "XDEBUG" ]; then
|
||||
ln -sf /etc/orangepimonitor/templates/axp209_template_debug.conf /etc/orangepimonitor/templates/cpu_pmic.conf
|
||||
else
|
||||
ln -sf /etc/orangepimonitor/templates/axp209_template.conf /etc/orangepimonitor/templates/cpu_pmic.conf
|
||||
fi
|
||||
} # DealWithAXP209
|
||||
|
||||
DealWithNewBoard() {
|
||||
# check existence of sysfs nodes
|
||||
if [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then
|
||||
ln -fs /sys/devices/virtual/thermal/thermal_zone0/temp /etc/orangepimonitor/datasources/soctemp
|
||||
elif [ -f /sys/devices/virtual/thermal/thermal_zone1/temp ]; then
|
||||
ln -fs /sys/devices/virtual/thermal/thermal_zone1/temp /etc/orangepimonitor/datasources/soctemp
|
||||
fi
|
||||
# relink template
|
||||
if [ "X${DebugMode}" = "XDEBUG" ]; then
|
||||
ln -sf /etc/orangepimonitor/templates/unknown_board_template_debug.conf /etc/orangepimonitor/templates/cpu_pmic.conf
|
||||
else
|
||||
ln -sf /etc/orangepimonitor/templates/unknown_board_template.conf /etc/orangepimonitor/templates/cpu_pmic.conf
|
||||
fi
|
||||
} # DealWithNewBoard
|
||||
|
||||
CreateTemplates() {
|
||||
# check whether templates we write aren't symlinks to somewhere else
|
||||
for i in orangepi.conf uptime.conf version.conf ; do
|
||||
if [ -L /etc/orangepimonitor/templates/${i} ]; then
|
||||
rm /etc/orangepimonitor/templates/${i}
|
||||
touch /etc/orangepimonitor/templates/${i}
|
||||
chmod 711 /etc/orangepimonitor/templates/${i}
|
||||
fi
|
||||
done
|
||||
|
||||
# check whether our logo is available
|
||||
if [ ! -f /usr/share/rpimonitor/web/img/orangepi.png ]; then
|
||||
if [ -L /usr/share/rpimonitor/web/img/orangepi.png ]; then
|
||||
rm /usr/share/rpimonitor/web/img/orangepi.png
|
||||
fi
|
||||
cp -p /etc/orangepimonitor/templates/orangepi.png /usr/share/rpimonitor/web/img/
|
||||
fi
|
||||
|
||||
# create main template
|
||||
echo "web.page.icon='img/orangepi.png'
|
||||
web.page.menutitle='RPi-Monitor <sub>('+data.hostname+')</sub>'
|
||||
web.page.pagetitle='RPi-Monitor ('+data.hostname+')'
|
||||
web.status.1.name=$BOARD_NAME
|
||||
web.statistics.1.name=$BOARD_NAME
|
||||
web.addons.1.name=Addons
|
||||
web.addons.1.addons=about
|
||||
include=/etc/orangepimonitor/templates/version.conf
|
||||
include=/etc/orangepimonitor/templates/uptime.conf
|
||||
include=/etc/orangepimonitor/templates/cpu_pmic.conf
|
||||
include=/etc/rpimonitor/template/memory.conf" >/etc/orangepimonitor/orangepi.conf
|
||||
|
||||
# remove firmware line in version info:
|
||||
grep -v "Firmware" /etc/rpimonitor/template/version.conf | sed 's|line.5|line.4|' >/etc/orangepimonitor/templates/version.conf
|
||||
|
||||
# uptime template with correct machine name:
|
||||
sed "s/Raspberry Pi/$ID/" < /etc/rpimonitor/template/uptime.conf >/etc/orangepimonitor/templates/uptime.conf
|
||||
|
||||
# check swap settings. In case we're using swap then add template
|
||||
HowManySwapDevices=$(swapon -s | wc -l)
|
||||
if [[ ${HowManySwapDevices} -gt 1 ]]; then
|
||||
echo "include=/etc/rpimonitor/template/swap.conf" >>/etc/orangepimonitor/orangepi.conf
|
||||
fi
|
||||
|
||||
echo "include=/etc/orangepimonitor/template/filesystems.conf
|
||||
include=/etc/orangepimonitor/template/disks.conf
|
||||
include=/etc/rpimonitor/template/network.conf" >>/etc/orangepimonitor/orangepi.conf
|
||||
|
||||
UpdateFileSystems
|
||||
UpdateDisks
|
||||
} #
|
||||
|
||||
UpdateFileSystems() {
|
||||
# Generates /etc/orangepimonitor/template/filesystems.conf dynamically
|
||||
# based on the contents of /etc/orangepimonitoring/filesystems.conf
|
||||
|
||||
# if not existing, create config file with single entry for /
|
||||
if [ ! -f /etc/orangepimonitoring/filesystems.conf ]; then
|
||||
echo '/' >/etc/orangepimonitoring/filesystems.conf
|
||||
chmod 711 /etc/orangepimonitoring/filesystems.conf
|
||||
fi
|
||||
|
||||
# Update template:
|
||||
|
||||
} # UpdateFileSystems
|
||||
|
||||
UpdateDisks() {
|
||||
# Generates /etc/orangepimonitor/template/disks.conf dynamically
|
||||
# based on the contents of /etc/orangepimonitor/disks.conf. The
|
||||
# current mapping between GUIDs and /dev/sd* nodes will be stored
|
||||
# in /etc/orangepimonitor/datasources/disk-by-guid
|
||||
|
||||
# ensure lookup file is empty:
|
||||
if [ -L /etc/orangepimonitor/datasources/disk-by-guid ]; then
|
||||
rm -f /etc/orangepimonitor/datasources/disk-by-guid
|
||||
fi
|
||||
echo -n "" >/etc/orangepimonitor/datasources/disk-by-guid
|
||||
chmod 711 /etc/orangepimonitor/datasources/disk-by-guid
|
||||
|
||||
OIFS=${IFS}
|
||||
IFS=:
|
||||
cat /etc/orangepimonitor/disks.conf | while read ; do
|
||||
IFS=:
|
||||
set ${REPLY}
|
||||
GUID="$1"
|
||||
DiskName="$2"
|
||||
SMARTPrefix="$3"
|
||||
TempCommand="$4"
|
||||
CRCAttribute="$5"
|
||||
LCCAttribute="$6"
|
||||
IFS=${OIFS}
|
||||
|
||||
# try to resolve device node (when not present, then disk's
|
||||
# not mounted -- we then create the entry without device node)
|
||||
DeviceNode="$(ResolveGUID ${GUID})"
|
||||
echo -e "${GUID}\t${DiskName}\t${DeviceNode}" >>/etc/orangepimonitor/datasources/disk-by-guid
|
||||
|
||||
# create template stuff for every listed disk
|
||||
:
|
||||
done
|
||||
IFS=${OIFS}
|
||||
} # UpdateDisks
|
||||
|
||||
ResolveGUID() {
|
||||
# function that will be supplied with a GUID and returns the device node, eg.
|
||||
# translating 637B7677-18E7-4C7B-8DF3-CFED96EA55C3 to /dev/sdb
|
||||
|
||||
# check whether disks are existent
|
||||
ls /sys/block/sd* >/dev/null 2>&1 || return
|
||||
|
||||
for i in /sys/block/sd* ; do
|
||||
DeviceNode=/dev/${i##*/}
|
||||
GUID=$(gdisk -l ${DeviceNode} | awk -F" " '/^Disk identifier/ {print $4}')
|
||||
if [ "X${GUID}" = "X${1}" ]; then
|
||||
echo -n ${DeviceNode}
|
||||
break
|
||||
fi
|
||||
done
|
||||
} # GetGUIDforDisk
|
||||
|
||||
PreRequisits() {
|
||||
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
|
||||
unset LANG
|
||||
LastDiskCheck=0
|
||||
|
||||
# we need the informations gathered from armhwinfo. In case we're not called
|
||||
# from there, get the variables on our own
|
||||
if [ "X${BOARD_NAME}" = "X" ]; then
|
||||
. /etc/init.d/armhwinfo start >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# check/create /etc/orangepimonitor and /etc/orangepimonitor/datasources
|
||||
if [ ! -d /etc/orangepimonitor ]; then
|
||||
mkdir -p -m 755 /etc/orangepimonitor
|
||||
else
|
||||
chmod 755 /etc/orangepimonitor
|
||||
fi
|
||||
if [ ! -d /etc/orangepimonitor/datasources ]; then
|
||||
mkdir -p -m 755 /etc/orangepimonitor/datasources
|
||||
else
|
||||
chmod 755 /etc/orangepimonitor/datasources
|
||||
fi
|
||||
|
||||
# check whether we should do debug monitoring or normal
|
||||
read DebugMode </etc/orangepimonitor/start-monitoring
|
||||
|
||||
# set default variables
|
||||
unset LANG
|
||||
LastDiskCheck=0
|
||||
LastTempCheck=0
|
||||
LastUserStat=0
|
||||
LastNiceStat=0
|
||||
LastSystemStat=0
|
||||
LastIdleStat=0
|
||||
LastIOWaitStat=0
|
||||
LastIrqStat=0
|
||||
LastSoftIrqStat=0
|
||||
LastCpuStatCheck=0
|
||||
} # PreRequisits
|
||||
|
||||
ParseDVFSTable() {
|
||||
# extract DRAM and dvfs settings from script.bin
|
||||
bin2fex <"${Path2ScriptBin}/script.bin" 2>/dev/null | \
|
||||
egrep "^LV._|^LV_|extrem|boot_clock|_freq|^dram_" | \
|
||||
egrep -v "cpu_freq|dram_freq" | while read ; do
|
||||
echo "# ${REPLY}"
|
||||
done >/tmp/dvfs-table
|
||||
|
||||
echo -e '\nGetVCore() {' >>/tmp/dvfs-table
|
||||
|
||||
# parse /tmp/dvfs-table to get dvfs entries
|
||||
grep "^# LV._freq" /tmp/dvfs-table | sort -r | while read ; do
|
||||
set ${REPLY}
|
||||
CPUFreq=$4
|
||||
# if [ ${CPUFreq} -eq 0 ]; then
|
||||
# echo -e "if [ \$1 -ge $(( ${CPUFreq} / 1000 )) ]; then\n\techo -n ${VCore}\nel\c" >>/tmp/dvfs-table
|
||||
# break
|
||||
# else
|
||||
# VCore=$(grep -A1 "^# $2" /tmp/dvfs-table | tail -n1 | awk -F" " '{print $4}')
|
||||
# echo -e "if [ \$1 -ge $(( ${CPUFreq} / 1000 )) ]; then\n\techo -n ${VCore}\nel\c" >>/tmp/dvfs-table
|
||||
if [ ${CPUFreq} -ne 0 ]; then
|
||||
VCore=$(grep -A1 "^# $2" /tmp/dvfs-table | tail -n1 | awk -F" " '{print $4}')
|
||||
echo -e "if [ \$1 -le $(( ${CPUFreq} / 1000 )) ]; then\n\techo -n ${VCore}\nel\c" >>/tmp/dvfs-table
|
||||
fi
|
||||
done
|
||||
# VCore=$(grep -A1 "^# LV1_freq" /tmp/dvfs-table | tail -n1 | awk -F" " '{print $4}')
|
||||
echo -e "se\n\techo -n ${VCore}\nfi\n}" >>/tmp/dvfs-table
|
||||
} # ParseDVFSTable
|
||||
|
||||
ProcessStats() {
|
||||
set $(awk -F" " '/^cpu / {print $2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8}' </proc/stat)
|
||||
UserStat=$1
|
||||
NiceStat=$2
|
||||
SystemStat=$3
|
||||
IdleStat=$4
|
||||
IOWaitStat=$5
|
||||
IrqStat=$6
|
||||
SoftIrqStat=$7
|
||||
|
||||
UserDiff=$(( ${UserStat} - ${LastUserStat} ))
|
||||
NiceDiff=$(( ${NiceStat} - ${LastNiceStat} ))
|
||||
SystemDiff=$(( ${SystemStat} - ${LastSystemStat} ))
|
||||
IdleDiff=$(( ${IdleStat} - ${LastIdleStat} ))
|
||||
IOWaitDiff=$(( ${IOWaitStat} - ${LastIOWaitStat} ))
|
||||
IrqDiff=$(( ${IrqStat} - ${LastIrqStat} ))
|
||||
SoftIrqDiff=$(( ${SoftIrqStat} - ${LastSoftIrqStat} ))
|
||||
|
||||
Total=$(( ${UserDiff} + ${NiceDiff} + ${SystemDiff} + ${IdleDiff} + ${IOWaitDiff} + ${IrqDiff} + ${SoftIrqDiff} ))
|
||||
CPULoad=$(( ( ${Total} - ${IdleDiff} ) * 100 / ${Total} ))
|
||||
UserLoad=$(( ${UserDiff} *100 / ${Total} ))
|
||||
SystemLoad=$(( ${SystemDiff} *100 / ${Total} ))
|
||||
NiceLoad=$(( ${NiceDiff} *100 / ${Total} ))
|
||||
IOWaitLoad=$(( ${IOWaitDiff} *100 / ${Total} ))
|
||||
IrqCombinedLoad=$(( ( ${IrqDiff} + ${SoftIrqDiff} ) *100 / ${Total} ))
|
||||
|
||||
echo "${CPULoad} ${SystemLoad} ${UserLoad} ${NiceLoad} ${IOWaitLoad} ${IrqCombinedLoad}" >/tmp/cpustat
|
||||
|
||||
LastUserStat=${UserStat}
|
||||
LastNiceStat=${NiceStat}
|
||||
LastSystemStat=${SystemStat}
|
||||
LastIdleStat=${IdleStat}
|
||||
LastIOWaitStat=${IOWaitStat}
|
||||
LastIrqStat=${IrqStat}
|
||||
LastSoftIrqStat=${SoftIrqStat}
|
||||
} # ProcessStats
|
||||
|
||||
GetExternalTemp() {
|
||||
# example function that parses meteo.physik.uni-muenchen.de and mingaweda.de
|
||||
# temperature values for Munich and compares them. When values are out
|
||||
# of bounds then only the other value will be returned otherwise the average
|
||||
ExternalTemp1=$(/usr/bin/links -http.fake-user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12' -dump "http://www.meteo.physik.uni-muenchen.de/dokuwiki/doku.php?id=wetter:stadt:messung" | awk -F" " '/Lufttemperatur/ {printf ("%0.0f",$4*1000); }')
|
||||
ExternalTemp2=$(/usr/bin/links -http.fake-user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12' -dump "http://www.mingaweda.de/wetterdaten/" | awk -F" " '/Ausfu:hrliche/ {printf ("%0.0f",$2*1000); }')
|
||||
|
||||
if [ "X${ExternalTemp2}" = "X" ]; then
|
||||
ExternalTemp2=${ExternalTemp1}
|
||||
elif [ "X${ExternalTemp1}" = "X" ]; then
|
||||
ExternalTemp1=${ExternalTemp2}
|
||||
fi
|
||||
|
||||
echo $(( ( ${ExternalTemp1} + ${ExternalTemp2} ) / 2 ))
|
||||
} # GetExternalTemp
|
||||
|
||||
Main
|
||||
153
external/packages/bsp/orangepimonitor/templates/pine64_default.conf
vendored
Normal file
153
external/packages/bsp/orangepimonitor/templates/pine64_default.conf
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
dynamic.1.name=cpu_frequency
|
||||
dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
|
||||
dynamic.1.regexp=(.*)
|
||||
dynamic.1.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.1.rrd=GAUGE
|
||||
|
||||
dynamic.2.name=load1,load5,load15
|
||||
dynamic.2.source=/proc/loadavg
|
||||
dynamic.2.regexp=^(\S+)\s(\S+)\s(\S+)
|
||||
dynamic.2.postprocess=
|
||||
dynamic.2.rrd=GAUGE
|
||||
|
||||
dynamic.3.name=scaling_governor
|
||||
dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
dynamic.3.regexp=(.*)
|
||||
dynamic.3.postprocess=
|
||||
dynamic.3.rrd=
|
||||
|
||||
dynamic.4.name=cpu_count
|
||||
dynamic.4.source=grep -c processor /proc/cpuinfo
|
||||
dynamic.4.regexp=(.*)
|
||||
dynamic.4.postprocess=
|
||||
dynamic.4.rrd=GAUGE
|
||||
|
||||
#dynamic.5.name=disktemp
|
||||
#dynamic.5.source=/usr/sbin/smartctl -a /dev/sda | /usr/bin/awk -F" " '/Temperature_Celsius/ {print $10}'
|
||||
#dynamic.5.regexp=(.*)
|
||||
#dynamic.5.postprocess=
|
||||
#dynamic.5.rrd=GAUGE
|
||||
|
||||
dynamic.5.name=vcorevoltage
|
||||
dynamic.5.source=/sys/class/regulator/regulator.2/microvolts
|
||||
dynamic.5.regexp=(.*)
|
||||
dynamic.5.postprocess=sprintf("%.2f", $1/1000000)
|
||||
dynamic.5.rrd=GAUGE
|
||||
|
||||
dynamic.6.name=soctemp
|
||||
dynamic.6.source=/sys/devices/virtual/thermal/thermal_zone0/temp
|
||||
dynamic.6.regexp=(.*)
|
||||
dynamic.6.postprocess=
|
||||
dynamic.6.rrd=GAUGE
|
||||
|
||||
dynamic.7.name=coolingstate
|
||||
dynamic.7.source=/sys/devices/virtual/thermal/cooling_device0/cur_state
|
||||
dynamic.7.regexp=(.*)
|
||||
dynamic.7.postprocess=
|
||||
dynamic.7.rrd=GAUGE
|
||||
|
||||
dynamic.8.name=coolinglimit
|
||||
dynamic.8.source=/sys/devices/soc.0/cpu_budget_cool.16/roomage
|
||||
dynamic.8.regexp=(.*)
|
||||
dynamic.8.postprocess=
|
||||
dynamic.8.rrd=
|
||||
|
||||
dynamic.9.name=batterycapacity
|
||||
dynamic.9.source=/sys/class/power_supply/battery/capacity
|
||||
dynamic.9.regexp=(.*)
|
||||
dynamic.9.postprocess=
|
||||
dynamic.9.rrd=GAUGE
|
||||
|
||||
dynamic.10.name=batteryvoltage
|
||||
dynamic.10.source=/sys/class/power_supply/battery/voltage_now
|
||||
dynamic.10.regexp=(.*)
|
||||
dynamic.10.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.10.rrd=GAUGE
|
||||
|
||||
dynamic.11.name=batterycurrent
|
||||
dynamic.11.source=/sys/class/power_supply/battery/current_now
|
||||
dynamic.11.regexp=(.*)
|
||||
dynamic.11.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.11.rrd=GAUGE
|
||||
|
||||
dynamic.12.name=pmictemp
|
||||
dynamic.12.source=/sys/class/axppower/ic_temp
|
||||
dynamic.12.regexp=(.*)
|
||||
dynamic.12.postprocess=
|
||||
dynamic.12.rrd=GAUGE
|
||||
|
||||
dynamic.13.name=batterydrain
|
||||
dynamic.13.source=/sys/class/axppower/power_sply
|
||||
dynamic.13.regexp=(.*)
|
||||
dynamic.13.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.13.rrd=GAUGE
|
||||
|
||||
dynamic.14.name=gpu_frequency
|
||||
dynamic.14.source=/sys/devices/1c40000.gpu/dvfs/manual
|
||||
dynamic.14.regexp=^(\S+)
|
||||
dynamic.14.postprocess=
|
||||
dynamic.14.rrd=
|
||||
|
||||
dynamic.15.name=gputemp
|
||||
dynamic.15.source=awk '{print $6}' < /sys/devices/1c40000.gpu/dvfs/tempctrl
|
||||
dynamic.15.regexp=(.*)
|
||||
dynamic.15.postprocess=
|
||||
dynamic.15.rrd=
|
||||
|
||||
dynamic.16.name=gpuvoltage
|
||||
dynamic.16.source=/sys/devices/1c40000.gpu/dvfs/voltage
|
||||
dynamic.16.regexp=^(\S+)
|
||||
dynamic.16.postprocess=sprintf("%.2f", $1/1000)
|
||||
dynamic.16.rrd=
|
||||
|
||||
web.status.1.content.1.name=CPU/GPU
|
||||
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: <b>" + data.cpu_frequency + " GHz</b> (" + data.coolinglimit + ")"
|
||||
web.status.1.content.1.line.3="Governor: <b>" + data.scaling_governor + "</b> Active CPU cores: <b>" + data.cpu_count + "</b> Vcore: <b>" + data.vcorevoltage + "V</b>"
|
||||
web.status.1.content.1.line.4="GPU frequency: <b>" + data.gpu_frequency + " MHz</b> GPU voltage: <b>" + data.gpuvoltage + "V</b>"
|
||||
|
||||
web.status.1.content.2.name=Temperature
|
||||
web.status.1.content.2.icon=cpu_temp.png
|
||||
web.status.1.content.2.line.1=JustGageBar("CPU", "°C",0, data.soctemp , 100,100,80,percentColors,50,70)+" "+JustGageBar("GPU", "°C",0, data.gputemp , 100,100,80,percentColors,50,70)+" "+JustGageBar("PMIC", "°C",0, data.pmictemp , 100,100,80,percentColors,60,80)+" "+JustGageBar("Cooling State", "",0, data.coolingstate , 7,100,80,percentColors,1,2)
|
||||
|
||||
web.status.1.content.3.name=Battery
|
||||
web.status.1.content.3.icon=pmu.png
|
||||
web.status.1.content.3.line.1=JustGageBar("Battery capacity", "%", 0, data.batterycapacity, 100,100,80,percentColors,100,100)+" "+JustGageBar("Battery voltage", "V", 0, data.batteryvoltage, 5,100,80,percentColors,100,100)+" "+JustGageBar("Battery current", "A", -3, data.batterycurrent, 3,100,80,percentColors,100,100)+" "+JustGageBar("Battery drain", "W", 0, data.batterydrain, 15,100,80,percentColors,6,9)
|
||||
|
||||
web.statistics.1.content.1.name=Load / Clockspeeds / Temperature
|
||||
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=cpu_frequency
|
||||
web.statistics.1.content.1.graph.5=cpu_count
|
||||
web.statistics.1.content.1.graph.6=coolingstate
|
||||
web.statistics.1.content.1.graph.7=soctemp
|
||||
web.statistics.1.content.1.graph.8=vcorevoltage
|
||||
web.statistics.1.content.1.graph.9=batterycapacity
|
||||
web.statistics.1.content.1.graph.10=batteryvoltage
|
||||
web.statistics.1.content.1.graph.11=batterycurrent
|
||||
web.statistics.1.content.1.graph.12=pmictemp
|
||||
web.statistics.1.content.1.graph.13=batterydrain
|
||||
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.cpu_frequency.label=CPU Clock speed (GHz)
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.label=Active CPUs
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.soctemp.label=SoC temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.pmictemp.label=PMIC temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.label=Vcore (V)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.label=Cooling State
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.batterycapacity.label=Battery capacity
|
||||
web.statistics.1.content.1.ds_graph_options.batteryvoltage.label=Battery voltage
|
||||
web.statistics.1.content.1.ds_graph_options.batteryvoltage.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.batterycurrent.label=Battery current
|
||||
web.statistics.1.content.1.ds_graph_options.batterycurrent.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.batterydrain.label=Battery drain
|
||||
web.statistics.1.content.1.ds_graph_options.batterydrain.yaxis=2
|
||||
web.statistics.1.content.1.graph_options.y1axis={ position: "left", min: 35, max: 75 }
|
||||
web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
|
||||
131
external/packages/bsp/orangepimonitor/templates/sun8i_default.conf
vendored
Normal file
131
external/packages/bsp/orangepimonitor/templates/sun8i_default.conf
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
dynamic.1.name=cpu_frequency
|
||||
dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
|
||||
dynamic.1.regexp=(.*)
|
||||
dynamic.1.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.1.rrd=GAUGE
|
||||
|
||||
dynamic.2.name=load1,load5,load15
|
||||
dynamic.2.source=/proc/loadavg
|
||||
dynamic.2.regexp=^(\S+)\s(\S+)\s(\S+)
|
||||
dynamic.2.postprocess=
|
||||
dynamic.2.rrd=GAUGE
|
||||
|
||||
dynamic.3.name=scaling_governor
|
||||
dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
dynamic.3.regexp=(.*)
|
||||
dynamic.3.postprocess=
|
||||
dynamic.3.rrd=
|
||||
|
||||
dynamic.4.name=cpu_count
|
||||
dynamic.4.source=grep -c processor /proc/cpuinfo
|
||||
dynamic.4.regexp=(.*)
|
||||
dynamic.4.postprocess=
|
||||
dynamic.4.rrd=GAUGE
|
||||
|
||||
dynamic.5.name=dram_frequency
|
||||
dynamic.5.source=/sys/devices/platform/sunxi-ddrfreq/devfreq/sunxi-ddrfreq/cur_freq
|
||||
dynamic.5.regexp=(.*)
|
||||
dynamic.5.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.5.rrd=GAUGE
|
||||
|
||||
dynamic.6.name=soctemp
|
||||
dynamic.6.source=/etc/orangepimonitor/datasources/soctemp
|
||||
dynamic.6.regexp=(.*)
|
||||
dynamic.6.postprocess=
|
||||
dynamic.6.rrd=GAUGE
|
||||
|
||||
dynamic.7.name=externaltemp
|
||||
dynamic.7.source=/tmp/externaltemp
|
||||
dynamic.7.regexp=(.*)
|
||||
dynamic.7.postprocess=sprintf("%.1f", $1/1000)
|
||||
dynamic.7.rrd=GAUGE
|
||||
|
||||
dynamic.8.name=disktemp
|
||||
dynamic.8.source=/tmp/disktemp
|
||||
dynamic.8.regexp=(.*)
|
||||
dynamic.8.postprocess=sprintf("%.1f", $1/1000)
|
||||
dynamic.8.rrd=GAUGE
|
||||
|
||||
dynamic.9.name=vcorevoltage
|
||||
dynamic.9.source=/tmp/VCore
|
||||
dynamic.9.regexp=(.*)
|
||||
dynamic.9.postprocess=sprintf("%.2f", $1/1000)
|
||||
dynamic.9.rrd=GAUGE
|
||||
|
||||
dynamic.10.name=cpu_stat,system_stat,user_stat,nice_stat,iowait_stat,irq_stat
|
||||
dynamic.10.source=/tmp/cpustat
|
||||
dynamic.10.regexp=^(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)
|
||||
dynamic.10.postprocess=
|
||||
dynamic.10.rrd=GAUGE
|
||||
|
||||
dynamic.11.name=coolingstate
|
||||
dynamic.11.source=/sys/devices/virtual/thermal/cooling_device0/cur_state
|
||||
dynamic.11.regexp=(.*)
|
||||
dynamic.11.postprocess=
|
||||
dynamic.11.rrd=GAUGE
|
||||
|
||||
dynamic.12.name=cpuminer
|
||||
dynamic.12.source=/tmp/khash
|
||||
dynamic.12.regexp=(.*)
|
||||
dynamic.12.postprocess=
|
||||
dynamic.12.rrd=GAUGE
|
||||
|
||||
web.status.1.content.1.name=CPU
|
||||
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 total: <b>" + data.cpu_stat + "%</b> (Sys: " + data.system_stat + "%, User: " + data.user_stat + "%, I/O wait: " + data.iowait_stat + "%, Nice: " + data.nice_stat + "%)"
|
||||
web.status.1.content.1.line.3="CPU frequency: <b>" + data.cpu_frequency + "GHz</b> DRAM frequency: <b>" + data.dram_frequency + "GHz</b>"
|
||||
web.status.1.content.1.line.4="Governor: <b>" + data.scaling_governor + "</b> Active CPU cores: <b>" + data.cpu_count + "</b> Vcore: <b>" + data.vcorevoltage + "</b>"
|
||||
|
||||
web.status.1.content.3.name=Temperature
|
||||
web.status.1.content.3.icon=cpu_temp.png
|
||||
web.status.1.content.3.line.1=JustGageBar("SoC", "°C",0, data.soctemp , 100,100,80,percentColors,50,70)+" "+JustGageBar("Disk", "°C",0, data.disktemp , 100,100,80,percentColors,40,50)+" "+JustGageBar("Cooling State", "",0, data.coolingstate , 5,100,80,percentColors,1,2)
|
||||
|
||||
web.statistics.1.content.1.name=Load / Clockspeeds / Temperature
|
||||
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=cpu_frequency
|
||||
web.statistics.1.content.1.graph.5=dram_frequency
|
||||
web.statistics.1.content.1.graph.6=cpu_count
|
||||
web.statistics.1.content.1.graph.7=soctemp
|
||||
web.statistics.1.content.1.graph.8=vcorevoltage
|
||||
web.statistics.1.content.1.graph.9=disktemp
|
||||
web.statistics.1.content.1.graph.10=cpu_stat
|
||||
web.statistics.1.content.1.graph.11=coolingstate
|
||||
web.statistics.1.content.1.graph.12=cpuminer
|
||||
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.cpu_frequency.label=CPU Clock speed (GHz)
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.dram_frequency.label=DRAM Clock speed (GHz)
|
||||
web.statistics.1.content.1.ds_graph_options.dram_frequency.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.label=Active CPUs
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.soctemp.label=SoC temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.cpuminer.label=khash/s
|
||||
web.statistics.1.content.1.ds_graph_options.cpuminer.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.disktemp.label=Disk temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.label=Vcore (V)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.label=Cooling State
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_stat.label=CPU total (%)
|
||||
web.statistics.1.content.1.graph_options.y1axis={ position: "left", min: 35, max: 75 }
|
||||
web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
|
||||
|
||||
web.statistics.1.content.2.name=Detailed CPU Stats
|
||||
web.statistics.1.content.2.graph.1=cpu_stat
|
||||
web.statistics.1.content.2.graph.2=system_stat
|
||||
web.statistics.1.content.2.graph.3=user_stat
|
||||
web.statistics.1.content.2.graph.4=nice_stat
|
||||
web.statistics.1.content.2.graph.5=iowait_stat
|
||||
web.statistics.1.content.2.graph.6=irq_stat
|
||||
web.statistics.1.content.2.ds_graph_options.cpu_stat.label=CPU total (%)
|
||||
web.statistics.1.content.2.ds_graph_options.system_stat.label=System (%)
|
||||
web.statistics.1.content.2.ds_graph_options.user_stat.label=User (%)
|
||||
web.statistics.1.content.2.ds_graph_options.nice_stat.label=Nice (%)
|
||||
web.statistics.1.content.2.ds_graph_options.iowait_stat.label=I/O wait (%)
|
||||
web.statistics.1.content.2.ds_graph_options.irq_stat.label=IRQ/softirq (%)
|
||||
web.statistics.1.content.2.graph_options.y1axis={ position: "left", min: 0, max: 100 }
|
||||
125
external/packages/bsp/orangepimonitor/templates/sun8i_dev.conf
vendored
Normal file
125
external/packages/bsp/orangepimonitor/templates/sun8i_dev.conf
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
dynamic.1.name=cpu_frequency
|
||||
dynamic.1.source=/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
|
||||
dynamic.1.regexp=(.*)
|
||||
dynamic.1.postprocess=sprintf("%.3f", $1/1000000)
|
||||
dynamic.1.rrd=GAUGE
|
||||
|
||||
dynamic.2.name=load1,load5,load15
|
||||
dynamic.2.source=/proc/loadavg
|
||||
dynamic.2.regexp=^(\S+)\s(\S+)\s(\S+)
|
||||
dynamic.2.postprocess=
|
||||
dynamic.2.rrd=GAUGE
|
||||
|
||||
dynamic.3.name=scaling_governor
|
||||
dynamic.3.source=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
dynamic.3.regexp=(.*)
|
||||
dynamic.3.postprocess=
|
||||
dynamic.3.rrd=
|
||||
|
||||
dynamic.4.name=cpu_count
|
||||
dynamic.4.source=grep -c processor /proc/cpuinfo
|
||||
dynamic.4.regexp=(.*)
|
||||
dynamic.4.postprocess=
|
||||
dynamic.4.rrd=GAUGE
|
||||
|
||||
dynamic.6.name=soctemp
|
||||
dynamic.6.source=/etc/orangepimonitor/datasources/soctemp
|
||||
dynamic.6.regexp=(.*)
|
||||
dynamic.6.postprocess=sprintf("%.1f", $1/1000)
|
||||
dynamic.6.rrd=GAUGE
|
||||
|
||||
dynamic.7.name=externaltemp
|
||||
dynamic.7.source=/tmp/externaltemp
|
||||
dynamic.7.regexp=(.*)
|
||||
dynamic.7.postprocess=sprintf("%.1f", $1/1000)
|
||||
dynamic.7.rrd=GAUGE
|
||||
|
||||
dynamic.8.name=disktemp
|
||||
dynamic.8.source=/tmp/disktemp
|
||||
dynamic.8.regexp=(.*)
|
||||
dynamic.8.postprocess=sprintf("%.1f", $1/1000)
|
||||
dynamic.8.rrd=GAUGE
|
||||
|
||||
dynamic.9.name=vcorevoltage
|
||||
dynamic.9.source=/tmp/VCore
|
||||
dynamic.9.regexp=(.*)
|
||||
dynamic.9.postprocess=sprintf("%.2f", $1/1000)
|
||||
dynamic.9.rrd=GAUGE
|
||||
|
||||
dynamic.10.name=cpu_stat,system_stat,user_stat,nice_stat,iowait_stat,irq_stat
|
||||
dynamic.10.source=/tmp/cpustat
|
||||
dynamic.10.regexp=^(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)
|
||||
dynamic.10.postprocess=
|
||||
dynamic.10.rrd=GAUGE
|
||||
|
||||
dynamic.11.name=coolingstate
|
||||
dynamic.11.source=/sys/devices/virtual/thermal/cooling_device0/cur_state
|
||||
dynamic.11.regexp=(.*)
|
||||
dynamic.11.postprocess=
|
||||
dynamic.11.rrd=GAUGE
|
||||
|
||||
dynamic.12.name=cpuminer
|
||||
dynamic.12.source=/tmp/khash
|
||||
dynamic.12.regexp=(.*)
|
||||
dynamic.12.postprocess=
|
||||
dynamic.12.rrd=GAUGE
|
||||
|
||||
web.status.1.content.1.name=CPU
|
||||
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 total: <b>" + data.cpu_stat + "%</b> (Sys: " + data.system_stat + "%, User: " + data.user_stat + "%, I/O wait: " + data.iowait_stat + "%, Nice: " + data.nice_stat + "%)"
|
||||
web.status.1.content.1.line.3="CPU frequency: <b>" + data.cpu_frequency + "GHz</b> DRAM frequency: <b>Not available</b>"
|
||||
web.status.1.content.1.line.4="Governor: <b>" + data.scaling_governor + "</b> Active CPU cores: <b>" + data.cpu_count + "</b> Vcore: <b>" + data.vcorevoltage + "</b>"
|
||||
|
||||
web.status.1.content.3.name=Temperature
|
||||
web.status.1.content.3.icon=cpu_temp.png
|
||||
web.status.1.content.3.line.1=JustGageBar("SoC", "°C",0, data.soctemp , 100,100,80,percentColors,50,70)+" "+JustGageBar("Disk", "°C",0, data.disktemp , 100,100,80,percentColors,40,50)+" "+JustGageBar("Cooling State", "",0, data.coolingstate , 5,100,80,percentColors,1,2)
|
||||
|
||||
web.statistics.1.content.1.name=Load / Clockspeeds / Temperature
|
||||
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=cpu_frequency
|
||||
web.statistics.1.content.1.graph.5=dram_frequency
|
||||
web.statistics.1.content.1.graph.6=cpu_count
|
||||
web.statistics.1.content.1.graph.7=soctemp
|
||||
web.statistics.1.content.1.graph.8=vcorevoltage
|
||||
web.statistics.1.content.1.graph.9=disktemp
|
||||
web.statistics.1.content.1.graph.10=cpu_stat
|
||||
web.statistics.1.content.1.graph.11=coolingstate
|
||||
web.statistics.1.content.1.graph.12=cpuminer
|
||||
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.cpu_frequency.label=CPU Clock speed (GHz)
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_frequency.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.dram_frequency.label=DRAM Clock speed (GHz)
|
||||
web.statistics.1.content.1.ds_graph_options.dram_frequency.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.label=Active CPUs
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_count.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.soctemp.label=SoC temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.cpuminer.label=khash/s
|
||||
web.statistics.1.content.1.ds_graph_options.cpuminer.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.disktemp.label=Disk temp (°C)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.label=Vcore (V)
|
||||
web.statistics.1.content.1.ds_graph_options.vcorevoltage.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.label=Cooling State
|
||||
web.statistics.1.content.1.ds_graph_options.coolingstate.yaxis=2
|
||||
web.statistics.1.content.1.ds_graph_options.cpu_stat.label=CPU total (%)
|
||||
web.statistics.1.content.1.graph_options.y1axis={ position: "left", min: 35, max: 75 }
|
||||
web.statistics.1.content.1.graph_options.y2axis={ position: "right" }
|
||||
|
||||
web.statistics.1.content.2.name=Detailed CPU Stats
|
||||
web.statistics.1.content.2.graph.1=cpu_stat
|
||||
web.statistics.1.content.2.graph.2=system_stat
|
||||
web.statistics.1.content.2.graph.3=user_stat
|
||||
web.statistics.1.content.2.graph.4=nice_stat
|
||||
web.statistics.1.content.2.graph.5=iowait_stat
|
||||
web.statistics.1.content.2.graph.6=irq_stat
|
||||
web.statistics.1.content.2.ds_graph_options.cpu_stat.label=CPU total (%)
|
||||
web.statistics.1.content.2.ds_graph_options.system_stat.label=System (%)
|
||||
web.statistics.1.content.2.ds_graph_options.user_stat.label=User (%)
|
||||
web.statistics.1.content.2.ds_graph_options.nice_stat.label=Nice (%)
|
||||
web.statistics.1.content.2.ds_graph_options.iowait_stat.label=I/O wait (%)
|
||||
web.statistics.1.content.2.ds_graph_options.irq_stat.label=IRQ/softirq (%)
|
||||
web.statistics.1.content.2.graph_options.y1axis={ position: "left", min: 0, max: 100 }
|
||||
Reference in New Issue
Block a user