1
0
Fork 0

Getting info of repeater from MMDVM.ini

see config.js
main
Kim Huebel 4 years ago
parent cf76ef5ac3
commit 2d17a365a6

@ -2,7 +2,7 @@
var qrz = 1; var qrz = 1;
// 1 = enable debug in javascript-console, 0 = 0ff // 1 = enable debug in javascript-console, 0 = 0ff
var debug = 0; var debug = 1;
// Set messagecounters for different badge-colors // Set messagecounters for different badge-colors
var warnlevel = 200; var warnlevel = 200;

@ -429,43 +429,11 @@ function getLastHeard(document, event) {
lines.forEach(function(line, index, array) { lines.forEach(function(line, index, array) {
logIt("LogLine: " + line); logIt("LogLine: " + line);
if (!inDashboardBlacklist(line)) { if (!inDashboardBlacklist(line)) {
/*
if (line.indexOf("MMDVMHost") > 0 ) {
mmdvmhost_version = line.substring(line.indexOf("MMDVMHost"));
mmdvmhost_version = mmdvmhost_version.substring(0, mmdvmhost_version.indexOf(" "));
document.getElementById("mmdvmhost_version").innerHTML = mmdvmhost_version;
}
if (line.indexOf("Built") > 0 ) {
built = line.substring(line.indexOf("Built") + 6);
document.getElementById("built").innerHTML = built;
}
*/
if (line.indexOf("description:") > 0 ) { if (line.indexOf("description:") > 0 ) {
modem = line.substring(line.indexOf("description:") + 12); modem = line.substring(line.indexOf("description:") + 12);
document.getElementById("modem").innerHTML = modem; document.getElementById("modem").innerHTML = modem;
} }
if (line.indexOf("Callsign:") > 0 ) {
callsign = line.substring(line.indexOf("Callsign:") + 10);
document.getElementById("callsign").innerHTML = callsign;
}
if (line.indexOf("Id:") > 0 ) {
dmrid = line.substring(line.indexOf("Id:") + 4);
document.getElementById("dmrid").innerHTML = dmrid;
}
if (line.indexOf("RX Frequency:") > 0 ) {
rxqrg = line.substring(line.indexOf("RX Frequency:") + 14, 54);
document.getElementById("rxqrg").innerHTML = getMHZ(rxqrg) + " MHz";
}
if (line.indexOf("TX Frequency:") > 0 ) {
txqrg = line.substring(line.indexOf("TX Frequency:") + 14, 54);
document.getElementById("txqrg").innerHTML = getMHZ(txqrg) + " MHz";
}
txing = false; txing = false;
if (line.indexOf("Talker Alias") < 0 && line.indexOf("Downlink Activate") < 0 && line.indexOf("Preamble CSBK") < 0 && line.indexOf("data header") < 0 && line.indexOf("0000:") < 0 && line.length > 0 && (line.indexOf("received") > 0 || line.indexOf("network watchdog") > 0)) { if (line.indexOf("Talker Alias") < 0 && line.indexOf("Downlink Activate") < 0 && line.indexOf("Preamble CSBK") < 0 && line.indexOf("data header") < 0 && line.indexOf("0000:") < 0 && line.length > 0 && (line.indexOf("received") > 0 || line.indexOf("network watchdog") > 0)) {
if (line.indexOf("received network data") > 0 || line.indexOf("late entry") > 0 || line.indexOf("voice header") > 0 || line.indexOf("received RF header") > 0) { if (line.indexOf("received network data") > 0 || line.indexOf("late entry") > 0 || line.indexOf("voice header") > 0 || line.indexOf("received RF header") > 0) {
@ -731,6 +699,22 @@ function getDapnetMessages(document, event) {
function getSysInfo(document, event) { function getSysInfo(document, event) {
$(document).ready(function() { $(document).ready(function() {
if (event.data.startsWith("HOSTINFO")) {
logIt(event.data);
data = event.data;
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("mmdvmhost_version").innerHTML = data.substring(data.indexOf("mmdvmhost_version:") + 18, data.indexOf(" mmdvmhost_ctime"));
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("built").innerHTML = data.substring(data.indexOf("mmdvmhost_ctime:") + 16, data.indexOf(" callsign"));
data = data.substring(data.indexOf(" callsign") + 1);
document.getElementById("callsign").innerHTML = data.substring(data.indexOf("callsign:") + 9, data.indexOf(" "));
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("dmrid").innerHTML = data.substring(data.indexOf("dmrid:") + 6, data.indexOf(" "));
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("txqrg").innerHTML = getMHZ(data.substring(data.indexOf("txqrg:") + 6, data.indexOf(" "))) + " MHz";
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("rxqrg").innerHTML = getMHZ(data.substring(data.indexOf("rxqrg:") + 6)) + " MHz";
}
if (event.data.startsWith("SYSINFO")) { if (event.data.startsWith("SYSINFO")) {
logIt(event.data); logIt(event.data);
data = event.data; data = event.data;
@ -761,11 +745,7 @@ function getSysInfo(document, event) {
data = data.substring(data.indexOf(" ") + 1); data = data.substring(data.indexOf(" ") + 1);
document.getElementById("disk_free").innerHTML = parseFloat(data.substring(data.indexOf("disk_free:") + 10, data.indexOf(" "))).toFixed(3); document.getElementById("disk_free").innerHTML = parseFloat(data.substring(data.indexOf("disk_free:") + 10, data.indexOf(" "))).toFixed(3);
data = data.substring(data.indexOf(" ") + 1); data = data.substring(data.indexOf(" ") + 1);
document.getElementById("disk_percent_used").innerHTML = data.substring(data.indexOf("disk_percent_used:") + 18, data.indexOf(" ")); document.getElementById("disk_percent_used").innerHTML = data.substring(data.indexOf("disk_percent_used:") + 18);
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("mmdvmhost_version").innerHTML = data.substring(data.indexOf("mmdvmhost_version:") + 18, data.indexOf(" mmdvmhost_ctime"));
data = data.substring(data.indexOf(" ") + 1);
document.getElementById("built").innerHTML = data.substring(data.indexOf("mmdvmhost_ctime:") + 16);
} }
}); });
} }

@ -1 +1 @@
var dashboard_version = "2021-02-07 21:02:58"; var dashboard_version = "2021-02-07 21:49:21";

@ -30,6 +30,8 @@ current_dir = os.getcwd()
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(current_dir + '/logtailer.ini') config.read(current_dir + '/logtailer.ini')
mmdvmhost_config = configparser.ConfigParser()
mmdvmhost_config.read(config['MMDVMHost']['MMDVM_ini'])
dmrids = {} dmrids = {}
# init # init
@ -158,6 +160,15 @@ async def view_log(websocket, path):
else: else:
await asyncio.sleep(0.2) await asyncio.sleep(0.2)
elif path == "/SYSINFO": elif path == "/SYSINFO":
mmdvmhost_version = str(subprocess.Popen(config['MMDVMHost']['MMDVM_bin'] + " -v", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf-8"))
mmdvmhost_ctime = time.ctime(os.path.getmtime(config['MMDVMHost']['MMDVM_bin']))
mmdvmhost_buildtime = datetime.datetime.strptime(mmdvmhost_ctime, "%a %b %d %H:%M:%S %Y")
callsign = mmdvmhost_config['General']['Callsign']
dmrid = mmdvmhost_config['General']['Id']
txqrg = mmdvmhost_config['Info']['TXFrequency']
rxqrg = mmdvmhost_config['Info']['RXFrequency']
await websocket.send("HOSTINFO: mmdvmhost_version:" + mmdvmhost_version + " mmdvmhost_ctime:" + mmdvmhost_ctime + " callsign:" + callsign + " dmrid:" + dmrid + " txqrg:" + txqrg + " rxqrg:" + rxqrg)
await asyncio.sleep(1)
while True: while True:
cpu_temp = "" cpu_temp = ""
temps = psutil.sensors_temperatures() temps = psutil.sensors_temperatures()
@ -188,11 +199,7 @@ async def view_log(websocket, path):
disk_free = str(disk.free / 2**30) disk_free = str(disk.free / 2**30)
disk_percent_used = str(disk.percent) disk_percent_used = str(disk.percent)
mmdvmhost_version = str(subprocess.Popen(config['MMDVMHost']['MMDVM_bin'] + " -v", shell=True, stdout=subprocess.PIPE).stdout.read().decode("utf-8")) await websocket.send("SYSINFO: cputemp:" + cpu_temp + " cpufrg:" + cpufrq + " cpuusage:" + cpu_usage + " cpu_load1:" + cpu_load1 + " cpu_load5:" + cpu_load5 + " cpu_load15:" + cpu_load15 + " ram_total:" + ram_total + " ram_used:" + ram_used + " ram_free:" + ram_free + " ram_percent_used:" + ram_percent_used + " disk_total:" + disk_total + " disk_used:" + disk_used + " disk_free:" + disk_free + " disk_percent_used:" + disk_percent_used)
mmdvmhost_ctime = time.ctime(os.path.getmtime(config['MMDVMHost']['MMDVM_bin']))
mmdvmhost_buildtime = datetime.datetime.strptime(mmdvmhost_ctime, "%a %b %d %H:%M:%S %Y")
await websocket.send("SYSINFO: cputemp:" + cpu_temp + " cpufrg:" + cpufrq + " cpuusage:" + cpu_usage + " cpu_load1:" + cpu_load1 + " cpu_load5:" + cpu_load5 + " cpu_load15:" + cpu_load15 + " ram_total:" + ram_total + " ram_used:" + ram_used + " ram_free:" + ram_free + " ram_percent_used:" + ram_percent_used + " disk_total:" + disk_total + " disk_used:" + disk_used + " disk_free:" + disk_free + " disk_percent_used:" + disk_percent_used + " mmdvmhost_version:" + mmdvmhost_version + " mmdvmhost_ctime:" + mmdvmhost_ctime)
await asyncio.sleep(10) await asyncio.sleep(10)
except ValueError as e: except ValueError as e:

Loading…
Cancel
Save