Getting host-program-version and build-time from progam itself instead of logfile
This commit is contained in:
parent
af1b9bfd53
commit
c926da435d
6 changed files with 28 additions and 10 deletions
|
@ -44,6 +44,7 @@ Actually known:
|
|||
|
||||
### Installation steps
|
||||
* first of all (if not already done by installation of MMDVMHost): create a syetemuser with `sudo adduser --system --no-create-home --group mmdvm`
|
||||
* add following line to /etc/sudoers with `sudo visudo` for getting the logtailer access to MMDVMHost: `www-data ALL=(ALL) NOPASSWD: /usr/local/bin/MMDVMHost`
|
||||
* clone this repository to your home-directory with `git clone --recurse-submodules -j8 https://github.com/dg9vh/MMDVMHost-Websocketboard` to clone the repository with it's submodules
|
||||
* create directory with `sudo mkdir /opt/MMDVMDash`
|
||||
* copy all files from repository into this folder
|
||||
|
@ -63,11 +64,11 @@ Finally you should be able to get the new Dashboard calling the hostname of your
|
|||
|
||||
### Troubleshoting
|
||||
If you have any trouble running the software most things depend on the logtailer-component. So it is a good idea to try starting the software on the console wih
|
||||
`python3 ./logtailer.py` to see the output of the programme. A common error are missing python-libraries you should install with the commands mentioned above.
|
||||
`python3 ./logtailer.py` to see the output of the program. A common error are missing python-libraries you should install with the commands mentioned above.
|
||||
|
||||
If you found any further missing library let me know! Just open an issue!
|
||||
|
||||
If there are problems with paths for logfiles you also could get some impressions with the output of the programme.
|
||||
If there are problems with paths for logfiles you also could get some impressions with the output of the program.
|
||||
|
||||
### If using DMRHost by BrandMeister-Team
|
||||
If you are using the DMRHost as replacement for MMDVMHost you should enable DMR-ID-Lookup within logtailer.ini by setting the corresponding option = 1
|
||||
|
@ -80,7 +81,7 @@ For getting the best user experience it is recommended to configure your MMDVMHo
|
|||
|
||||
`FileRotate=0`
|
||||
|
||||
This results in having only one logfile for each programme and having it rotated by your linux-system with logrotate if configured.
|
||||
This results in having only one logfile for each program and having it rotated by your linux-system with logrotate if configured.
|
||||
|
||||
You should also configure your logtailer.ini with
|
||||
|
||||
|
|
|
@ -255,9 +255,9 @@
|
|||
<li>Free: <span id="disk_free"></span> GB</li>
|
||||
<li>Usage: <span id="disk_percent_used"></span> %</li>
|
||||
</ul>
|
||||
<b>MMDVMHost:</b>
|
||||
<b>Host-Program:</b>
|
||||
<ul>
|
||||
<li>MMDVMHost-Version: <span id="mmdvmhost_version">No Info Available</span>
|
||||
<li>Version: <span id="mmdvmhost_version">No Info Available</span>
|
||||
<li>Built: <span id="built">No Info Available</span>
|
||||
<li>Modem: <span id="modem">No Info Available</span>
|
||||
</ul>
|
||||
|
|
|
@ -418,18 +418,18 @@ function getLastHeard(document, event) {
|
|||
var duration = 0;
|
||||
lines.forEach(function(line, index, array) {
|
||||
logIt("LogLine: " + 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 ) {
|
||||
modem = line.substring(line.indexOf("description:") + 12);
|
||||
document.getElementById("modem").innerHTML = modem;
|
||||
|
@ -745,7 +745,11 @@ function getSysInfo(document, event) {
|
|||
data = data.substring(data.indexOf(" ") + 1);
|
||||
document.getElementById("disk_free").innerHTML = parseFloat(data.substring(data.indexOf("disk_free:") + 10, data.indexOf(" "))).toFixed(3);
|
||||
data = data.substring(data.indexOf(" ") + 1);
|
||||
document.getElementById("disk_percent_used").innerHTML = data.substring(data.indexOf("disk_percent_used:") + 18);
|
||||
document.getElementById("disk_percent_used").innerHTML = data.substring(data.indexOf("disk_percent_used:") + 18, data.indexOf(" "));
|
||||
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-06 16:18:53";
|
||||
var dashboard_version = "2021-02-06 23:30:37";
|
||||
|
|
|
@ -25,6 +25,12 @@ Prefix=MMDVM
|
|||
DMR_ID_Lookup=1
|
||||
DMR_ID_LookupFile=/etc/MMDVM/DMRIds.dat
|
||||
|
||||
# Location of your MMDVM.ini/DMRHost.ini or similar
|
||||
MMDVM_ini=/etc/MMDVM/MMDVM.ini
|
||||
|
||||
# Localtion of your MMDVMHost/DMRHost-binary
|
||||
MMDVM_bin=/usr/local/bin/MMDVMHost
|
||||
|
||||
[DAPNETGateway]
|
||||
# Don't throw away the trailing slash! It is important but check logfile-location and Prefix twice :-)
|
||||
Logdir=/mnt/ramdisk/
|
||||
|
|
|
@ -17,6 +17,8 @@ from os import popen
|
|||
import psutil
|
||||
import functools
|
||||
from http import HTTPStatus
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
MIME_TYPES = {
|
||||
"html": "text/html",
|
||||
|
@ -185,7 +187,12 @@ async def view_log(websocket, path):
|
|||
disk_used = str(disk.used / 2**30)
|
||||
disk_free = str(disk.free / 2**30)
|
||||
disk_percent_used = str(disk.percent)
|
||||
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 = 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")
|
||||
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)
|
||||
|
||||
except ValueError as e:
|
||||
|
|
Loading…
Reference in a new issue