The eGeoffrey Controller
The eGeoffrey controller manages the configuration of all the modules and coordinates sensors and run alerting rules.
The controller itself is logically split in different modules:
controller/alerter
: keep running the configured rules which would trigger notificationscontroller/chatbot
: interactive chatbot servicecontroller/config
: stores configuration files on behalf of all the modules and makes them availablecontroller/db
: connects to the database and runs queries on behalf of other modulescontroller/hub
: hub for collecting new measures from sensorscontroller/logger
: takes care of collecting the logs from all the local and remote modules, storing them in the database and printing them out
Each module may required a configuration file whose content is detailed on https://github.com/egeoffrey/egeoffrey-controller
API
Each controller module interacts with any other module through the message bus, despite where it resides; for this reason a structured communication protocol has been developed. A user doesn't need to know anything about it since hidden under the hood. Even a developer doesn't need to get into these details since the SDK is taking care of this low level communication.
For each module, the main <command>
and their purposes will be listed below for both inbound and outbound requests (for the latter the recipient module is also listed):
controller/alerter
:- inbound:
RUN/<rule_id>
: run manually a given rule
- outbound:
controller/db
-GET*/<sensor_id>
: request the database for sensors' datacontroller/hub
-SET/<sensor_id>
: set the value to a sensor as an action to execute when a rule triggercontroller/hub
-POLL/<sensor_id>
: poll the sensor for a new value as an action to execute when a rule triggercontroller/alerter
-RUN/<sensor_id>
: action to execute when a rule triggercontroller/db
SAVE_ALERT/<severity>
: save notification to db*/*
-NOTIFY/<severity>/<rule_id>
: notify output modulescontroller/db
-PURGE_ALERTS
: periodically purge old alerts from db
- inbound:
controller/chatbot
:- inbound:
ASK
: receive request from other modules
- outbound:
controller/alerter
-RUN/<rule_id>
: run a rulecontroller/db
-GET/<sensor_id>
: request value of a sensor to the database
- inbound:
controller/config
:- inbound:
SAVE/<config_id>
: save a new/updated configuration fileDELETE/<config_id>
: delete a configuration file
- inbound:
controller/db
:- inbound:
SAVE/<sensor_id>
: save a new measure for a sensorSAVE_ALERT/<severity>
: save a new alertCALC_HOUR_STATS/<sensor_id>
: calculate hourly aggregated statsCALC_DAY_STATS/<sensor_id>
: calculate daily aggregated statsPURGE_SENSOR/<sensor_id>
: delete old measures from dbPURGE_ALERTS
: purge old alerts from dbDELETE_SENSOR/<sensor_id>
: delete from the db the data associated to a sensorGET/<sensor_id>
: return measures from the dbGET_ELAPSED/<sensor_id>
: return the elapsed time since the measure was takenGET_TIMESTAMP/<sensor_id>
: return the timestamp of the measureGET_DISTANCE/<sensor_id>
: return the distance from the measureGET_POSITION_LABEL/<sensor_id>
: return the label associated to a positionGET_POSITION_TEXT/<sensor_id>
: return the text associated to the positionGET_SCHEDULE/<sensor_id>
: return the schedule of a calendar data formatGET_COUNT/<sensor_id>
: return the number of measures of a given timeframe
- outbound:
*/*
-SAVED/<sensor_id>
: notify everybody a new measure has been saved
- inbound:
controller/hub
:- inbound:
IN/<sensor_id>
: receive a new value from a sensor (solicited or unsolicited) coming from the associated servicePOLL/<sensor_id>
: requested to invoke the service associated to the sensorSET/<sensor_id>
: asked to set a new value to a sensor
- outbound:
service/<service_name>
-IN/<sensor_id>
: invoke the service associated to a sensor to pull out a new valueservice/<service_name>
-OUT/<sensor_id>
: trigger an action to an actuatorcontroller/db
-CALC_HOUR_STATS/<sensor_id>
/CALC_DAY_STATS/<sensor_id>
: periodically calculate aggregatescontroller/db
-PURGE_SENSOR/<sensor_id>
: periodically purge old datacontroller/db
-SAVE/<sensor_id>
: save new measures
- inbound:
controller/logger
:- inbound:
LOG/<severity>
: receive new log messages from all the modules
- inbound:
Advanced Settings
The following additional environment variables can control specific advanced settings:
EGEOFFREY_DATABASE_HOSTNAME
: override the database hostname from the configuration fileEGEOFFREY_DATABASE_PORT
: override the database port from the configuration fileEGEOFFREY_DATABASE_NAME
: override the database name/number from the configuration fileEGEOFFREY_DATABASE_USERNAME
: override the database username from the configuration fileEGEOFFREY_DATABASE_PASSWORD
: override the database password from the configuration fileEGEOFFREY_CONFIG_DIR
: override the directory where the configuration resides (default toconfig
)EGEOFFREY_CONFIG_FORCE_RELOAD
: force realoading the configuration from the filesystem (default to0
)EGEOFFREY_CONFIG_FORCE_RELOAD_TIMEOUT
: when reloading the configuraiton, for how many seconds waiting for the old settings already in the bus to clear up (default to10
)EGEOFFREY_CONFIG_ACCEPT_DEFAULTS
: accept default configuration files provided by other packages in the manifest file (default to1
)