EmonPiFileSystem.md

September 24, 2020 · View on GitHub

EmonCMS file system

EMONCMS_WWW/var/www/emoncmslocation of the core package and of the main modules (admin, dashboards, config)
EMONCMS_DATADIR/var/opt/emoncmstimeseries database directories
EMONCMS_DIR/opt/emoncmslocation of symlinked modules (postprocess, sync) and of uploaded tar.gz archives when importing a backup
OPENENERGYMONITOR_DIR/opt/openenergymonitorlocation of EmonScripts, emonhub and of created backup archives
EMONCMS_LOG_LOCATION/var/log/emoncmslog location for emoncms logs
emoncms.log is main emoncms log, managed with the EmonLogger PHP class

main dependencies

web serverApache2
relational databasesmysql or maria
key:value databaseredis-serverdata buffering for timeseries and backgroud processing for service-runner
message brokermosquitto
data engine languagephp with extensionspear (for pecl needs)
mysql
gd dev, common
mbstring
redis
mosquitto (https://github.com/mgdm/Mosquitto-PHP)
curl

EmonCMS systemd services

all systemd services have to be symlinked in /etc/systemd/system

emoncms_mqtt.service -> /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.service
emonhub.service -> /opt/openenergymonitor/emonhub/service/emonhub.service
feedwriter.service -> /var/www/emoncms/scripts/services/feedwriter/feedwriter.service
service-runner.service -> /var/www/emoncms/scripts/services/service-runner/service-runner.service

MariaDB and Redis services are in lib/systemd/system, but they are compiled...

mysqld.service -> /lib/systemd/system/mariadb.service
mysql.service -> /lib/systemd/system/mariadb.service
redis.service -> /lib/systemd/system/redis-server.service
phpmqtt input (PHP)listen to payloads published to the mosquitto broker on topic emon
scriptpathEMONCMS_WWW/scripts/services/emoncms_mqtt/emoncms_mqtt.php
ServicepathEMONCMS_WWW/scripts/services/emoncms_mqtt/emoncms_mqtt.service
globalslog,log , mysqli, redis,redis, user, feedsettings,feed_settings, mqtt_server mqttsettings,mqttsettings, mqtt_client,
feed,feed, input, $process
non globalsconnected,connected, subscribed, lastretry,last_retry, last_heartbeat, $count
loguses emoncms main log file
journalctl -f -u emoncms_mqtt
specific conf fileno
feedwriter (PHP)writes input data from redis-buffer to disk in order to feed the timeseries database
scriptpathEMONCMS_WWW/scripts/feedwriter.php
ServicepathEMONCMS_WWW/scripts/services/feedwriter/feedwriter.service
globalslog,log, feed_settings, mysqli,mysqli, redis
user,user, feed
loguses emoncms main log file
journalctl -f -u feedwriter
specific conf fileno
Service-runner (Python)trigger background workers from modules (update, backup, sync, postprocess)
scriptpathEMONCMS_WWW/scripts/services/service-runner/service-runner.py
ServicepathEMONCMS_WWW/scripts/services/service-runner/service-runner.service
loguses systemd log file
journalctl -f -u service-runner
specific conf fileno
emonhub (Python)listen on serial port or ethernet and publish to mosquitto broker topic emon
scriptpathOPENENERGYMONITOR_DIR/emonhub/src/emonhub.py
ServicepathOPENENERGYMONITOR_DIR/service/emonhub.service
loglog file is in /var/log/emonhub
journalctl -u emonhub -n 30 –no-pager
specific conf file/etc/emonhub/emonhub.conf
/etc/emonhub/emonhub.env
emonPiLCD (Python)manages the emonpi LCD screen
scriptpathOPENENERGYMONITOR_DIR/emonpi/lcd/emonPiLCD.py
ServicepathOPENENERGYMONITOR_DIR/emonpi/lcd/emonPiLCD.service
loglog file is in /var/log/emonpilcd
journalctl -u emonPiLCD
specific conf fileno

EmonCMS modules

adminmodule integrated into the core package - does not have its own git repo
placeEMONCMS_WWW/Modules/admin
globalsmysqli,mysqli,session,route,route,updatelogin,allowemonpiadmin,allow_emonpi_admin, redis, openenergymonitordir,openenergymonitor_dir, admin_show_update, path<br>path <br> log, loglocation,log_location, log_enabled, $log_level
background workersnone
loguses emoncms main log file
specific conf fileno
configweb interface to supervise and configure emonhub
placeEMONCMS_WWW/Modules/config
globalsroute,route, session, redis,redis, homedir
non globalsemonhubconfigfile,emonhub_config_file, emonhub_logfile, restartlog<br>Alsoinmodel:restart_log<br> Also in model : logfile, configfile,config_file, restart_log_name
background workersrestart.sh
log/var/log/emoncms/emonhub-restart.log
specific conf fileno
dashboardDashboard Module
placeEMONCMS_WWW/Modules/dashboard
globalsmysqli,mysqli, session, route,route, path
background workersno
logno
specific conf fileno
graphmain graph module with averaging on the fly
placeEMONCMS_WWW/Modules/graph
globalssession,session,route,mysqli,mysqli,redis, $path
background workersno
logno
specific conf fileno
backupimport/export all timeseries+mysql database
placeEMONCMS_DIR/modules/backup
globalsroute,route, session, path,path, redis, linkedmodulesdir,linked_modules_dir, log_location
background workersemoncms-import.sh
emoncms-export.sh
emoncms-copy.sh ?
service-runner bash file why ? All things related to service-runner are in controller
logEMONCMS_LOG_LOCATION/exportbackup.log
EMONCMS_LOG_LOCATION/importbackup.log
specific conf fileconfig.cfg which has to be set up during installation
syncconnect to distant EmonCMS machines to retrieve feeds
IOT flavoured alternative to backup
placeEMONCMS_DIR/modules/sync
globalslinkedmodulesdir,linked_modules_dir,path,session,session,route
mysqli,mysqli,redis,user,user,feed_settings,loglocation<br>log_location<br> log in model
background workersemoncms-sync.sh launching sync_run.php in CLI
logEMONCMS_LOG_LOCATION/sync.log
also uses emoncms main log file
specific conf fileno
postprocesspostprocess feeds - calculation module
placeEMONCMS_DIR/modules/postprocess
globalslinkedmodulesdir,linked_modules_dir,session,route,route,mysqli,redis,redis,feed_settings, $log_location
background workerspostprocess.sh launching postprocess_run.php in CLI
Postprocess_run.php scans the redis postprocessqueue and start process functions
logEMONCMS_LOG_LOCATION/postprocess.log
specific conf fileno