mO SharemO Share

Support Cheat Sheet

Check the serial of a facility:
-Login with system/admin
-Execute:  grep serial /opt/azeti/SiteController/config/SiteController.cfg  

Do a security copy of the configuration before touching it:
cp /opt/azeti/SiteController/config/SiteController.cfg /opt/azeti/SiteController/config/SiteController.cfg.backup
Restoring the copy of the configuration if things does not seem to work:
cp /opt/azeti/SiteController/config/SiteController.cfg.backup /opt/azeti/SiteController/config/SiteController.cfg
Show hostname in the linux interface:
cat /etc/hostname

Edit the serial of a facility:
vi /opt/azeti/SiteController/config/SiteController.cfg
Some vi commands: 
press <esc> to start any command
"i" for editing
Change what you want to change
<esc>:wq  To write and exit
<esc>:q!  To exit without saving anything
<esc>dd  To delete the line where you have the cursor
Restart Site Controller:
/opt/azeti/SiteController/run_SiteController.py restart
Check status of Site Controller:
/opt/azeti/SiteController/run_SiteController.py status
Start Site Controller:
/opt/azeti/SiteController/run_SiteController.py start
Stop Site Controller:
/opt/azeti/SiteController/run_SiteController.py stop
Start a module of Site Controller:
Eg: Modbus
/opt/azeti/SiteController/run_SiteController.py start  ModbusMaster.py
Stop a single module of Site Controller:
Eg: Modbus
/opt/azeti/SiteController/run_SiteController.py stop  ModbusMaster.py
Check if a template is there and read it:
ls -la /opt/azeti/SiteController/config/sensor_config.xml
cat /opt/azeti/SiteController/config/sensor_config.xml
Check mosquitto configuration:
#Note: showing the right parameters for a IR910
# cat /opt/azeti/SiteController/config/SiteController.cfg | grep mosquitto
mosquitto_folder = /mnt/apps
mosquitto_cfg_folder = /mnt/apps/etc/mosquitto
Please note: If you search for mosquitto (Command is: "find / -name mosquitto") it is displaying multiple occourences of mosquitto on the system. Since it is only searching for the string "mosquitto", it also displays stuff, that we do not care about. For example find is also displaying "/mnt/apps/mosquitto/sbin/mosquitto" - this is a executable of mosquitto. We only have to tell the SiteController, in which directory the mosquitto-stuff is placed. So instead of "/mnt/apps/mosquitto/sbin/mosquitto", we can tell the system to look under "/mnt/apps/mosquitto", because the SC automatically appends "/sbin/mosquitto" to find the executable. This is mentioned here, because it is one of the most frequent misconfigurations done by customers.

Read the log of a module live:

# tail -f /opt/azeti/SiteController/log/ModbusMaster.log
Modbus operations
CE-AD81-34N3-0.2/ 0-10V
modpoll_ex -p none -b 9600 -t 4 -a 8 -0 -r 16 -s 1  -c  12  /dev/ttyUSB1
Modbus fuel sensor
modpoll_ex -a 1 -b 9600 -d 8 -p none -s 1 -t 4 -0 -o 3 -1 -r 01  -c 10 10.0.0.211
CE_AU11_DC_Voltagemeter (RTU)
modpoll_ex -a 7 -b9600 -d 8 -p none -0 -r 16 -t 4 -s 1 -c 1 /dev/ttyUSB1



Modbus daemon configuration
COM1
COM2
/dev/ttyUSB1
/dev/ttyUSB0
daemon_id 0
daemon_id 1
Check for libraries:
PYTHONPATH=/mnt/data/azeti/SiteController/lib/lib/python2.7/site-packages /mnt/data/azeti/SiteController/src/test_lib_installed.py
Know the real IP from a site connected to the broker:
Go to the broker server (172.16.69.4)
$cat output.txt | grep PAUL (if the serial of the system is PAUL - modify accordingly!)
If it is not there: script to re-search
$./checkRange.sh
Error while starting mosquitto:
Starting mosquitto ...
Traceback (most recent call last):
  File "/opt/azeti/SiteController/run_SiteController.py", line 1540, in <module>
    exit_code = main(sys.argv)
  File "/opt/azeti/SiteController/run_SiteController.py", line 1499, in main
    start_mosquitto()
  File "/opt/azeti/SiteController/run_SiteController.py", line 1026, in start_mosquitto
    '-d'])
  File "/opt/azeti/SiteController/run_SiteController.py", line 707, in start_submodule
    LOGGER.exception('Exception while trying to run command "%s":' % cmd)
AttributeError: 'NoneType' object has no attribute 'exception'
This means: mosquitto could not start. Probably due to path to mosquitto. (See above Check mosquitto configuration)
Configuration of fuel tank parameters:
Retrieve a log file from a site
Normally you do not have direct access from your computer to the site, so you need to execute a command to retrieve the file: scp
#scp system@10.202.0.15:/opt/azeti/SiteController/log/ModbusMaster.log .
Check the available disk space on the system
# df -h
Filesystem                Size      Used Available Use% Mounted on
ubi0:rootfs             105.5M     35.0M     70.5M  33% /
devtmpfs                502.4M         0    502.4M   0% /dev
tmpfs                   502.5M         0    502.5M   0% /dev/shm
tmpfs                   256.0M      5.0M    251.0M   2% /tmp
none                      4.0K         0      4.0K   0% /sys/fs/cgroup
ubi1_0                  105.9M     72.0K    101.1M   0% /opt
ubi2_0                  218.4M     32.5M    181.2M  15% /mnt/apps
ubi3_0                    1.2G    143.1M      1.0G  12% /mnt/data
Read notifications log in Tomcat:
root@azetidigicel3:/var/log/tomcat8# tail -f azeti_notifications.log
Fake event Generation_Voltage:
Digicel/events/NATIONAL-CHEST-HOSPITAL/Generator_Voltage
CRITICAL
[
    {
        "hd": [
            {
                "processing_level": 0,
                "sensor_id": "Generator_Voltage",
                "timestamp": "2016-03-18T08:41:44.862Z-0500",
                "value": 99.099999999999994
            }
        ],
        "output": "eval based on 99.1",
        "sensor_id": "Generator_Voltage",
        "severity": 200,
        "state": "CRITICAL",
        "timestamp": "2016-03-18T08:41:44.939Z-0500"
    }
]
RUNNING
[
    {
        "hd": [
            {
                "processing_level": 0,
                "sensor_id": "Generator_Voltage",
                "timestamp": "2016-03-18T08:41:45.858Z-0500",
                "value": 115.0
            }
        ],
        "output": "eval based on 115.0",
        "sensor_id": "Generator_Voltage",
        "severity": 100,
        "state": "RUNNING",
        "timestamp": "2016-03-18T08:41:45.938Z-0500"
    }
]
STOPPED
[
    {
        "hd": [
            {
                "processing_level": 0,
                "sensor_id": "Generator_Voltage",
                "timestamp": "2016-03-18T08:41:57.860Z-0500",
                "value": 0.0
            }
        ],
        "output": "eval based on 0.0",
        "sensor_id": "Generator_Voltage",
        "severity": 0,
        "state": "STOPPED",
        "timestamp": "2016-03-18T08:41:57.936Z-0500"
    }
]
Simulate cloud_connected
Digicel/events/NATIONAL-CHEST-HOSPITAL/cloud_connected
[
    {
        "hd": [],
        "output": "Location connected...",
        "sensor_id": "cloud_connected",
        "severity": 0,
        "state": "CONNECTED",
        "timestamp": "2016-03-18T00:20:22.877Z-0500"
    }
]
Mosquitto topics:

Note:

topics in communication to and from external cloud broker (currently cloud/#hd/#sys_msg/#events/# and imgdata/#) may be required to be prefixed with the organization short name to allow an organization based autorization scheme, like so: azeti/cloud/#.

topic
description
retained
qos
related modules
calibrated_result/<sensor_id>generated by certain modules but almost the RawResultDemuxyes  
cloud/<sys_id>/exec_action/<action_id>command from the cloud to execute the specified actionno Actuatormodules like ModbusD or snmpgetd
cloud/<sys_id>/jobsreception of jobs from the cloudno JobProcessor
command/persistord/   persistord
commandresult/persistord/   persistord
config/action/<action_id> yes Actuatormodules
config/completeThe complete configuration (sensors, devices,actions,rules) as XML (retrieve from SC (subscribe))yes ConfigProvider
config/complete_updateThe complete configuration (sensors, devices,actions,rules) as XML to the SiteController (publish to)yes ConfigProvider
config/device/<device_id> yes  
config/module/<module_name>/[complete|update] yes  
config/rule/<rule_id> yes AutomationController
config/sensor/<sensor_id> yes  
events/<sys_id>/<sensor_id>generated by certain modules but almost the CalibResultsEvaluator, sent to cloud and partially to ACno cloud, AutomationController
hd/<sys_id>uncompressed historical data sent to the cloud

no, internal

yes, external

0

1

HD2CloudExporter, cloudConnector

cloudConnector, cloud

hd/<sys_id>/application/gzip

events/<sys_id>/application/gzip

compressed historical data sent to the cloud

no, internal

yes, external

0

1

HD2CloudExporter, cloudConnector

cloudConnector, cloud

imgdata/<sys_id>/<device_id>Image data, combined with description in a tar (SC-258)no http_server, cloudConnector, data_store
jobs/access_list_updatesimple job, forwarded by the JobProcessorno JobProcessor, VS_access_control
jobs/dynamic_HD_subscriptionsimple job, forwarded by the JobProcessorno 

JobProcessor, HD2CloudExporter, data_store

jobs/remote_execsimple job, executes a preconfigured shell command on SiteControllerno JobProcessor
module/<module_name>/command

example: The topic module/modbusd/command with payload statsgets returned with

the topic module/modbusd/command/reply with statistics as payload

  cloudConnector, data_store, modbusd
module/<module_name>/last_published_timestamp   HD2CloudExporter
module/state/<module_name>A module sends the internal state, useful for a better organized system startyes InternalStates, run_SiteController, Watchdog
module/state/requestWatchdog requests the states of the modules, no payload. The modules answer via InternalStatesyes Watchdog, InternalStates
raw_result/<sensor_gateway_id>generated by data acquisition modules like ModbusDyes RawResultDemux
sc/configask Matthias   
sys_msg/<sys_id>class sys_msg is defined in result.py, destination of the message is the cloud.  jobs_updateConfig, result, cloud, actuatormodules, watchdog
vs_data/<sensor_id>

specific data for a virtual sensor (currenty used by the VS to hold data during a restart).

These data should be stored in a database (persistord/data_store) and re-published if not available

on mosquitto.

yes 

VS_access_control, VS_battery_details

 

persistord, (data_store)


Username/password test systems
system/admin
To reboot a Cisco-device:
#reboot
To stop a Cisco-device:
#halt