Create a function that can set the IP and port of the MDAC server that listest to montratec events
Montratec publishes events to a MDAC server. The IP and the port of this server is customized in the "general settings" window of the http gui.
The http gui calls the function setSedacHostAddress, defined in System.php, line 2331. Here the system also sets the ip of the NTP server equals to the MDAC server.
If the daemon is not running, this procedure calls setSettings
in line 2069. Here it sets SQL values on a table. The SQL operations are handled by the DBHandler
class in DBHandler.php
. The SQL database is located in /var/db/fsk2.sqlite
.
The NTP server is set using updateNtpAndSyslogConfig
in line 2318 of System.php and does the following
- writes to
/opt/config/ntp
the string `NTP_HOST='.$ip.' - writes to
/opt/config/syslog
the string'SYSLOGD_EXT_OPTS="-L -R '.$ip.'"
If the daemon is running, this application use the DBUS linux interface to communicate with the montratec daemon.
To list dbus nodes dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
A method to change the MDAC server ip and port remotelly
One possible method is to call the correct dbus message using ssh. Another method is to modify the sql database and reboot.
Per aprire un sql in python
import sqlite3
con = sqlite3.connect('fsk2.sqlite')
cur=con.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type='table';")
print(cur.fetchall())