• Kunden aus Hessen und Nordrhein-Westfalen können über die Rufnummer 0221 / 466 191 00 Hilfe bei allen Problemen in Anspruch nehmen.
    Kunden aus Baden-Württemberg können über die Rufnummer 0711 / 54 888 150 Hilfe bei allen Problemen in Anspruch nehmen.

Auslastung des eigenen Segments ansehen (reloaded)

Diskutiere Auslastung des eigenen Segments ansehen (reloaded) im Internet und Telefon über das TV-Kabelnetz Forum im Bereich Internet und Telefon bei Unitymedia; Die Firmware fehlte wohl noch dmesg sagt: [ 4512.697310] si2168 3-0064: Direct firmware load for dvb-demod-si2168-b40-01.fw failed with error -2...

MartinP_Do

Beiträge
2.714
Reaktionen
15
Die Firmware fehlte wohl noch

dmesg sagt:
Code:
[ 4512.697310] si2168 3-0064: Direct firmware load for dvb-demod-si2168-b40-01.fw failed with error -2
[ 4512.697446] si2168 3-0064: Direct firmware load for dvb-demod-si2168-02.fw failed with error -2
[ 4512.697467] si2168 3-0064: firmware file 'dvb-demod-si2168-02.fw' not found
[ 4512.721704] si2157 4-0060: found a 'Silicon Labs Si2157-A30'
[ 4512.776600] si2157 4-0060: firmware version: 3.0.5
[ 4521.865433] si2168 3-0064: Direct firmware load for dvb-demod-si2168-02.fw failed with error -2
[ 4521.865520] si2168 3-0064: Direct firmware load for dvb-demod-si2168-02.fw failed with error -2
[ 4521.865540] si2168 3-0064: firmware file 'dvb-demod-si2168-02.fw' not found
[email protected]:~ $
Code:
wget http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz
tar -zxvf dvbsky-firmware.tar.gz
cd dvbsky-firmware
sudo ./copy-firmware.sh
 

sparkie

Beiträge
641
Reaktionen
12
das stimmt. EIne ordentliche Ladung Firmware wirkt oft Wunder 👍
 

Holzlenkrad

Beiträge
65
Reaktionen
8
Ok, jetzt wird es merkwürdig.
Da ich in den letzten Wochen schon recht viel mit absurden Bugs zutun hatte, bin ich direkt zum Äußersten geschritten damit ich mir nicht unnötig den Kopf zerbreche.
Hab mir meinen Raspberry Pi 3 geschnappt, wenn auch ungern, weil da mein komplettes Smarthome drauf läuft und dort ein älteres Raspbian Stretch installiert.

Und was soll ich sagen? dvbsnoop läuft problemlos, und das Script somit auch.

Wo liegt jetzt das Problem? In den Paketversionen, die Debian Buster nutzt? Im aktuellen Kernel? An der Hardware des Raspberry Pi 4?

Vielleicht mag @rv112 nochmal schreiben, welchen Pi, welche Raspbian Version und welchen Kernel er nutzt? :)
Ich versuche jetzt auch mal das Problem näher einzugrenzen. Wer Ideen hat, her damit :D
 

Holzlenkrad

Beiträge
65
Reaktionen
8
Also, aktueller Stand:
Raspberry Pi 4, Raspbian Buster, Kernel 4.19 --> dvbsnoop genehmigt sich 2 Sekunden zum starten
Raspberry Pi 3, Raspbian Stretch, Kernel 4.14.98-v7+ --> dvbsnoop spuckt sofort Werte aus
 

rv112

Beiträge
3.627
Reaktionen
29
Ich habe einen RPi 3B mit Raspbian Buster Full. Gibt es Befehle die ich ausführen soll?
 

Holzlenkrad

Beiträge
65
Reaktionen
8
uname -a wäre schon mal ein Anfang. Und wann hast du das letzte Mal ein apt-get upgrade ausgeführt? Also mit anderen Worten, ist dein System auf dem aktuellen Softwarestand?
Denn dann würde das für ein Problem mit der Hardware meines Pi 4 sprechen, bzw. den Treibern dafür.
 

sparkie

Beiträge
641
Reaktionen
12
folgende Systeme laufen bei mir ohne Probleme. Sie sind mit debootstrap hochgefahren worden und absolut minimal was die installierten Pakete anbetrifft. Es existiert nur ssh Zugang und alles ohne Graphik natuerlich.

System I
- RPi3B+
- aktuelles Raspbian Buster (4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux)
- Sundtek MediaTV Pro III

System II
- RPi1B
- aktuelles Raspbian Stretch (4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU/Linux)
- Sundtek MediaTV Pro III
 
Zuletzt bearbeitet:

rv112

Beiträge
3.627
Reaktionen
29
Code:
Linux raspberry3 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
Ein apt-get update habe ich überhaupt nicht ausgeführt. Habe Raspbian erst letzte Woche frisch geladen und installiert. Sonst ist auf dem System nichts drauf.
 

Holzlenkrad

Beiträge
65
Reaktionen
8
Ja, das ganze liegt wohl am Raspberry Pi 4. Frag mich nur woran genau. Hab leider keinen USB-Hub, sonst würde ich mal gucken, ob es an der Stromversorgung des Sticks liegt. Ansonsten habe ich den USB-Controller im Verdacht, der hat sich ja auch geändert.
Ist aber eigentlich egal, dann ziehe ich mein Smarthome auf den neuen Pi um und nutze den 3er für den DOCSIS Kram...

Aktuell experimentiere ich, an welcher Stelle der Sleep muss. Interessanter Weise kann man ihn auch VOR das Einstellen der Frequenz stellen und der Effekt ist der Gleiche...
Ein Ausrutscher nach Oben oder unten stellt jedoch immer die kleinste Frequenz, also 474 Mhz da. Der Wert ist immer höher oder niedriger als die anderen. Vielleicht braucht der Stick beim großen Frequenzsprung länger "um sich einzuschwingen" dann müsste man nur einen Sleep pro Durchlauf machen.

Bei der ganzen Geschichte wäre halt ein Referenzwert echt nicht schlecht, dann wüsste ich ob ich überhaupt auf der richtigen Spur ist. Ich muss mir echt mal einen Filter für den ODFM Kanal besorgen, dann kann ich zumindest sehen in welcher Größe meine Downloads in der Grafik auftauchen...
 

Holzlenkrad

Beiträge
65
Reaktionen
8
So, leider noch ein bisschen Spam. Ich hoffe das wars dann auch erstmal.
Mir ist aufgefallen, was die teils unrealistischen Werte auslöst. Wenn man sich im Logfile mal die Ausgage von dvbsnoop ansieht, dann sieht man, dass in der ersten Zeile teils etwas extreme Werte stehen. Nicht so schlimm wie es bei meinem RPi4 der Fall war, aber immerhin.
Das verändert natürlich auch den Durchschnittswert.

Ich rufe jetzt also nach jeder Frequenzänderung einmal kurz ex("timeout 1 dvbsnoop -s bandwidth 8190 -n 200") auf, ohne diese Werte zu nutzen. Danach startet direkt die reguläre Messung, die vom ersten Wert an problemlos läuft.
Das ganze geht auch wesentlich schneller, als ein Sleep für eine Sekunde.

Die Frage ist jetzt natürlich, wieso misst dvbsnoop im ersten Moment Mist? Wenn ich auf meinen Stick schaue, dann hat dieser eine Aktivitäts-LED, die für jede Messung mit dvbsnoop angeht. Bei der Frequenzumstellung leuchtet sie nicht. Vielleicht hat der Stick irgendeine Art Energiesparmodus, der uns hier in die Quere kommt?
Vielleicht wird die neue Frequenz zwar nach dvbtune im Stick gespeichert, aber tatsächlich erst eingestellt (am Quarz oder wie immer sowas läuft), wenn dort Daten abgerufen werden?
 
Zuletzt bearbeitet:

Holzlenkrad

Beiträge
65
Reaktionen
8
das Problem scheint ja erst seit Kernel 4.19.25-v7+ zu existieren: #91
also nachdem die 'Fixes' von @robert_s integriert wurden #92 :)
Oh man, hätte ich mal früher lesen sollen. Aber auch interessant, dass ich unabhängig davon selbst auf die Idee gekommen bin kurz dvbsnoop zu starten ohne die Werte zu nutzen :D
Ich werde wohl mal ausprobieren, ob ich einfach die ältere Kernel-Version nutzen kann; weiß aber nicht ob die auf dem Pi 4 läuft (was aber auch egal ist, weil da die Hardware nicht mit dem Stick zusammen spielt..).

Aber ich bin schon einen Schritt weiter und habe dein Script ein bisschen modifiziert, dass beide Tuner gleichzeitig genutzt werden und so die Zeit zum Scannen aller 31 Kanäle von 1:40min auf 50 Sekunden sinkt :)

Vielleicht kannst du das ja in deiner Version mit einbauen? Der Aufruf um den Tuner auszuwählen ist dvbtune -c 0/1 -f " FREQ * $FREQ_FACTOR " -s 6952 -qam 256
und dvbsnoop -adapter 0/1 -s bandwidth 8190 -n 80000

PS: Der gute @robert_s darf seine Expertise gern auch mal beitragen :) Im KDG Forum ist er ja auch gern zeitnah zur Stelle... ;)
 
  • Gefällt mir
Reaktionen: rv112

sparkie

Beiträge
641
Reaktionen
12
Vielleicht kannst du das ja in deiner Version mit einbauen? Der Aufruf um den Tuner auszuwählen ist dvbtune -c 0/1 -f " FREQ * $FREQ_FACTOR " -s 6952 -qam 256
und dvbsnoop -adapter 0/1 -s bandwidth 8190 -n 80000
kann ich machen. Ich habe ja noch ein paar Sundteks herumliegen mit denen ich es simulieren kann. Stelle am besten deine Version als PR ins git, wenn es bei dir eh schon laeuft. Ich passe es entsprechend an. Dann muss ich das Rad nicht nochmal erfinden:)
 

Holzlenkrad

Beiträge
65
Reaktionen
8
kann ich machen. Ich habe ja noch ein paar Sundteks herumliegen mit denen ich es simulieren kann. Stelle am besten deine Version als PR ins git, wenn es bei dir eh schon laeuft. Ich passe es entsprechend an. Dann muss ich das Rad nicht nochmal erfinden:)
Ich wollte extra wage bleiben, weil ich mir sicher bin, dass du eine bessere Lösung finden wirst, als ich. :p
Das Problem ist, dass ich keine Ahnung habe wie man in Shell Scripts Prozesse parallelisiert. Ich hab mich also dafür entschieden, dass ich den Kanalwechsel der ja anteilig am längsten dauert einfach direkt in den Hintergrund schiebe. Aber dadurch fällt z.B. die Fehlererkennung weg...
Es wird also im jeden Durchlauf auf dem entsprechend anderen Tuner schon einmal der Kanal eingestellt. Und wenn ich den Traffic bestimmt habe, dann ist der nächste Kanal schon fertig eingestellt. Dass ich auf diesem Weg eine Reduktion um genau 50% erreiche hätte ich nie gedacht.

Ich werde mich die Tage mal bei Github anmelden, will ich ohnehin für eigene Zwecke nutzen.

Ich hätte evtl. bald einen WinTV dualTV übrig, den ich dir mal leihweise zur Verfügung stellen könnte. Interessant wäre ja mal die Abweichung der Auslastung, wenn man beide Sticks parallel verwendet...
 

rv112

Beiträge
3.627
Reaktionen
29
@Holzlenkrad Wie mach ich das mit dem zweiten Tuner nun genau? Wo müssen die Befehle hin?

EDIT: habe es glaub kapiert. Stimmt das so?

#!/bin/sh

#
# DOCSIS cable load monitor
#
# tool to monitor downstream load on DOCSIS cable networks
#
# https://github.com/sp4rkie/docsis-cable-load-monitor
#

cat > $0_$$.awk << !

func setup( \
)
{
CLARGS = "$0|$1|$2|$3|$4|$5|$6|$7|$8|$9|${10}|${11}|${12}|${13}|${14}|${15}|${16}|${17}|${18}|${19}|${20}"

# avoid dangling include files. incore inode still exists
system("rm $0_$$.awk")

# take care of shell expansion (if security is an issue)
setup_lib($#, "awk|" CLARGS, $$, "`pwd`", "`hostname`", "$R_")
PRP(CLARGS "\n")

# required if Sundtek hardware is in use as we install with '-service' option
LD_PL = "LD_PRELOAD=/opt/lib/libmediaclient.so "

# where to find your TC4400 cable modem (if any)
CABLE_MODEM_IP = "192.168.100.1"

# file current recording parameters as incompatible changes must trigger a new RRD generation
CONF_FILE = INSTPATH "CableLoadMonitor.cfg"
FREQ_FACTOR = 1000000

# default RRDBASE
RRDBASE_FILE = INSTPATH "CableLoadMonitor.rrd"
RRDBASE_RRASTEPS = 10 # defaults to 10s
RRDBASE_HISTSIZE = 60 * 60 * 24 * 7 # defaults to 1 week

# default RRDGRAPH
RRDGRAPH_NAME = "/var/www/html/" "CableLoadMonitor"
RRDGRAPH_EXT = ".png"
RRDGRAPH_TMP = RRDGRAPH_NAME RRDGRAPH_EXT "_"
RRDGRAPH_WIDTH = 2000
RRDGRAPH_HEIGHT = 1000
RRDGRAPH_Y_UPPER_LIMIT = 200 # scale Y axis to this minimum
BWIDTH_SNAPSHOT = RRDGRAPH_NAME "_bwidth.txt"

# feel free to add other history sizes (aka generated graphs) as well
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 " |1h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 6 " |6h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 " |1d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 7 " |7d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 30 " |30d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 365 " |365d"

# ---
rrdbase_rrasteps = RRDBASE_RRASTEPS
rrdbase_histsize = RRDBASE_HISTSIZE
rrdgraph_width = RRDGRAPH_WIDTH
rrdgraph_height = RRDGRAPH_HEIGHT

# --- define this to display a black theme
if (++use_black_theme) {
IF_BLACK_THEME = IF_BLACK_THEME "--color \"ARROW#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"BACK#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"CANVAS#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"GRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"MGRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FONT#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"AXIS#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FRAME#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--border 1" " \\\\\n"
}
# --- define this to rescale the sum graph
if (use_2nd_yaxis) {
IF_2ND_YAXIS_SCALE = 10

IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis " 1 / IF_2ND_YAXIS_SCALE ":1" " \\\\\n"
IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis-label sum" " \\\\\n"

SUM_DEF = SUM_DEF sprintf("DEF:sum_=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
SUM_DEF = SUM_DEF "CDEF:sum=sum_," IF_2ND_YAXIS_SCALE ",/" " \\\\\n"
} else {
SUM_DEF = SUM_DEF sprintf("DEF:sum=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
}
}

func read_cfg( \
line, CMD, a)
{
if (ex("ls " CONF_FILE, 0, "^(" CONF_FILE ")$")) {
CMD = "cat " CONF_FILE
#PR("reading last recently used downstream channel frequencies and RRD parameters")
FREQ_SPEC_CFG = ex_line(CMD)
while ((line = ex_line(CMD)) != -1) {
if (match(line, "^RRA:AVERAGE:.*:([0-9]+):([0-9]+)$", a)) {
RRA_STEPS_CFG = a[1]
HIST_SIZE_CFG = a[2]
}
}
}
}

func exit_(msg \
)
{
PRE(msg)
PRE("exiting...")
++ERR; exit
}

func set_freqs(str, \
i, a)
{
if (!match(str, "^[0-9]+:)[0-9]+)*$")) {
return 0
}
split(str, a, ":")
for (i = 1; a; ++i) {
FREQ[FREQ_CNT++] = a
}
return 1
}

func retrieve_down_freqs(freqs, \
URL, ignore, line, WGET, LYNX, i, a)
{
URL = "http://" CABLE_MODEM_IP "/cmconnectionstatus.html"

if (freqs == "force_new_scan" || !freqs) {

#
# specific to TC4400 yet
#
PR("trying to retrieve downstream channel frequencies from TC4400 modem")
WGET = "echo; wget --connect-timeout=1 -t 1 -q --http-user=admin --http-password=\"bEn2o#US9s\" " URL " -O -"
LYNX = "lynx -nolist -width 300 -dump -stdin"
while ((line = ex_line(WGET)) != -1) {
if (match(line, "<script")) {
++ignore
} else if (ignore) {
if (match(line, "/script?")) {
ignore = 0
}
} else {
print line |& LYNX
}
}
close(LYNX, "to")
while (LYNX |& getline line > 0) {
if (match(line, "Locked +SC-QAM +Downstream +Bonded +([0-9]+) ", a)) {
FREQ[FREQ_CNT++] = a[1] / FREQ_FACTOR
}
}
close(LYNX)
} else if (freqs) {
PR("evaluating given downstream channel frequencies")
if (!set_freqs(freqs)) {
exit_("can't handle the given downstream channel frequency specification")
}
} else {
# error -> will exit
}
PRF("downstream channel frequencies now in use: ")
if (!FREQ_CNT) {
exit_("could not retrieve any")
}
PRF("[ " FREQ_CNT " ] ")
for (i = 0; i < FREQ_CNT; ++i) {
PRF(FREQ " ")
BWIDTH_OF = "na"
FREQ_SPEC_NEW = FREQ_SPEC_NEW (FREQ_SPEC_NEW ? ":" : "") FREQ
}
PR("")
}

func assemble_rrdcreate_cmd( \
CMD, i)
{
CMD = "rrdtool create " RRDBASE_FILE " -s 1" " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DS:f%02d:GAUGE:120:U:U", i) " \\\\\n"
}
CMD = CMD sprintf("DS:sum:GAUGE:120:U:U") " \\\\\n"
CMD = CMD sprintf("RRA:AVERAGE:0.1:" rrdbase_rrasteps ":" rrdbase_histsize)
RRDB_CCMD_NEW = CMD
}

func assemble_rrdgraph_cmd(end, size, \
group, GROUPS, CMD, i, k)
{
# use the first version if interested in average and min too
GROUPS = "MAX:max:MIN:min:LAST:last:AVERAGE:avg"
GROUPS = "MAX:max:LAST:last"
split(GROUPS, group, ":")

CMD = "rrdtool graph " RRDGRAPH_TMP " -a PNG -l 0 -u " RRDGRAPH_Y_UPPER_LIMIT * FREQ_FACTOR " \\\\\n" \
"--title=\"Graph generated at \`date\`\"" " \\\\\n" \
"-w " rrdgraph_width " -h " rrdgraph_height " \\\\\n" \
"--end " end " --start end-" size "s" " \\\\\n"
CMD = CMD " \\\\\n"
CMD = CMD IF_BLACK_THEME " \\\\\n"
CMD = CMD IF_2ND_YAXIS " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DEF:f%02d=" RRDBASE_FILE ":f%02d:AVERAGE", i, i) " \\\\\n"
}
CMD = CMD SUM_DEF " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
if (i < FREQ_CNT / 2) {
CMD = CMD sprintf("\"LINE:f%02d#ff0000:%d\"", i, FREQ) " \\\\\n"
} else {
CMD = CMD sprintf("\"LINE:f%02d#0000ff:%d\"", i, FREQ) " \\\\\n"
}
}
CMD = CMD " \\\\\n"
CMD = CMD "\"LINE:sum#00ff00:sum\\\l\"" " \\\\\n"
CMD = CMD " \\\\\n"
for (k = 1; group[k]; k += 2) {
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("\"GPRINT:f%02d:%s:%%3.0lf %%s\"", i, group[k]) " \\\\\n"
}
CMD = CMD sprintf("\"GPRINT:%s:%s:%%3.0lf %%s\"", "sum", group[k])
CMD = CMD "\" " group[k + 1] "\\\l\"" " \\\\\n"
}
return CMD
}

func assemble_rrdgraphs_cmd( \
i, a)
{
for (i = 0; i < RRDGRAPHS_CNT; ++i) {
split(RRDGRAPHS, a, "|")
if (a[1] > rrdbase_histsize) {
break
}
RRDGRAPH_CMD = assemble_rrdgraph_cmd("now", gensub(" +", "", "g", a[1]))
RRDGRAPH_FILE = RRDGRAPH_NAME "_" a[2] RRDGRAPH_EXT
PR("generating graph for: " sprintf("%4s", a[2]) " recording length, size " rrdgraph_width "x" rrdgraph_height " pixels")
}
}

func scan_down_channels( \
RRDUPD_STR, BWIDTH_SUM, a, i, k)
{
PRF(strftime("%T: "))
for (i = 0; i < FREQ_CNT; ++i) {
# tuning via mediaclient not in use ATM
# ex("timeout 10 /opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 -m DVBC -f " FREQ * FREQ_FACTOR " -M Q256 -S 6952000")
ex(LD_PL "timeout 10 dvbtune -f " FREQ * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a)
ex("sleep 1") # <=== ZUSAETZLICHE ZEILE
a[1] += 0
if (a[1] && !dvbtune_ignerrs) {
PR("\n\n" a[0] ", please check your cables\n")
}

#
# in case of very small bandwidth values limit the measurement
# interval to something useful to keep the overall scan time sufficiently low.
#
# the arbitrarily chosen stop value of 80000 appears to be high enough to even
# handle high bandwidths with enough accuracy.
#
if (!ex(LD_PL "timeout 1 dvbsnoop -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) {

#
# UPDATE as of 2019_08_03:
# - in the event of dvbsnoop failure: no longer exit but retry instead
# - you may want to reload your DVB drivers if these crashed
#
PR("\ndvbsnoop fails for [ " FREQ " ], retrying...")

#
# place your specific driver reload code here
#
ex("systemctl stop sundtek; sleep 5; systemctl start sundtek; sleep 20", 1)
--i; continue
# exit_("dvbsnoop fails")
}
BWIDTH_OF = int(a[1] + 0.5)
PRF(sprintf("%6s", BWIDTH_OF))
BWIDTH_SUM = 0
RRDUPD_STR = "rrdtool update " RRDBASE_FILE " N"
for (k = 0; k < FREQ_CNT; ++k) {
BWIDTH_SUM += BWIDTH_OF[k]
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_OF[k] * 1000
}
#
# do not update until the initial scan completes
#
if (BWIDTH_OF[FREQ_CNT - 1] != "na") {
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000
ex(RRDUPD_STR, 2)
}
}
PR(sprintf("%7s", BWIDTH_SUM))
print BWIDTH_SUM > BWIDTH_SNAPSHOT; close(BWIDTH_SNAPSHOT)
}

func generate_rrdgraphs( \
i)
{
for (i = 0; RRDGRAPH_CMD; ++i) {
ex(RRDGRAPH_CMD)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_FILE, 2)
}
}

func watch_the_scenery( \
)
{
#
# some inital setup specific to certain devices. this may fail
# on one or another device. don't care.
#

#
# fix for:
# * Silicon Labs Si2168 card not compatible? · Issue #1 · sp4rkie/docsis-cable-load-monitor
# https://github.com/sp4rkie/docsis-cable-load-monitor/issues/1
#
ex("echo 0 | sudo tee -a /sys/module/dvb_core/parameters/dvb_powerdown_on_sleep")

#
# fix for:
# * set dtvmode
# https://www.unitymediaforum.de/viewtopic.php?p=428995#p428995
#
ex("/opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 --setdtvmode=DVBC")

while (1) {
generate_rrdgraphs()
scan_down_channels()
}
}

func usage( \
locked, line, a)
{
PR("Usage: " PRGBNAME)
while ((line = ex_line("cat " PRGNAME)) != -1) {
if (locked) {
if (match(line, "match[^,]+, \"(.+)\"[^\"]+# (.*)$", a)) {
PR(sprintf(" %-21s - %s", gensub("\\\\$", "", "g", a[1]), a[2]))
}
} else {
if (match(line, "^func process_cmdline")) ++locked
}
}
PR("\ndefaults:")
PR(" -c " sprintf("%-10d", RRDBASE_RRASTEPS) " # 10 secs")
PR(" -r " sprintf("%-10d", RRDBASE_HISTSIZE) " # 1 week" )
PR(" -w " sprintf("%-10d", RRDGRAPH_WIDTH) )
PR(" -h " sprintf("%-10d", RRDGRAPH_HEIGHT) )
}

func process_cmdline( \
renew_rrd_base, backup_time, freq_list, i, a)
{
read_cfg()
if (FREQ_SPEC_CFG) freq_list = FREQ_SPEC_CFG
if (RRA_STEPS_CFG) rrdbase_rrasteps = RRA_STEPS_CFG
if (HIST_SIZE_CFG) rrdbase_histsize = HIST_SIZE_CFG

#
# regexps for arg matching are kept somewhat sloppy to avoid clutter in usage() text output
#
for (i = 2; i < _ARGC; ++i) {
if (match(_ARGV _ARGV[i + 1], "-h$")) { # print this help and exit
usage()
exit
} else if (match(_ARGV " " _ARGV[i + 1], "-f [0-9]+:)[0-9]+)*$")) { # manually specify downstream channel frequencies
freq_list = _ARGV[i + 1]
++i
} else if (match(_ARGV, "-f$")) { # scan a TC4400 for current downstream channel freqs
freq_list = "force_new_scan"
} else if (match(_ARGV " " _ARGV[i + 1], "-c [0-9]+$")) { # create a RRD base with given RRA steps (in secs)
rrdbase_rrasteps = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-r [0-9]+$")) { # recording history size (in secs)
rrdbase_histsize = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-w [0-9]+$")) { # width of generated graph(s)
rrdgraph_width = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-h [0-9]+$")) { # height of generated graph(s)
rrdgraph_height = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1] " " _ARGV[i + 2], "-g [0-9]+ [0-9]+$")) { # generate a graph with given end and length (in secs)
rrdgraph_histend = strftime("%s") - _ARGV[i + 1]
rrdgraph_length = _ARGV[i + 2]
i += 2
} else if (match(_ARGV, "-i$")) { # ignore errors reported by dvbtune
++dvbtune_ignerrs
} else {
usage()
++ERR; exit
}
}
retrieve_down_freqs(freq_list)
if (rrdgraph_histend) {
PR("point in time where the generated graph ends: " strftime("%T", rrdgraph_histend))
PR("time span covered by the generated graph: " rrdgraph_length "s")
PR("graph is written to: " RRDGRAPH_NAME RRDGRAPH_EXT)
ex(assemble_rrdgraph_cmd(rrdgraph_histend, rrdgraph_length), 2)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_NAME RRDGRAPH_EXT)
exit
}
PR("recording RRA step size: " rrdbase_rrasteps " seconds")
PR("recording RRA history size: " \
int(rrdbase_histsize / (60 * 60 * 24)) " day(s) " \
int(rrdbase_histsize % (60 * 60 * 24) / (60 * 60 )) " hour(s) " \
int(rrdbase_histsize % (60 * 60 ) / (60 )) " minute(s) " \
int(rrdbase_histsize % (60 ) ) " second(s) " \
)
if (dvbtune_ignerrs) PR("dvbtune: " "ignore bit errors")
assemble_rrdcreate_cmd()
assemble_rrdgraphs_cmd()
if (split(FREQ_SPEC_CFG, a, ":") != split(FREQ_SPEC_NEW, a, ":")) {
if (FREQ_SPEC_CFG) PR("count of monitored channel frequencies did change")
renew_rrd_base += 2
} else if (FREQ_SPEC_CFG != FREQ_SPEC_NEW) {
if (FREQ_SPEC_CFG) PR("values of monitored channel frequencies did change")
renew_rrd_base += 1
}
if (RRA_STEPS_CFG != rrdbase_rrasteps \
|| HIST_SIZE_CFG != rrdbase_histsize) {
if (RRA_STEPS_CFG) PR("RRD base recording parameters did change")
renew_rrd_base += 2
}
if (renew_rrd_base) {
if (ex("ls " RRDBASE_FILE, 0 ,"^(" RRDBASE_FILE ")$")) {
backup_time = strftime(".%Y-%m-%d_%T")
PR("backing up old RRD data")
ex("cp -va " RRDBASE_FILE " " RRDBASE_FILE backup_time)
ex("cp -va " CONF_FILE " " CONF_FILE backup_time)
}
print FREQ_SPEC_NEW > CONF_FILE
print RRDB_CCMD_NEW > CONF_FILE
close(CONF_FILE)
if (renew_rrd_base > 1) {
PR("(re)creating the RRD base")
ex(RRDB_CCMD_NEW, 2)
}
}
watch_the_scenery()
}

BEGIN {
QUIET = 1
setup()
process_cmdline()
exit
}

END {
cleanup()
PRP("\n" PRGBNAME " " "exits with: " (ERR ? ERR : 0) " " "error(s)")
PRP("====== [" sprintf(" %5d ", PROCINFO["pid"]) "] program stop [" strftime() "] on " HOSTNAME " ======")
close(PROTOCOL)
exit ERR
}

!

[ -t 0 ] && STDIN="< /dev/null"
eval exec awk -f /usr/local/lib/l5.awklib -f $0_$$.awk $STDIN 2>&1

EDIT2: Wirklich schneller geht es damit bei mir aber leider nicht.

Code:
07:58:03: 193 8915 7035 8336 8160 8340 6824 5702 8105 9342 6351 5209 6624 9408 6484 6460 12667 8593 5948 8740 8788 8874 10440 9341 9638 9583 9547 12380 11791 13753 9233 260804
07:59:50: 2495 9414 7053 7879 9994 8363 7687 5740 5886 7802 7663 8186 8007 8531 7347 8092 10199 9016 11144 9083 9022 10150 8657 8901 8375 7694 7800 7546 11410 8204 6316 253656
08:01:39: 3259 12506 9603 8615 11212 10061 9685 9019 10451 9738 6766 8422 7161 6560 9057 10274 7593 10928 8842 7223 7290 8754 8099 8233 13459 6366 8785 7215 7984 8143 14057 275360
08:03:28: 7130 20971 17689 19898 8524 11346 7180 8304 10857 8129 13851 7846 9671 9778 7205 11814 7016 8722 11817 7394 8313 7791 10716 9800 8286 9749
 
Zuletzt bearbeitet:

Holzlenkrad

Beiträge
65
Reaktionen
8
Also ich habe es so gemacht:

Vor der ewig ausgeführten While-Schleife einmalig:
Bash:
 dvb_device = 0 ex("nohub dvbtune -c " dvb_device " -f " FREQ[0] * FREQ_FACTOR " -s 6952 -qam 256") while (1) { generate_rrdgraphs() scan_down_channels() }
Und dann in der Funktion scan_down_channels relativ viel:
Bash:
...
bisherige folgende Zeile auskommentieren bzw ersetzen.
# ex(LD_PL "timeout 10 dvbtune -f " FREQ[i] * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a) if ( dvb_device % 2 == 0 ) { next_device = 1 } else { next_device = 0 }
if (i == FREQ_CNT) { nohup dvbtune -c " next_device " -f " FREQ[0] * $FREQ_FACTOR " -s 6952 -qam 256 } else { nohup dvbtune -c " next_device " -f " FREQ[i + 1] * FREQ_FACTOR " -s 6952 -qam 256 }
Code:
 if (!ex("timeout 1 dvbsnoop -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) { ersetzen durch: if (!ex("timeout 1 dvbsnoop -adapter " dvb_device " -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) {
Und zu guter Letzt, die eine Zeile entsprechend einfügen:
Bash:
if (BWIDTH_OF[FREQ_CNT - 1] != "na") { RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000 ex(RRDUPD_STR, 2) }
#... dvb_device = next_device
#... } PR(sprintf("%7s", BWIDTH_SUM)) print BWIDTH_SUM " kbit/s" > BWIDTH_SNAPSHOT; close(BWIDTH_SNAPSHOT)
Edit:
Wenn du mich zitierst, dann kannst du die Zeilenumbrüche sehen
 
Zuletzt bearbeitet:

rv112

Beiträge
3.627
Reaktionen
29
Ich habs versucht mal nach zu machen, aber bekomme einen Fehler. Das ist meine Config nun:

#!/bin/sh

#
# DOCSIS cable load monitor
#
# tool to monitor downstream load on DOCSIS cable networks
#
# https://github.com/sp4rkie/docsis-cable-load-monitor
#

cat > $0_$$.awk << !

func setup( \
)
{
CLARGS = "$0|$1|$2|$3|$4|$5|$6|$7|$8|$9|${10}|${11}|${12}|${13}|${14}|${15}|${16}|${17}|${18}|${19}|${20}"

# avoid dangling include files. incore inode still exists
system("rm $0_$$.awk")

# take care of shell expansion (if security is an issue)
setup_lib($#, "awk|" CLARGS, $$, "`pwd`", "`hostname`", "$R_")
PRP(CLARGS "\n")

# required if Sundtek hardware is in use as we install with '-service' option
LD_PL = "LD_PRELOAD=/opt/lib/libmediaclient.so "

# where to find your TC4400 cable modem (if any)
CABLE_MODEM_IP = "192.168.100.1"

# file current recording parameters as incompatible changes must trigger a new RRD generation
CONF_FILE = INSTPATH "CableLoadMonitor.cfg"
FREQ_FACTOR = 1000000

# default RRDBASE
RRDBASE_FILE = INSTPATH "CableLoadMonitor.rrd"
RRDBASE_RRASTEPS = 10 # defaults to 10s
RRDBASE_HISTSIZE = 60 * 60 * 24 * 7 # defaults to 1 week

# default RRDGRAPH
RRDGRAPH_NAME = "/var/www/html/" "CableLoadMonitor"
RRDGRAPH_EXT = ".png"
RRDGRAPH_TMP = RRDGRAPH_NAME RRDGRAPH_EXT "_"
RRDGRAPH_WIDTH = 2000
RRDGRAPH_HEIGHT = 1000
RRDGRAPH_Y_UPPER_LIMIT = 200 # scale Y axis to this minimum
BWIDTH_SNAPSHOT = RRDGRAPH_NAME "_bwidth.txt"

# feel free to add other history sizes (aka generated graphs) as well
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 " |1h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 6 " |6h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 " |1d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 7 " |7d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 30 " |30d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 365 " |365d"

# ---
rrdbase_rrasteps = RRDBASE_RRASTEPS
rrdbase_histsize = RRDBASE_HISTSIZE
rrdgraph_width = RRDGRAPH_WIDTH
rrdgraph_height = RRDGRAPH_HEIGHT

# --- define this to display a black theme
if (++use_black_theme) {
IF_BLACK_THEME = IF_BLACK_THEME "--color \"ARROW#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"BACK#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"CANVAS#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"GRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"MGRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FONT#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"AXIS#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FRAME#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--border 1" " \\\\\n"
}
# --- define this to rescale the sum graph
if (use_2nd_yaxis) {
IF_2ND_YAXIS_SCALE = 10

IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis " 1 / IF_2ND_YAXIS_SCALE ":1" " \\\\\n"
IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis-label sum" " \\\\\n"

SUM_DEF = SUM_DEF sprintf("DEF:sum_=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
SUM_DEF = SUM_DEF "CDEF:sum=sum_," IF_2ND_YAXIS_SCALE ",/" " \\\\\n"
} else {
SUM_DEF = SUM_DEF sprintf("DEF:sum=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
}
}

func read_cfg( \
line, CMD, a)
{
if (ex("ls " CONF_FILE, 0, "^(" CONF_FILE ")$")) {
CMD = "cat " CONF_FILE
#PR("reading last recently used downstream channel frequencies and RRD parameters")
FREQ_SPEC_CFG = ex_line(CMD)
while ((line = ex_line(CMD)) != -1) {
if (match(line, "^RRA:AVERAGE:.*:([0-9]+):([0-9]+)$", a)) {
RRA_STEPS_CFG = a[1]
HIST_SIZE_CFG = a[2]
}
}
}
}

func exit_(msg \
)
{
PRE(msg)
PRE("exiting...")
++ERR; exit
}

func set_freqs(str, \
i, a)
{
if (!match(str, "^[0-9]+:)[0-9]+)*$")) {
return 0
}
split(str, a, ":")
for (i = 1; a; ++i) {
FREQ[FREQ_CNT++] = a
}
return 1
}

func retrieve_down_freqs(freqs, \
URL, ignore, line, WGET, LYNX, i, a)
{
URL = "http://" CABLE_MODEM_IP "/cmconnectionstatus.html"

if (freqs == "force_new_scan" || !freqs) {

#
# specific to TC4400 yet
#
PR("trying to retrieve downstream channel frequencies from TC4400 modem")
WGET = "echo; wget --connect-timeout=1 -t 1 -q --http-user=admin --http-password=\"bEn2o#US9s\" " URL " -O -"
LYNX = "lynx -nolist -width 300 -dump -stdin"
while ((line = ex_line(WGET)) != -1) {
if (match(line, "<script")) {
++ignore
} else if (ignore) {
if (match(line, "/script?")) {
ignore = 0
}
} else {
print line |& LYNX
}
}
close(LYNX, "to")
while (LYNX |& getline line > 0) {
if (match(line, "Locked +SC-QAM +Downstream +Bonded +([0-9]+) ", a)) {
FREQ[FREQ_CNT++] = a[1] / FREQ_FACTOR
}
}
close(LYNX)
} else if (freqs) {
PR("evaluating given downstream channel frequencies")
if (!set_freqs(freqs)) {
exit_("can't handle the given downstream channel frequency specification")
}
} else {
# error -> will exit
}
PRF("downstream channel frequencies now in use: ")
if (!FREQ_CNT) {
exit_("could not retrieve any")
}
PRF("[ " FREQ_CNT " ] ")
for (i = 0; i < FREQ_CNT; ++i) {
PRF(FREQ " ")
BWIDTH_OF = "na"
FREQ_SPEC_NEW = FREQ_SPEC_NEW (FREQ_SPEC_NEW ? ":" : "") FREQ
}
PR("")
}

func assemble_rrdcreate_cmd( \
CMD, i)
{
CMD = "rrdtool create " RRDBASE_FILE " -s 1" " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DS:f%02d:GAUGE:120:U:U", i) " \\\\\n"
}
CMD = CMD sprintf("DS:sum:GAUGE:120:U:U") " \\\\\n"
CMD = CMD sprintf("RRA:AVERAGE:0.1:" rrdbase_rrasteps ":" rrdbase_histsize)
RRDB_CCMD_NEW = CMD
}

func assemble_rrdgraph_cmd(end, size, \
group, GROUPS, CMD, i, k)
{
# use the first version if interested in average and min too
GROUPS = "MAX:max:MIN:min:LAST:last:AVERAGE:avg"
GROUPS = "MAX:max:LAST:last"
split(GROUPS, group, ":")

CMD = "rrdtool graph " RRDGRAPH_TMP " -a PNG -l 0 -u " RRDGRAPH_Y_UPPER_LIMIT * FREQ_FACTOR " \\\\\n" \
"--title=\"Graph generated at \`date\`\"" " \\\\\n" \
"-w " rrdgraph_width " -h " rrdgraph_height " \\\\\n" \
"--end " end " --start end-" size "s" " \\\\\n"
CMD = CMD " \\\\\n"
CMD = CMD IF_BLACK_THEME " \\\\\n"
CMD = CMD IF_2ND_YAXIS " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DEF:f%02d=" RRDBASE_FILE ":f%02d:AVERAGE", i, i) " \\\\\n"
}
CMD = CMD SUM_DEF " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
if (i < FREQ_CNT / 2) {
CMD = CMD sprintf("\"LINE:f%02d#ff0000:%d\"", i, FREQ) " \\\\\n"
} else {
CMD = CMD sprintf("\"LINE:f%02d#0000ff:%d\"", i, FREQ) " \\\\\n"
}
}
CMD = CMD " \\\\\n"
CMD = CMD "\"LINE:sum#00ff00:sum\\\l\"" " \\\\\n"
CMD = CMD " \\\\\n"
for (k = 1; group[k]; k += 2) {
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("\"GPRINT:f%02d:%s:%%3.0lf %%s\"", i, group[k]) " \\\\\n"
}
CMD = CMD sprintf("\"GPRINT:%s:%s:%%3.0lf %%s\"", "sum", group[k])
CMD = CMD "\" " group[k + 1] "\\\l\"" " \\\\\n"
}
return CMD
}

func assemble_rrdgraphs_cmd( \
i, a)
{
for (i = 0; i < RRDGRAPHS_CNT; ++i) {
split(RRDGRAPHS, a, "|")
if (a[1] > rrdbase_histsize) {
break
}
RRDGRAPH_CMD = assemble_rrdgraph_cmd("now", gensub(" +", "", "g", a[1]))
RRDGRAPH_FILE = RRDGRAPH_NAME "_" a[2] RRDGRAPH_EXT
PR("generating graph for: " sprintf("%4s", a[2]) " recording length, size " rrdgraph_width "x" rrdgraph_height " pixels")
}
}

func scan_down_channels( \
RRDUPD_STR, BWIDTH_SUM, a, i, k)
{
PRF(strftime("%T: "))
for (i = 0; i < FREQ_CNT; ++i) {
# tuning via mediaclient not in use ATM
# ex("timeout 10 /opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 -m DVBC -f " FREQ * FREQ_FACTOR " -M Q256 -S 6952000")
# ex(LD_PL "timeout 10 dvbtune -f " FREQ * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a)
if (i == FREQ_CNT) { nohup dvbtune -c " next_device " -f " FREQ[0] * $FREQ_FACTOR " -s 6952 -qam 256 } else { nohup dvbtune -c " next_device " -f " FREQ[i + 1] * FREQ_FACTOR " -s 6952 -qam 256 }
ex("sleep 1") # <=== ZUSAETZLICHE ZEILE
a[1] += 0
if (a[1] && !dvbtune_ignerrs) {
PR("\n\n" a[0] ", please check your cables\n")
}

#
# in case of very small bandwidth values limit the measurement
# interval to something useful to keep the overall scan time sufficiently low.
#
# the arbitrarily chosen stop value of 80000 appears to be high enough to even
# handle high bandwidths with enough accuracy.
#
if (!ex("timeout 1 dvbsnoop -adapter " dvb_device " -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) {
if (BWIDTH_OF[FREQ_CNT - 1] != "na") { RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000 ex(RRDUPD_STR, 2) }

#
# UPDATE as of 2019_08_03:
# - in the event of dvbsnoop failure: no longer exit but retry instead
# - you may want to reload your DVB drivers if these crashed
#
PR("\ndvbsnoop fails for [ " FREQ " ], retrying...")

#
# place your specific driver reload code here
#
ex("systemctl stop sundtek; sleep 5; systemctl start sundtek; sleep 20", 1)
--i; continue
# exit_("dvbsnoop fails")
}
BWIDTH_OF = int(a[1] + 0.5)
PRF(sprintf("%6s", BWIDTH_OF))
BWIDTH_SUM = 0
RRDUPD_STR = "rrdtool update " RRDBASE_FILE " N"
for (k = 0; k < FREQ_CNT; ++k) {
BWIDTH_SUM += BWIDTH_OF[k]
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_OF[k] * 1000
}
#
# do not update until the initial scan completes
#
if (BWIDTH_OF[FREQ_CNT - 1] != "na") {
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000
ex(RRDUPD_STR, 2)
}
}
PR(sprintf("%7s", BWIDTH_SUM))
print BWIDTH_SUM > BWIDTH_SNAPSHOT; close(BWIDTH_SNAPSHOT)
}

func generate_rrdgraphs( \
i)
{
for (i = 0; RRDGRAPH_CMD; ++i) {
ex(RRDGRAPH_CMD)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_FILE, 2)
}
}

func watch_the_scenery( \
)
{
#
# some inital setup specific to certain devices. this may fail
# on one or another device. don't care.
#

#
# fix for:
# * Silicon Labs Si2168 card not compatible? · Issue #1 · sp4rkie/docsis-cable-load-monitor
# https://github.com/sp4rkie/docsis-cable-load-monitor/issues/1
#
ex("echo 0 | sudo tee -a /sys/module/dvb_core/parameters/dvb_powerdown_on_sleep")

#
# fix for:
# * set dtvmode
# https://www.unitymediaforum.de/viewtopic.php?p=428995#p428995
#
ex("/opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 --setdtvmode=DVBC")

while (1) {
generate_rrdgraphs()
scan_down_channels()
}
}

func usage( \
locked, line, a)
{
PR("Usage: " PRGBNAME)
while ((line = ex_line("cat " PRGNAME)) != -1) {
if (locked) {
if (match(line, "match[^,]+, \"(.+)\"[^\"]+# (.*)$", a)) {
PR(sprintf(" %-21s - %s", gensub("\\\\$", "", "g", a[1]), a[2]))
}
} else {
if (match(line, "^func process_cmdline")) ++locked
}
}
PR("\ndefaults:")
PR(" -c " sprintf("%-10d", RRDBASE_RRASTEPS) " # 10 secs")
PR(" -r " sprintf("%-10d", RRDBASE_HISTSIZE) " # 1 week" )
PR(" -w " sprintf("%-10d", RRDGRAPH_WIDTH) )
PR(" -h " sprintf("%-10d", RRDGRAPH_HEIGHT) )
}

func process_cmdline( \
renew_rrd_base, backup_time, freq_list, i, a)
{
read_cfg()
if (FREQ_SPEC_CFG) freq_list = FREQ_SPEC_CFG
if (RRA_STEPS_CFG) rrdbase_rrasteps = RRA_STEPS_CFG
if (HIST_SIZE_CFG) rrdbase_histsize = HIST_SIZE_CFG

#
# regexps for arg matching are kept somewhat sloppy to avoid clutter in usage() text output
#
for (i = 2; i < _ARGC; ++i) {
if (match(_ARGV _ARGV[i + 1], "-h$")) { # print this help and exit
usage()
exit
} else if (match(_ARGV " " _ARGV[i + 1], "-f [0-9]+:)[0-9]+)*$")) { # manually specify downstream channel frequencies
freq_list = _ARGV[i + 1]
++i
} else if (match(_ARGV, "-f$")) { # scan a TC4400 for current downstream channel freqs
freq_list = "force_new_scan"
} else if (match(_ARGV " " _ARGV[i + 1], "-c [0-9]+$")) { # create a RRD base with given RRA steps (in secs)
rrdbase_rrasteps = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-r [0-9]+$")) { # recording history size (in secs)
rrdbase_histsize = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-w [0-9]+$")) { # width of generated graph(s)
rrdgraph_width = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-h [0-9]+$")) { # height of generated graph(s)
rrdgraph_height = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1] " " _ARGV[i + 2], "-g [0-9]+ [0-9]+$")) { # generate a graph with given end and length (in secs)
rrdgraph_histend = strftime("%s") - _ARGV[i + 1]
rrdgraph_length = _ARGV[i + 2]
i += 2
} else if (match(_ARGV, "-i$")) { # ignore errors reported by dvbtune
++dvbtune_ignerrs
} else {
usage()
++ERR; exit
}
}
retrieve_down_freqs(freq_list)
if (rrdgraph_histend) {
PR("point in time where the generated graph ends: " strftime("%T", rrdgraph_histend))
PR("time span covered by the generated graph: " rrdgraph_length "s")
PR("graph is written to: " RRDGRAPH_NAME RRDGRAPH_EXT)
ex(assemble_rrdgraph_cmd(rrdgraph_histend, rrdgraph_length), 2)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_NAME RRDGRAPH_EXT)
exit
}
PR("recording RRA step size: " rrdbase_rrasteps " seconds")
PR("recording RRA history size: " \
int(rrdbase_histsize / (60 * 60 * 24)) " day(s) " \
int(rrdbase_histsize % (60 * 60 * 24) / (60 * 60 )) " hour(s) " \
int(rrdbase_histsize % (60 * 60 ) / (60 )) " minute(s) " \
int(rrdbase_histsize % (60 ) ) " second(s) " \
)
if (dvbtune_ignerrs) PR("dvbtune: " "ignore bit errors")
assemble_rrdcreate_cmd()
assemble_rrdgraphs_cmd()
if (split(FREQ_SPEC_CFG, a, ":") != split(FREQ_SPEC_NEW, a, ":")) {
if (FREQ_SPEC_CFG) PR("count of monitored channel frequencies did change")
renew_rrd_base += 2
} else if (FREQ_SPEC_CFG != FREQ_SPEC_NEW) {
if (FREQ_SPEC_CFG) PR("values of monitored channel frequencies did change")
renew_rrd_base += 1
}
if (RRA_STEPS_CFG != rrdbase_rrasteps \
|| HIST_SIZE_CFG != rrdbase_histsize) {
if (RRA_STEPS_CFG) PR("RRD base recording parameters did change")
renew_rrd_base += 2
}
if (renew_rrd_base) {
if (ex("ls " RRDBASE_FILE, 0 ,"^(" RRDBASE_FILE ")$")) {
backup_time = strftime(".%Y-%m-%d_%T")
PR("backing up old RRD data")
ex("cp -va " RRDBASE_FILE " " RRDBASE_FILE backup_time)
ex("cp -va " CONF_FILE " " CONF_FILE backup_time)
}
print FREQ_SPEC_NEW > CONF_FILE
print RRDB_CCMD_NEW > CONF_FILE
close(CONF_FILE)
if (renew_rrd_base > 1) {
PR("(re)creating the RRD base")
ex(RRDB_CCMD_NEW, 2)
}
}
watch_the_scenery()
}

BEGIN {
QUIET = 1
setup()
process_cmdline()
exit
}

END {
cleanup()
PRP("\n" PRGBNAME " " "exits with: " (ERR ? ERR : 0) " " "error(s)")
PRP("====== [" sprintf(" %5d ", PROCINFO["pid"]) "] program stop [" strftime() "] on " HOSTNAME " ======")
close(PROTOCOL)
exit ERR
}

!

[ -t 0 ] && STDIN="< /dev/null"
eval exec awk -f /usr/local/lib/l5.awklib -f $0_$$.awk $STDIN 2>&1



Das spuckt er mir aus:

Code:
[email protected]:~ $ sudo sh CableLoadMonitor.1
evaluating given downstream channel frequencies
downstream channel frequencies now in use: [ 31 ] 474 482 490 498 522 530 538 546 554 562 570 578 586 594 602 618 626 634 642 650 658 666 674 682 690 698 706 746 754 762 770
recording RRA step size: 10 seconds
recording RRA history size: 7 day(s) 0 hour(s) 0 minute(s) 0 second(s)
generating graph for: 1h recording length, size 2000x1000 pixels
generating graph for: 6h recording length, size 2000x1000 pixels
generating graph for: 1d recording length, size 2000x1000 pixels
generating graph for: 7d recording length, size 2000x1000 pixels
08:23:09:
dvbsnoop fails for [ 474 ], retrying...
CMD: systemctl stop sundtek; sleep 5; systemctl start sundtek; sleep 20
 

Holzlenkrad

Beiträge
65
Reaktionen
8
Ganz wichtig, hab ich total vergessen. Der zweite Tuner muss auch noch auf DVB-C gestellt werden. Also
dvb-fe-tool -a 1 -d DVB-C

Und bei dir fehlt noch:
if ( dvb_device % 2 == 0 ) {
next_device = 1
} else {
next_device = 0
}
Vor dem dvbtune
 
Zuletzt bearbeitet:

rv112

Beiträge
3.627
Reaktionen
29
Doch, ich hab das so auskommentiert und eingefügt wie Du gesagt hast. Z.B:

Code:
func scan_down_channels( \
RRDUPD_STR, BWIDTH_SUM, a, i, k)
{
PRF(strftime("%T: "))
for (i = 0; i < FREQ_CNT; ++i) {
# tuning via mediaclient not in use ATM
# ex("timeout 10 /opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 -m DVBC -f " FREQ * FREQ_FACTOR " -M Q256 -S 6952000")
# ex(LD_PL "timeout 10 dvbtune -f " FREQ * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a)
if (i == FREQ_CNT) { nohup dvbtune -c " next_device " -f " FREQ[0] * $FREQ_FACTOR " -s 6952 -qam 256 } else { nohup dvbtune -c " next_device " -f " FREQ[i + 1] * FREQ_FACTOR " -s 6952 -qam 256 }
ex("sleep 1") # <=== ZUSAETZLICHE ZEILE
a[1] += 0
if (a[1] && !dvbtune_ignerrs) {
PR("\n\n" a[0] ", please check your cables\n")
}
Am besten schickst Du mal Deine komplette Config Datei, ich seh nicht was ich wo wie ersetzen muss :(

PS: das neue Forum ist für sowas einfach nur Mist, sorry! Vielleicht sollte man das im kdg Forum besprechen, da ist die "alte" Forumsoftware drauf die deutlich komfortabler ist.
 

rv112

Beiträge
3.627
Reaktionen
29
Ich habs jetzt so, aber noch immer der gleiche Fehler:

Code:
#!/bin/sh
#
# DOCSIS cable load monitor
#
# tool to monitor downstream load on DOCSIS cable networks
#
# https://github.com/sp4rkie/docsis-cable-load-monitor
#
cat > $0_$$.awk << !
func setup( \ )
{ CLARGS = "$0|$1|$2|$3|$4|$5|$6|$7|$8|$9|${10}|${11}|${12}|${13}|${14}|${15}|${16}|${17}|${18}|${19}|${20}" # avoid dangling include files. incore inode still exists system("rm $0_$$.awk") # take care of shell expansion (if security is an issue) setup_lib($#, "awk|" CLARGS, $$, "`pwd`", "`hostname`", "$R_") PRP(CLARGS "\n") # required if Sundtek hardware is in use as we install with '-service' option LD_PL = "LD_PRELOAD=/opt/lib/libmediaclient.so " # where to find your TC4400 cable modem (if any) CABLE_MODEM_IP = "192.168.100.1" # file current recording parameters as incompatible changes must trigger a new RRD generation CONF_FILE = INSTPATH "CableLoadMonitor.cfg" FREQ_FACTOR = 1000000 # default RRDBASE RRDBASE_FILE = INSTPATH "CableLoadMonitor.rrd" RRDBASE_RRASTEPS = 10 # defaults to 10s RRDBASE_HISTSIZE = 60 * 60 * 24 * 7 # defaults to 1 week # default RRDGRAPH RRDGRAPH_NAME = INSTPATH "CableLoadMonitor" RRDGRAPH_EXT = ".png" RRDGRAPH_TMP = RRDGRAPH_NAME RRDGRAPH_EXT "_" RRDGRAPH_WIDTH = 1500 RRDGRAPH_HEIGHT = 1000 RRDGRAPH_Y_UPPER_LIMIT = 200 # scale Y axis to this minimum BWIDTH_SNAPSHOT = RRDGRAPH_NAME "_bwidth.txt" # feel free to add other history sizes (aka generated graphs) as well RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 " |1h" RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 6 " |6h" RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 " |1d" RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 7 " |7d" RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 30 " |30d" RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 365 " |365d" # --- rrdbase_rrasteps = RRDBASE_RRASTEPS rrdbase_histsize = RRDBASE_HISTSIZE rrdgraph_width = RRDGRAPH_WIDTH rrdgraph_height = RRDGRAPH_HEIGHT # --- define this to display a black theme if (++use_black_theme) { IF_BLACK_THEME = IF_BLACK_THEME "--color \"ARROW#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"BACK#000000\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"CANVAS#000000\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"GRID#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"MGRID#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"FONT#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"AXIS#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--color \"FRAME#ffffff\"" " \\\\\n" IF_BLACK_THEME = IF_BLACK_THEME "--border 1" " \\\\\n" } # --- define this to rescale the sum graph if (use_2nd_yaxis) { IF_2ND_YAXIS_SCALE = 10 IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis " 1 / IF_2ND_YAXIS_SCALE ":1" " \\\\\n" IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis-label sum" " \\\\\n" SUM_DEF = SUM_DEF sprintf("DEF:sum_=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n" SUM_DEF = SUM_DEF "CDEF:sum=sum_," IF_2ND_YAXIS_SCALE ",/" " \\\\\n" } else { SUM_DEF = SUM_DEF sprintf("DEF:sum=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n" }
}
func read_cfg( \ line, CMD, a)
{ if (ex("ls " CONF_FILE, 0, "^(" CONF_FILE ")$")) { CMD = "cat " CONF_FILE #PR("reading last recently used downstream channel frequencies and RRD parameters") FREQ_SPEC_CFG = ex_line(CMD) while ((line = ex_line(CMD)) != -1) { if (match(line, "^RRA:AVERAGE:.*:([0-9]+):([0-9]+)$", a)) { RRA_STEPS_CFG = a[1] HIST_SIZE_CFG = a[2] } } }
}
func exit_(msg \ )
{ PRE(msg) PRE("exiting...") ++ERR; exit
}
func set_freqs(str, \ i, a)
{ if (!match(str, "^[0-9]+(:[0-9]+)*$")) { return 0 } split(str, a, ":") for (i = 1; a[i]; ++i) { FREQ[FREQ_CNT++] = a[i] } return 1
}
func retrieve_down_freqs(freqs, \ URL, ignore, line, WGET, LYNX, i, a)
{ URL = "http://" CABLE_MODEM_IP "/cmconnectionstatus.html" if (freqs == "force_new_scan" || !freqs) { # # specific to TC4400 yet # PR("trying to retrieve downstream channel frequencies from TC4400 modem") WGET = "echo; wget --connect-timeout=1 -t 1 -q --http-user=admin --http-password=\"bEn2o#US9s\" " URL " -O -" LYNX = "lynx -nolist -width 300 -dump -stdin" while ((line = ex_line(WGET)) != -1) { if (match(line, "<script")) { ++ignore } else if (ignore) { if (match(line, "/script?")) { ignore = 0 } } else { print line |& LYNX } } close(LYNX, "to") while (LYNX |& getline line > 0) { if (match(line, "Locked +SC-QAM +Downstream +Bonded +([0-9]+) ", a)) { FREQ[FREQ_CNT++] = a[1] / FREQ_FACTOR } } close(LYNX) } else if (freqs) { PR("evaluating given downstream channel frequencies") if (!set_freqs(freqs)) { exit_("can't handle the given downstream channel frequency specification") } } else { # error -> will exit } PRF("downstream channel frequencies now in use: ") if (!FREQ_CNT) { exit_("could not retrieve any") } PRF("[ " FREQ_CNT " ] ") for (i = 0; i < FREQ_CNT; ++i) { PRF(FREQ[i] " ") BWIDTH_OF[i] = "na" FREQ_SPEC_NEW = FREQ_SPEC_NEW (FREQ_SPEC_NEW ? ":" : "") FREQ[i] } PR("")
}
func assemble_rrdcreate_cmd( \ CMD, i)
{ CMD = "rrdtool create " RRDBASE_FILE " -s 1" " \\\\\n" for (i = 0; i < FREQ_CNT; ++i) { CMD = CMD sprintf("DS:f%02d:GAUGE:120:U:U", i) " \\\\\n" } CMD = CMD sprintf("DS:sum:GAUGE:120:U:U") " \\\\\n" CMD = CMD sprintf("RRA:AVERAGE:0.1:" rrdbase_rrasteps ":" rrdbase_histsize) RRDB_CCMD_NEW = CMD
}
func assemble_rrdgraph_cmd(end, size, \ group, GROUPS, CMD, i, k)
{ # use the first version if interested in average and min too GROUPS = "MAX:max:MIN:min:LAST:last:AVERAGE:avg" GROUPS = "MAX:max:LAST:last" split(GROUPS, group, ":") CMD = "rrdtool graph " RRDGRAPH_TMP " -a PNG -l 0 -u " RRDGRAPH_Y_UPPER_LIMIT * FREQ_FACTOR " \\\\\n" \ "--title=\"Graph generated at \`date\`\"" " \\\\\n" \ "-w " rrdgraph_width " -h " rrdgraph_height " \\\\\n" \ "--end " end " --start end-" size "s" " \\\\\n" CMD = CMD " \\\\\n" CMD = CMD IF_BLACK_THEME " \\\\\n" CMD = CMD IF_2ND_YAXIS " \\\\\n" CMD = CMD " \\\\\n" for (i = 0; i < FREQ_CNT; ++i) { CMD = CMD sprintf("DEF:f%02d=" RRDBASE_FILE ":f%02d:AVERAGE", i, i) " \\\\\n" } CMD = CMD SUM_DEF " \\\\\n" CMD = CMD " \\\\\n" for (i = 0; i < FREQ_CNT; ++i) { if (i < FREQ_CNT / 2) { CMD = CMD sprintf("\"LINE:f%02d#ff0000:%d\"", i, FREQ[i]) " \\\\\n" } else { CMD = CMD sprintf("\"LINE:f%02d#0000ff:%d\"", i, FREQ[i]) " \\\\\n" } } CMD = CMD " \\\\\n" CMD = CMD "\"LINE:sum#00ff00:sum\\\l\"" " \\\\\n" CMD = CMD " \\\\\n" for (k = 1; group[k]; k += 2) { for (i = 0; i < FREQ_CNT; ++i) { CMD = CMD sprintf("\"GPRINT:f%02d:%s:%%3.0lf %%s\"", i, group[k]) " \\\\\n" } CMD = CMD sprintf("\"GPRINT:%s:%s:%%3.0lf %%s\"", "sum", group[k]) CMD = CMD "\" " group[k + 1] "\\\l\"" " \\\\\n" } return CMD
}
func assemble_rrdgraphs_cmd( \ i, a)
{ for (i = 0; i < RRDGRAPHS_CNT; ++i) { split(RRDGRAPHS[i], a, "|") if (a[1] > rrdbase_histsize) { break } RRDGRAPH_CMD[i] = assemble_rrdgraph_cmd("now", gensub(" +", "", "g", a[1])) RRDGRAPH_FILE[i] = RRDGRAPH_NAME "_" a[2] RRDGRAPH_EXT PR("generating graph for: " sprintf("%4s", a[2]) " recording length, size " rrdgraph_width "x" rrdgraph_height " pixels") }
}
func scan_down_channels( \ RRDUPD_STR, BWIDTH_SUM, a, i, k)
{ PRF(strftime("%T: ")) for (i = 0; i < FREQ_CNT; ++i) {
# tuning via mediaclient not in use ATM
# ex("timeout 10 /opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 -m DVBC -f " FREQ[i] * FREQ_FACTOR " -M Q256 -S 6952000")
# ex(LD_PL "timeout 10 dvbtune -f " FREQ[i] * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a) if ( dvb_device % 2 == 0 ) { next_device = 1 } else { next_device = 0 } if (i == FREQ_CNT) { nohup dvbtune -c " next_device " -f " FREQ[0] * $FREQ_FACTOR " -s 6952 -qam 256 } else { nohup dvbtune -c " next_device " -f " FREQ[i + 1] * FREQ_FACTOR " -s 6952 -qam 256 } a[1] += 0 if (a[1] && !dvbtune_ignerrs) { PR("\n\n" a[0] ", please check your cables\n") } # # in case of very small bandwidth values limit the measurement # interval to something useful to keep the overall scan time sufficiently low. # # the arbitrarily chosen stop value of 80000 appears to be high enough to even # handle high bandwidths with enough accuracy. # if (!ex("timeout 1 dvbsnoop -adapter " dvb_device " -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) { if (BWIDTH_OF[FREQ_CNT - 1] != "na") { RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000 ex(RRDUPD_STR, 2) } # # UPDATE as of 2019_08_03: # - in the event of dvbsnoop failure: no longer exit but retry instead # - you may want to reload your DVB drivers if these crashed # PR("\ndvbsnoop fails for [ " FREQ[i] " ], retrying...") # # place your specific driver reload code here # ex("systemctl stop sundtek; sleep 5; systemctl start sundtek; sleep 20", 1) --i; continue
# exit_("dvbsnoop fails") } BWIDTH_OF[i] = int(a[1] + 0.5) PRF(sprintf("%6s", BWIDTH_OF[i])) BWIDTH_SUM = 0 RRDUPD_STR = "rrdtool update " RRDBASE_FILE " N" for (k = 0; k < FREQ_CNT; ++k) { BWIDTH_SUM += BWIDTH_OF[k] RRDUPD_STR = RRDUPD_STR ":" BWIDTH_OF[k] * 1000 } # # do not update until the initial scan completes # if (BWIDTH_OF[FREQ_CNT - 1] != "na") { RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000 ex(RRDUPD_STR, 2) } } PR(sprintf("%7s", BWIDTH_SUM)) print BWIDTH_SUM > BWIDTH_SNAPSHOT; close(BWIDTH_SNAPSHOT)
}
func generate_rrdgraphs( \ i)
{ for (i = 0; RRDGRAPH_CMD[i]; ++i) { ex(RRDGRAPH_CMD[i]) ex("mv " RRDGRAPH_TMP " " RRDGRAPH_FILE[i], 2) }
}
func watch_the_scenery( \ )
{ # # some inital setup specific to certain devices. this may fail # on one or another device. don't care. # # # fix for: # * Silicon Labs Si2168 card not compatible? · Issue #1 · sp4rkie/docsis-cable-load-monitor # https://github.com/sp4rkie/docsis-cable-load-monitor/issues/1 # ex("echo 0 | sudo tee -a /sys/module/dvb_core/parameters/dvb_powerdown_on_sleep") # # fix for: # * set dtvmode # https://www.unitymediaforum.de/viewtopic.php?p=428995#p428995 # ex("/opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 --setdtvmode=DVBC") while (1) { generate_rrdgraphs() scan_down_channels() }
}
func usage( \ locked, line, a)
{ PR("Usage: " PRGBNAME) while ((line = ex_line("cat " PRGNAME)) != -1) { if (locked) { if (match(line, "match[^,]+, \"(.+)\"[^\"]+# (.*)$", a)) { PR(sprintf(" %-21s - %s", gensub("\\\\$", "", "g", a[1]), a[2])) } } else { if (match(line, "^func process_cmdline")) ++locked } } PR("\ndefaults:") PR(" -c " sprintf("%-10d", RRDBASE_RRASTEPS) " # 10 secs") PR(" -r " sprintf("%-10d", RRDBASE_HISTSIZE) " # 1 week" ) PR(" -w " sprintf("%-10d", RRDGRAPH_WIDTH) ) PR(" -h " sprintf("%-10d", RRDGRAPH_HEIGHT) )
}
func process_cmdline( \ renew_rrd_base, backup_time, freq_list, i, a)
{ read_cfg() if (FREQ_SPEC_CFG) freq_list = FREQ_SPEC_CFG if (RRA_STEPS_CFG) rrdbase_rrasteps = RRA_STEPS_CFG if (HIST_SIZE_CFG) rrdbase_histsize = HIST_SIZE_CFG # # regexps for arg matching are kept somewhat sloppy to avoid clutter in usage() text output # for (i = 2; i < _ARGC; ++i) { if (match(_ARGV[i] _ARGV[i + 1], "-h$")) { # print this help and exit usage() exit } else if (match(_ARGV[i] " " _ARGV[i + 1], "-f [0-9]+(:[0-9]+)*$")) { # manually specify downstream channel frequencies freq_list = _ARGV[i + 1] ++i } else if (match(_ARGV[i], "-f$")) { # scan a TC4400 for current downstream channel freqs freq_list = "force_new_scan" } else if (match(_ARGV[i] " " _ARGV[i + 1], "-c [0-9]+$")) { # create a RRD base with given RRA steps (in secs) rrdbase_rrasteps = _ARGV[i + 1] ++i } else if (match(_ARGV[i] " " _ARGV[i + 1], "-r [0-9]+$")) { # recording history size (in secs) rrdbase_histsize = _ARGV[i + 1] ++i } else if (match(_ARGV[i] " " _ARGV[i + 1], "-w [0-9]+$")) { # width of generated graph(s) rrdgraph_width = _ARGV[i + 1] ++i } else if (match(_ARGV[i] " " _ARGV[i + 1], "-h [0-9]+$")) { # height of generated graph(s) rrdgraph_height = _ARGV[i + 1] ++i } else if (match(_ARGV[i] " " _ARGV[i + 1] " " _ARGV[i + 2], "-g [0-9]+ [0-9]+$")) { # generate a graph with given end and length (in secs) rrdgraph_histend = strftime("%s") - _ARGV[i + 1] rrdgraph_length = _ARGV[i + 2] i += 2 } else if (match(_ARGV[i], "-i$")) { # ignore errors reported by dvbtune ++dvbtune_ignerrs } else { usage() ++ERR; exit } } retrieve_down_freqs(freq_list) if (rrdgraph_histend) { PR("point in time where the generated graph ends: " strftime("%T", rrdgraph_histend)) PR("time span covered by the generated graph: " rrdgraph_length "s") PR("graph is written to: " RRDGRAPH_NAME RRDGRAPH_EXT) ex(assemble_rrdgraph_cmd(rrdgraph_histend, rrdgraph_length), 2) ex("mv " RRDGRAPH_TMP " " RRDGRAPH_NAME RRDGRAPH_EXT) exit } PR("recording RRA step size: " rrdbase_rrasteps " seconds") PR("recording RRA history size: " \ int(rrdbase_histsize / (60 * 60 * 24)) " day(s) " \ int(rrdbase_histsize % (60 * 60 * 24) / (60 * 60 )) " hour(s) " \ int(rrdbase_histsize % (60 * 60 ) / (60 )) " minute(s) " \ int(rrdbase_histsize % (60 ) ) " second(s) " \ ) if (dvbtune_ignerrs) PR("dvbtune: " "ignore bit errors") assemble_rrdcreate_cmd() assemble_rrdgraphs_cmd() if (split(FREQ_SPEC_CFG, a, ":") != split(FREQ_SPEC_NEW, a, ":")) { if (FREQ_SPEC_CFG) PR("count of monitored channel frequencies did change") renew_rrd_base += 2 } else if (FREQ_SPEC_CFG != FREQ_SPEC_NEW) { if (FREQ_SPEC_CFG) PR("values of monitored channel frequencies did change") renew_rrd_base += 1 } if (RRA_STEPS_CFG != rrdbase_rrasteps \ || HIST_SIZE_CFG != rrdbase_histsize) { if (RRA_STEPS_CFG) PR("RRD base recording parameters did change") renew_rrd_base += 2 } if (renew_rrd_base) { if (ex("ls " RRDBASE_FILE, 0 ,"^(" RRDBASE_FILE ")$")) { backup_time = strftime(".%Y-%m-%d_%T") PR("backing up old RRD data") ex("cp -va " RRDBASE_FILE " " RRDBASE_FILE backup_time) ex("cp -va " CONF_FILE " " CONF_FILE backup_time) } print FREQ_SPEC_NEW > CONF_FILE print RRDB_CCMD_NEW > CONF_FILE close(CONF_FILE) if (renew_rrd_base > 1) { PR("(re)creating the RRD base") ex(RRDB_CCMD_NEW, 2) } } watch_the_scenery()
}
BEGIN { QUIET = 1 setup() process_cmdline() exit
}
END { cleanup() PRP("\n" PRGBNAME " " "exits with: " (ERR ? ERR : 0) " " "error(s)") PRP("====== [" sprintf(" %5d ", PROCINFO["pid"]) "] program stop [" strftime() "] on " HOSTNAME " ======") close(PROTOCOL) exit ERR
}
!
[ -t 0 ] && STDIN="< /dev/null"
eval exec awk -f /usr/local/lib/l5.awklib -f $0_$$.awk $STDIN 2>&1
Wo genau kommt das "
dvb_device = 0 ex("nohub dvbtune -c " dvb_device " -f " FREQ[0] * FREQ_FACTOR " -s 6952 -qam 256") while (1) { generate_rrdgraphs() scan_down_channels() }" hin?
 

MartinP_Do

Beiträge
2.714
Reaktionen
15
Irgendwie finde ich die man-pages zu den DVB-Tools etwas spartanisch.

ich komme immer noch nicht weiter.

Hier herrscht immer noch Funkstille, keine Ausgabe... nach 30 Minuten habe ich das abgebrochen

Code:
[email protected]:~ $ dvbsnoop -s bandwidth 8190 -n 800
dvbsnoop V1.4.50 -- http://dvbsnoop.sourceforge.net/
---------------------------------------------------------
PID bandwidth statistics...
PID: 8190 (0x1ffe) - max packet count: 800
---------------------------------------------------------
^C
Gibt es irgendetwas Simples, mit dem man erstmal überprüfen kann, ob der Stick überhaupt etwas empfängt?

Z. B. Tunen auf einen Kanal, und Ausgabe der Signalstärke usw?

Der Raspberry Pi B+ hängt direkt neben der Vierloch-Multimediadose am zweiten Data-Anschluss im Kellertreppenabgang neben Besen, Schrubber und der Fritzbox. Deshalb Headless und ich habe nur ein SSH-Terminalsession... Ansonsten hätte ich ggfs. Kaffeine installiert, und einen Suchlauf gemacht ...
 

rv112

Beiträge
3.627
Reaktionen
29
OK, also mit dieser Config geht es nun:

#!/bin/sh

#
# DOCSIS cable load monitor
#
# tool to monitor downstream load on DOCSIS cable networks
#
# https://github.com/sp4rkie/docsis-cable-load-monitor
#

cat > $0_$$.awk << !

func setup( \
)
{
CLARGS = "$0|$1|$2|$3|$4|$5|$6|$7|$8|$9|${10}|${11}|${12}|${13}|${14}|${15}|${16}|${17}|${18}|${19}|${20}"

# avoid dangling include files. incore inode still exists
system("rm $0_$$.awk")

# take care of shell expansion (if security is an issue)
setup_lib($#, "awk|" CLARGS, $$, "`pwd`", "`hostname`", "$R_")
PRP(CLARGS "\n")

# required if Sundtek hardware is in use as we install with '-service' option
LD_PL = "LD_PRELOAD=/opt/lib/libmediaclient.so "

# where to find your TC4400 cable modem (if any)
CABLE_MODEM_IP = "192.168.100.1"

# file current recording parameters as incompatible changes must trigger a new RRD generation
CONF_FILE = INSTPATH "CableLoadMonitor.cfg"
FREQ_FACTOR = 1000000

# default RRDBASE
RRDBASE_FILE = INSTPATH "CableLoadMonitor.rrd"
RRDBASE_RRASTEPS = 10 # defaults to 10s
RRDBASE_HISTSIZE = 60 * 60 * 24 * 7 # defaults to 1 week

# default RRDGRAPH
RRDGRAPH_NAME = "/var/www/html/" "CableLoadMonitor"
RRDGRAPH_EXT = ".png"
RRDGRAPH_TMP = RRDGRAPH_NAME RRDGRAPH_EXT "_"
RRDGRAPH_WIDTH = 2000
RRDGRAPH_HEIGHT = 1000
RRDGRAPH_Y_UPPER_LIMIT = 200 # scale Y axis to this minimum
BWIDTH_SNAPSHOT = RRDGRAPH_NAME "_bwidth.txt"

# feel free to add other history sizes (aka generated graphs) as well
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 " |1h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 6 " |6h"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 " |1d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 7 " |7d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 30 " |30d"
RRDGRAPHS[RRDGRAPHS_CNT++] = 60 * 60 * 24 * 365 " |365d"

# ---
rrdbase_rrasteps = RRDBASE_RRASTEPS
rrdbase_histsize = RRDBASE_HISTSIZE
rrdgraph_width = RRDGRAPH_WIDTH
rrdgraph_height = RRDGRAPH_HEIGHT

# --- define this to display a black theme
if (++use_black_theme) {
IF_BLACK_THEME = IF_BLACK_THEME "--color \"ARROW#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"BACK#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"CANVAS#000000\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"GRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"MGRID#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FONT#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"AXIS#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--color \"FRAME#ffffff\"" " \\\\\n"
IF_BLACK_THEME = IF_BLACK_THEME "--border 1" " \\\\\n"
}
# --- define this to rescale the sum graph
if (use_2nd_yaxis) {
IF_2ND_YAXIS_SCALE = 10

IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis " 1 / IF_2ND_YAXIS_SCALE ":1" " \\\\\n"
IF_2ND_YAXIS = IF_2ND_YAXIS "--right-axis-label sum" " \\\\\n"

SUM_DEF = SUM_DEF sprintf("DEF:sum_=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
SUM_DEF = SUM_DEF "CDEF:sum=sum_," IF_2ND_YAXIS_SCALE ",/" " \\\\\n"
} else {
SUM_DEF = SUM_DEF sprintf("DEF:sum=" RRDBASE_FILE ":sum:AVERAGE", i, i) " \\\\\n"
}
}

func read_cfg( \
line, CMD, a)
{
if (ex("ls " CONF_FILE, 0, "^(" CONF_FILE ")$")) {
CMD = "cat " CONF_FILE
#PR("reading last recently used downstream channel frequencies and RRD parameters")
FREQ_SPEC_CFG = ex_line(CMD)
while ((line = ex_line(CMD)) != -1) {
if (match(line, "^RRA:AVERAGE:.*:([0-9]+):([0-9]+)$", a)) {
RRA_STEPS_CFG = a[1]
HIST_SIZE_CFG = a[2]
}
}
}
}

func exit_(msg \
)
{
PRE(msg)
PRE("exiting...")
++ERR; exit
}

func set_freqs(str, \
i, a)
{
if (!match(str, "^[0-9]+:)[0-9]+)*$")) {
return 0
}
split(str, a, ":")
for (i = 1; a; ++i) {
FREQ[FREQ_CNT++] = a
}
return 1
}

func retrieve_down_freqs(freqs, \
URL, ignore, line, WGET, LYNX, i, a)
{
URL = "http://" CABLE_MODEM_IP "/cmconnectionstatus.html"

if (freqs == "force_new_scan" || !freqs) {

#
# specific to TC4400 yet
#
PR("trying to retrieve downstream channel frequencies from TC4400 modem")
WGET = "echo; wget --connect-timeout=1 -t 1 -q --http-user=admin --http-password=\"bEn2o#US9s\" " URL " -O -"
LYNX = "lynx -nolist -width 300 -dump -stdin"
while ((line = ex_line(WGET)) != -1) {
if (match(line, "<script")) {
++ignore
} else if (ignore) {
if (match(line, "/script?")) {
ignore = 0
}
} else {
print line |& LYNX
}
}
close(LYNX, "to")
while (LYNX |& getline line > 0) {
if (match(line, "Locked +SC-QAM +Downstream +Bonded +([0-9]+) ", a)) {
FREQ[FREQ_CNT++] = a[1] / FREQ_FACTOR
}
}
close(LYNX)
} else if (freqs) {
PR("evaluating given downstream channel frequencies")
if (!set_freqs(freqs)) {
exit_("can't handle the given downstream channel frequency specification")
}
} else {
# error -> will exit
}
PRF("downstream channel frequencies now in use: ")
if (!FREQ_CNT) {
exit_("could not retrieve any")
}
PRF("[ " FREQ_CNT " ] ")
for (i = 0; i < FREQ_CNT; ++i) {
PRF(FREQ " ")
BWIDTH_OF = "na"
FREQ_SPEC_NEW = FREQ_SPEC_NEW (FREQ_SPEC_NEW ? ":" : "") FREQ
}
PR("")
}

func assemble_rrdcreate_cmd( \
CMD, i)
{
CMD = "rrdtool create " RRDBASE_FILE " -s 1" " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DS:f%02d:GAUGE:120:U:U", i) " \\\\\n"
}
CMD = CMD sprintf("DS:sum:GAUGE:120:U:U") " \\\\\n"
CMD = CMD sprintf("RRA:AVERAGE:0.1:" rrdbase_rrasteps ":" rrdbase_histsize)
RRDB_CCMD_NEW = CMD
}

func assemble_rrdgraph_cmd(end, size, \
group, GROUPS, CMD, i, k)
{
# use the first version if interested in average and min too
GROUPS = "MAX:max:MIN:min:LAST:last:AVERAGE:avg"
GROUPS = "MAX:max:LAST:last"
split(GROUPS, group, ":")

CMD = "rrdtool graph " RRDGRAPH_TMP " -a PNG -l 0 -u " RRDGRAPH_Y_UPPER_LIMIT * FREQ_FACTOR " \\\\\n" \
"--title=\"Graph generated at \`date\`\"" " \\\\\n" \
"-w " rrdgraph_width " -h " rrdgraph_height " \\\\\n" \
"--end " end " --start end-" size "s" " \\\\\n"
CMD = CMD " \\\\\n"
CMD = CMD IF_BLACK_THEME " \\\\\n"
CMD = CMD IF_2ND_YAXIS " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("DEF:f%02d=" RRDBASE_FILE ":f%02d:AVERAGE", i, i) " \\\\\n"
}
CMD = CMD SUM_DEF " \\\\\n"
CMD = CMD " \\\\\n"
for (i = 0; i < FREQ_CNT; ++i) {
if (i < FREQ_CNT / 2) {
CMD = CMD sprintf("\"LINE:f%02d#ff0000:%d\"", i, FREQ) " \\\\\n"
} else {
CMD = CMD sprintf("\"LINE:f%02d#0000ff:%d\"", i, FREQ) " \\\\\n"
}
}
CMD = CMD " \\\\\n"
CMD = CMD "\"LINE:sum#00ff00:sum\\\l\"" " \\\\\n"
CMD = CMD " \\\\\n"
for (k = 1; group[k]; k += 2) {
for (i = 0; i < FREQ_CNT; ++i) {
CMD = CMD sprintf("\"GPRINT:f%02d:%s:%%3.0lf %%s\"", i, group[k]) " \\\\\n"
}
CMD = CMD sprintf("\"GPRINT:%s:%s:%%3.0lf %%s\"", "sum", group[k])
CMD = CMD "\" " group[k + 1] "\\\l\"" " \\\\\n"
}
return CMD
}

func assemble_rrdgraphs_cmd( \
i, a)
{
for (i = 0; i < RRDGRAPHS_CNT; ++i) {
split(RRDGRAPHS, a, "|")
if (a[1] > rrdbase_histsize) {
break
}
RRDGRAPH_CMD = assemble_rrdgraph_cmd("now", gensub(" +", "", "g", a[1]))
RRDGRAPH_FILE = RRDGRAPH_NAME "_" a[2] RRDGRAPH_EXT
PR("generating graph for: " sprintf("%4s", a[2]) " recording length, size " rrdgraph_width "x" rrdgraph_height " pixels")
}
}

func scan_down_channels( \
RRDUPD_STR, BWIDTH_SUM, a, i, k)
{
PRF(strftime("%T: "))
for (i = 0; i < FREQ_CNT; ++i) {
# tuning via mediaclient not in use ATM
# ex("timeout 10 /opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 -m DVBC -f " FREQ * FREQ_FACTOR " -M Q256 -S 6952000")
# ex(LD_PL "timeout 10 dvbtune -f " FREQ * FREQ_FACTOR " -s 6952 -qam 256", 0, "Bit error rate: ([0-9]+)$", a)
if ( dvb_device % 2 == 0 ) {
next_device = 1
} else {
next_device = 0
}

if (i == FREQ_CNT) {
nohup dvbtune -c " next_device " -f " FREQ[0] * $FREQ_FACTOR " -s 6952 -qam 256
} else {
nohup dvbtune -c " next_device " -f " FREQ[i + 1] * FREQ_FACTOR " -s 6952 -qam 256
}
#nohup cmd
# PR("\nusing [ " cmd " ]")

ex("timeout 2 dvbsnoop -adapter " dvb_device " -s bandwidth 8190 -n 100")

#
# in case of very small bandwidth values limit the measurement
# interval to something useful to keep the overall scan time sufficiently low.
#
# the arbitrarily chosen stop value of 80000 appears to be high enough to even
# handle high bandwidths with enough accuracy.
#
# PR("\nscanning for [ " FREQ " ] on device " dvb_device " with dvbsnoop ...")
if (!ex("timeout 1 dvbsnoop -adapter " dvb_device " -s bandwidth 8190 -n 80000", 0, "^## PID:.*Avrg: +([^ ]+) ", a)) {

#
# UPDATE as of 2019_08_03:
# - in the event of dvbsnoop failure: no longer exit but retry instead
# - you may want to reload your DVB drivers if these crashed
#
PR("\ndvbsnoop fails for [ " FREQ " ], retrying...")

#
# place your specific driver reload code here
#
ex("systemctl stop sundtek; sleep 5; systemctl start sundtek; sleep 20", 1)
--i; continue
# exit_("dvbsnoop fails")
}
BWIDTH_OF = int(a[1] + 0.5)
PRF(sprintf("%6s", BWIDTH_OF))
BWIDTH_SUM = 0
RRDUPD_STR = "rrdtool update " RRDBASE_FILE " N"
for (k = 0; k < FREQ_CNT; ++k) {
BWIDTH_SUM += BWIDTH_OF[k]
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_OF[k] * 1000
}
#
# do not update until the initial scan completes
#
if (BWIDTH_OF[FREQ_CNT - 1] != "na") {
RRDUPD_STR = RRDUPD_STR ":" BWIDTH_SUM * 1000
ex(RRDUPD_STR, 2)
}

dvb_device = next_device
}
PR(sprintf("%7s", BWIDTH_SUM))
print BWIDTH_SUM > BWIDTH_SNAPSHOT; close(BWIDTH_SNAPSHOT)
}

func generate_rrdgraphs( \
i)
{
for (i = 0; RRDGRAPH_CMD; ++i) {
ex(RRDGRAPH_CMD)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_FILE, 2)
}
}

func watch_the_scenery( \
)
{
#
# some inital setup specific to certain devices. this may fail
# on one or another device. don't care.
#

#
# fix for:
# * Silicon Labs Si2168 card not compatible? · Issue #1 · sp4rkie/docsis-cable-load-monitor
# https://github.com/sp4rkie/docsis-cable-load-monitor/issues/1
#
ex("echo 0 | sudo tee -a /sys/module/dvb_core/parameters/dvb_powerdown_on_sleep")

#
# fix for:
# * set dtvmode
# https://www.unitymediaforum.de/viewtopic.php?p=428995#p428995
#
ex("/opt/bin/mediaclient -d /dev/dvb/adapter0/frontend0 --setdtvmode=DVBC")
dvb_device = 0
ex("nohub dvbtune -c " dvb_device " -f " FREQ[0] * FREQ_FACTOR " -s 6952 -qam 256")

while (1) {
generate_rrdgraphs()
scan_down_channels()
}
}

func usage( \
locked, line, a)
{
PR("Usage: " PRGBNAME)
while ((line = ex_line("cat " PRGNAME)) != -1) {
if (locked) {
if (match(line, "match[^,]+, \"(.+)\"[^\"]+# (.*)$", a)) {
PR(sprintf(" %-21s - %s", gensub("\\\\$", "", "g", a[1]), a[2]))
}
} else {
if (match(line, "^func process_cmdline")) ++locked
}
}
PR("\ndefaults:")
PR(" -c " sprintf("%-10d", RRDBASE_RRASTEPS) " # 10 secs")
PR(" -r " sprintf("%-10d", RRDBASE_HISTSIZE) " # 1 week" )
PR(" -w " sprintf("%-10d", RRDGRAPH_WIDTH) )
PR(" -h " sprintf("%-10d", RRDGRAPH_HEIGHT) )
}

func process_cmdline( \
renew_rrd_base, backup_time, freq_list, i, a)
{
read_cfg()
if (FREQ_SPEC_CFG) freq_list = FREQ_SPEC_CFG
if (RRA_STEPS_CFG) rrdbase_rrasteps = RRA_STEPS_CFG
if (HIST_SIZE_CFG) rrdbase_histsize = HIST_SIZE_CFG

#
# regexps for arg matching are kept somewhat sloppy to avoid clutter in usage() text output
#
for (i = 2; i < _ARGC; ++i) {
if (match(_ARGV _ARGV[i + 1], "-h$")) { # print this help and exit
usage()
exit
} else if (match(_ARGV " " _ARGV[i + 1], "-f [0-9]+:)[0-9]+)*$")) { # manually specify downstream channel frequencies
freq_list = _ARGV[i + 1]
++i
} else if (match(_ARGV, "-f$")) { # scan a TC4400 for current downstream channel freqs
freq_list = "force_new_scan"
} else if (match(_ARGV " " _ARGV[i + 1], "-c [0-9]+$")) { # create a RRD base with given RRA steps (in secs)
rrdbase_rrasteps = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-r [0-9]+$")) { # recording history size (in secs)
rrdbase_histsize = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-w [0-9]+$")) { # width of generated graph(s)
rrdgraph_width = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1], "-h [0-9]+$")) { # height of generated graph(s)
rrdgraph_height = _ARGV[i + 1]
++i
} else if (match(_ARGV " " _ARGV[i + 1] " " _ARGV[i + 2], "-g [0-9]+ [0-9]+$")) { # generate a graph with given end and length (in secs)
rrdgraph_histend = strftime("%s") - _ARGV[i + 1]
rrdgraph_length = _ARGV[i + 2]
i += 2
} else if (match(_ARGV, "-i$")) { # ignore errors reported by dvbtune
++dvbtune_ignerrs
} else {
usage()
++ERR; exit
}
}
retrieve_down_freqs(freq_list)
if (rrdgraph_histend) {
PR("point in time where the generated graph ends: " strftime("%T", rrdgraph_histend))
PR("time span covered by the generated graph: " rrdgraph_length "s")
PR("graph is written to: " RRDGRAPH_NAME RRDGRAPH_EXT)
ex(assemble_rrdgraph_cmd(rrdgraph_histend, rrdgraph_length), 2)
ex("mv " RRDGRAPH_TMP " " RRDGRAPH_NAME RRDGRAPH_EXT)
exit
}
PR("recording RRA step size: " rrdbase_rrasteps " seconds")
PR("recording RRA history size: " \
int(rrdbase_histsize / (60 * 60 * 24)) " day(s) " \
int(rrdbase_histsize % (60 * 60 * 24) / (60 * 60 )) " hour(s) " \
int(rrdbase_histsize % (60 * 60 ) / (60 )) " minute(s) " \
int(rrdbase_histsize % (60 ) ) " second(s) " \
)
if (dvbtune_ignerrs) PR("dvbtune: " "ignore bit errors")
assemble_rrdcreate_cmd()
assemble_rrdgraphs_cmd()
if (split(FREQ_SPEC_CFG, a, ":") != split(FREQ_SPEC_NEW, a, ":")) {
if (FREQ_SPEC_CFG) PR("count of monitored channel frequencies did change")
renew_rrd_base += 2
} else if (FREQ_SPEC_CFG != FREQ_SPEC_NEW) {
if (FREQ_SPEC_CFG) PR("values of monitored channel frequencies did change")
renew_rrd_base += 1
}
if (RRA_STEPS_CFG != rrdbase_rrasteps \
|| HIST_SIZE_CFG != rrdbase_histsize) {
if (RRA_STEPS_CFG) PR("RRD base recording parameters did change")
renew_rrd_base += 2
}
if (renew_rrd_base) {
if (ex("ls " RRDBASE_FILE, 0 ,"^(" RRDBASE_FILE ")$")) {
backup_time = strftime(".%Y-%m-%d_%T")
PR("backing up old RRD data")
ex("cp -va " RRDBASE_FILE " " RRDBASE_FILE backup_time)
ex("cp -va " CONF_FILE " " CONF_FILE backup_time)
}
print FREQ_SPEC_NEW > CONF_FILE
print RRDB_CCMD_NEW > CONF_FILE
close(CONF_FILE)
if (renew_rrd_base > 1) {
PR("(re)creating the RRD base")
ex(RRDB_CCMD_NEW, 2)
}
}
watch_the_scenery()
}

BEGIN {
QUIET = 1
setup()
process_cmdline()
exit
}

END {
cleanup()
PRP("\n" PRGBNAME " " "exits with: " (ERR ? ERR : 0) " " "error(s)")
PRP("====== [" sprintf(" %5d ", PROCINFO["pid"]) "] program stop [" strftime() "] on " HOSTNAME " ======")
close(PROTOCOL)
exit ERR
}

!

[ -t 0 ] && STDIN="< /dev/null"
eval exec awk -f /usr/local/lib/l5.awklib -f $0_$$.awk $STDIN 2>&1

Allerdings muss ich davor noch "dvbtune -c 1 -f 546000000 -s 6952 -qam 256 dvbsnoop -adapter 1 -s bandwidth 8190 -n 10000" und "dvbtune -c 0 -f 546000000 -s 6952 -qam 256 dvbsnoop -adapter 0 -s bandwidth 8190 -n 10000" ausführen. Danke an @Holzlenkrad!

@MartinP_Do Nehm doch einen VNC Viewer, so verbinde ich mich darauf.
 

MartinP_Do

Beiträge
2.714
Reaktionen
15
So, habe etwas hilfreiches gefunden

Code:
sudo apt-get install w-scan
danach (mit Unterstrich statt Minuszeichen!)

Code:
w_scan -fc
w_scan version 20170107 (compiled for DVB API 5.10)
WARNING: could not guess your country. Falling back to 'DE'
guessing country 'DE', use -c <country> to override
using settings for GERMANY
DVB cable
DVB-C
scan type CABLE, channellist 7
output format vdr-2.0
WARNING: could not guess your codepage. Falling back to 'UTF-8'
output charset 'UTF-8', use -C <charset> to override
Info: using DVB adapter auto detection. /dev/dvb/adapter0/frontend0 -> CABLE "Silicon Labs Si2168": very good :-))
Using CABLE frontend (adapter /dev/dvb/adapter0/frontend0)
-_-_-_-_ Getting frontend capabilities-_-_-_-_
Using DVB API 5.11
frontend 'Silicon Labs Si2168' supports
INVERSION_AUTO
QAM_AUTO
FEC_AUTO
FREQ (42.00MHz ... 870.00MHz)
SRATE (1.000MSym/s ... 7.200MSym/s)
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
73000: sr6900 (time: 00:00.099) sr6875 (time: 00:01.609)
81000: sr6900 (time: 00:04.999) sr6875 (time: 00:08.379)
....
.... new transponder: (QAM_256 f = 274000 kHz S6900C0 (9999:9999:141)) 0x4044 ... 546000: sr6900 (time: 01:15.718) signal ok: QAM_AUTO f = 546000 kHz S6900C999 (0:0:0) Info: no data from PAT after 2 seconds deleting (QAM_AUTO f = 546000 kHz S6900C999 (0:0:0))
...
850000: sr6900 (time: 03:44.836) ^C
ERROR: interrupted by SIGINT, dumping partial result...
(time: 03:46.346) dumping lists (0 services)
..
Done, scan time: 03:46.346
[email protected]:~
 
Andreas1969

Andreas1969

Beiträge
16.132
Reaktionen
71
Jetzt habe ich auch mal eine Frage dazu.
Die Fritten unterstützen ja seit OS7.xx das SAT-IP Protokoll, wodurch sich ja im Prinzip alle Frequenzen tunen lassen.
Wäre es eventuell denkbar / möglich, auch die Tuner der Fritte über das SAT-IP Protokoll irgendwie anzusprechen / auszulesen?

Hintergrund: Mit einem DVB-C Stick lässt sich ja der OFDM Block nicht mitschneiden.
Wenn mit einer zukünftigen FW die TV Funktionalität in der 6591 implementiert wird, sollte sich doch dann theoretisch auch die OFDM Auslastung auslesen lassen, oder ist das zu einfach gedacht?
 

MartinP_Do

Beiträge
2.714
Reaktionen
15
Jetzt habe ich auch mal eine Frage dazu.
Die Fritten unterstützen ja seit OS7.xx das SAT-IP Protokoll, wodurch sich ja im Prinzip alle Frequenzen tunen lassen.
Wäre es eventuell denkbar / möglich, auch die Tuner der Fritte über das SAT-IP Protokoll irgendwie anzusprechen / auszulesen?

Hintergrund: Mit einem DVB-C Stick lässt sich ja der OFDM Block nicht mitschneiden.
Wenn mit einer zukünftigen FW die TV Funktionalität in der 6591 implementiert wird, sollte sich doch dann theoretisch auch die OFDM Auslastung auslesen lassen, oder ist das zu einfach gedacht?
Sie steht dann natürlich in dieser Zeit nicht als Modem zur Verfügung. Eventuell ginge das mit einer unprovisionierten Box - möglicherweise sind die erkannten DOCSIS-Kanäle auch für das Tunen per SAT-IP generell gesperrt...
 
Thema:

Auslastung des eigenen Segments ansehen (reloaded)

Auslastung des eigenen Segments ansehen (reloaded) - Ähnliche Themen

  • Connect Box ping auslastung

    Connect Box ping auslastung: Hallo Zusammen Diese " Werte " sind doch nicht normal Oder ? https://www.directupload.net/file/d/5357/nkwu36cq_jpg.htm RxMER liegt bei 37,5...
  • Auslastung des Netztes

    Auslastung des Netztes: Hallo , Viele Leute schreiben oft von geschwindigkeits einbußesn in den abendstunden . Ich konnte da noch nichts feststellen mit meine 32mbit...
  • Verbindungsabbruch bei Auslastung der Geschwindigkeit

    Verbindungsabbruch bei Auslastung der Geschwindigkeit: Hallo Forum, ich wende mich an euch mit folgendem Problem: 1. Ausstattung FB6360 Firmware-Version 85.04.89-19078 Sync: 70,5 MBit/s 5,5 MBit/s...
  • Auslastung des Internets verschlechtert Telefonqualität

    Auslastung des Internets verschlechtert Telefonqualität: Hallo, wir haben ein Problem, und zwar ist es kaum mehr möglich zu telefonieren, wenn der Downstream bei ca. 1,5MB/s liegt. Es ist dann keinem der...
  • Telefonaussetzer bei kompletter Bandbreiten-Auslastung

    Telefonaussetzer bei kompletter Bandbreiten-Auslastung: Hallo zusammen, kurz mal eine technische Frage: Habe 2Play 20.000. Telefon ist direkt am Scientific Atlanta angeschlossen über den...
  • Telefonaussetzer bei kompletter Bandbreiten-Auslastung - Ähnliche Themen

  • Connect Box ping auslastung

    Connect Box ping auslastung: Hallo Zusammen Diese " Werte " sind doch nicht normal Oder ? https://www.directupload.net/file/d/5357/nkwu36cq_jpg.htm RxMER liegt bei 37,5...
  • Auslastung des Netztes

    Auslastung des Netztes: Hallo , Viele Leute schreiben oft von geschwindigkeits einbußesn in den abendstunden . Ich konnte da noch nichts feststellen mit meine 32mbit...
  • Verbindungsabbruch bei Auslastung der Geschwindigkeit

    Verbindungsabbruch bei Auslastung der Geschwindigkeit: Hallo Forum, ich wende mich an euch mit folgendem Problem: 1. Ausstattung FB6360 Firmware-Version 85.04.89-19078 Sync: 70,5 MBit/s 5,5 MBit/s...
  • Auslastung des Internets verschlechtert Telefonqualität

    Auslastung des Internets verschlechtert Telefonqualität: Hallo, wir haben ein Problem, und zwar ist es kaum mehr möglich zu telefonieren, wenn der Downstream bei ca. 1,5MB/s liegt. Es ist dann keinem der...
  • Telefonaussetzer bei kompletter Bandbreiten-Auslastung

    Telefonaussetzer bei kompletter Bandbreiten-Auslastung: Hallo zusammen, kurz mal eine technische Frage: Habe 2Play 20.000. Telefon ist direkt am Scientific Atlanta angeschlossen über den...