Aktuelles
Digital Eliteboard - Das Digitale Technik Forum

Registriere dich noch heute kostenlos, um Mitglied zu werden! Sobald du angemeldet bist, kannst du auf unserer Seite aktiv teilnehmen, indem du deine eigenen Themen und Beiträge erstellst und dich über deinen eigenen Posteingang mit anderen Mitgliedern unterhalten kannst! Zudem bekommst du Zutritt zu Bereichen, welche für Gäste verwehrt bleiben

Registriere dich noch heute kostenlos, um Mitglied zu werden! Sobald du angemeldet bist, kannst du auf unserer Seite aktiv teilnehmen, indem du deine eigenen Themen und Beiträge erstellst und dich über deinen eigenen Posteingang mit anderen Mitgliedern unterhalten kannst! Zudem bekommst du Zutritt zu Bereichen, welche für Gäste verwehrt bleiben

Überwachung Cardok - Watchdog für Überwachung Oscam läuft

    Nobody is reading this thread right now.
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Hallo Leute

Habe da noch fragen an dem Script

Bei mir geht meine Tivusat Karte öffters mal in timeout aber bleibt auf Card OK. Macht ja nix da man ja mit dem Script auch Timeouts als Error Meldung nehmen kann.

Nun die Frage.

Stimmt die Config so:

Code:
#!/bin/bash
#
#### CONFIG - START

## OScam WebIf with SSL? [1=yes , 0=no]
OSssl="0"

## /path/to/oscam.conf?
OScfg="/var/etc/oscam.conf"

## Cards to monitor
CARD["1"]="tivusat"
CARD["2"]="hd+"

## monitoring Error message (%CARDNAME% gets replaced by the script (its a placeholder!))
##  multible error messages possible, simple add for each an own array
OSerror["1"]="tivusat .* timeout (2001 ms) by tivusat"
OSerror["2"]="tivusat .* ERROR, function call reader->crdr.receive(reader, data, size, delay, timeout) returns error."
Oserror["3"]="tivusat .* Resync error: readtimeouts 0/0 (max/min) us, writetimeouts 0/0 (max/min) us"
OSerror["4"]="tivusat .* card initializing error"
OSerror["5"]="tivusat .* Input/output error"
OSerror["6"]="tivusat .* timeout (2002 ms) by tivusat"

## OScam's Logfile?
OSlog="/var/log/oscam.log"

## reporting logfile for this script?
OStolog="/var/log/oscam.error"

#### CONFIG - END


OSip="127.0.0.1"
[ "$OSssl" = 1 ] && URL="https://" || URL="http://"

# Simple URL encoding
proc_url_encode() {
    out=${1//%/%25}; out=${out//\{/%7B}; out=${out//\}/%7D}; out=${out//|/%7C};
    out=${out//\\/%5C}; out=${out//^/%5E}; out=${out//~/%7E}; out=${out//[/%5B};
    out=${out//]/%5D}; out=${out//\`/%60}; out=${out//#/%23}; out=${out//>/%3E};
    out=${out//\$/%24}; out=${out//&/%26}; out=${out//+/%2B}; out=${out//,/%2C};
    out=${out//\//%2F}; out=${out//:/%3A}; out=${out//;/%3B}; out=${out//=/%3B};
    out=${out//\?/%3F}; out=${out// /%20}; out=${out//</%3C};
    out=${out//\!/%21}; out=${out//\"/%22}; out=${out//\@/%40}; out=${out//\'/%27};
    out=${out//\(/%28}; out=${out//\)/%29}; out=${out//\*/%2A}; out=${out//\-/%2D};
    out=${out//\_/%5F}; out=${out//\./%2E}; out=${out//\./%80};
    echo $out
}

proc_parse_cfg() {
    i=0
    while read line; do
        line=$(echo $line | sed -e 's/ //g')
        if [[ "$line" =~ ^[^#]*= ]]; then
            cfg_name[$i]=$(echo $line | cut -d'=' -f 1)
            cfg_value[$i]=$(echo $line | cut -d'=' -f 2-)
            ((++i))
        fi
    done < $1
}

get_cfg_value() {
    i=0
    for name in ${cfg_name[@]}; do
        [ "$1" = "$name" ] && echo "${cfg_value[$i]}" && break
        ((++i))
    done
}

proc_get_infos() {
    proc_parse_cfg $OScfg
    WEBPORT=$(get_cfg_value httpport)
    [ -z "$WEBPORT" ] && "ERROR: WebIf isnt enabled! Abort!" && exit 1
    if [[ "$WEBPORT" =~ "\+" ]]; then
        URL="https://"
        WEBPORT=$(echo $WEBPORT | tr -d '+')
    fi
    USERNAME=$(get_cfg_value httpuser)
    if [ ! -z "$USERNAME" ]; then
        PASSWORD=$(get_cfg_value httppwd)
        URL="$URL"`proc_url_encode "${USERNAME}"`":"`proc_url_encode "${PASSWORD}"`"@${OSip}:${WEBPORT}"
    else
        URL="${URL}$OSip:$WEBPORT"
    fi
}

proc_get_infos

for card in "${CARD[@]}" ; do
    for idx in "${!OSerror[@]}" ; do
        Em=${OSerror[$idx]}
        ERRORmsg=${Em//%CARDNAME%/$card}
        founds=`tail -10 $OSlog | grep "$ERRORmsg" | wc -l`
        if [ $founds -gt 0 ]; then
            echo "`date +%d-%b-%Y` `date +%H:%M:%S`: $card Card lost" >> $OStolog
            curl -s --digest "$URL/readers.html?label=${card}&action=disable" >/dev/null
            curl -s --digest "$URL/readers.html?label=${card}&action=enable" >/dev/null
        fi
    done
done

exit 0
Und woran erkenne ich ob es funktioniert.

In meinem Log von IPC steht zwar das es ausgeführt wird aber es ist schon passiert das die Tivusat Karte timeouts gebracht hat aber nichts passiert ist. Musste also meinen Reader selbst disabeln und enabeln.

Vielen dank für Hilfe im voraus

gruß

amassidda
 
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Ich denke warum nichts passiert ist das du nach "timeout (2002 ms) by tivusat" suchst.
Bin mir das nicht so sicher ob die ms Sinn manchen. Warum suchst du nicht nur nach dem Timeout?
Wenn du das so schreibst müsste er bei timeout reagieren...
Ich würde auch mit der Variablem Cardname arbeiten sonst macht es keinen Sinn oben die Karten als Variablen abzugeben.
OSerror["6"]="%CARDNAME% .* timeout .*"

Sehen tust du es im Webif und im Error-Log ob das Script was macht.
## OScam's Logfile?
OSlog="/var/log/oscam.log"
 
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Sehe da zwar nix oder gucke vielleicht Falsch aber hoffe das es so jetzt klappt.

Also bei IPC sehe ich nix und in Oscam im Log nur den Error aber mehr nicht.

Vielleicht fehlt bei mir einfach etwas oder ich denke gerade falsch

gruß

amassidda
 
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Bin echt am verzweilfen.

Mein Script sieht derzeit so aus:

Code:
#!/bin/bash
#
#### CONFIG - START

## OScam WebIf with SSL? [1=yes , 0=no]
OSssl="0"

## /path/to/oscam.conf?
OScfg="/var/etc/oscam.conf"

## Cards to monitor
CARD["1"]="tivusat"
CARD["2"]="hd+"

## monitoring Error message (%CARDNAME% gets replaced by the script (its a placeholder!))
##  multible error messages possible, simple add for each an own array
OSerror["1"]="%CARDNAME% .* timeout .*"
OSerror["2"]="%CARDNAME% .* ERROR, function call reader->crdr.receive(reader, data, size, delay, timeout) returns error."
Oserror["3"]="%CARDNAME% .* Resync error: readtimeouts 0/0 (max/min) us, writetimeouts 0/0 (max/min) us"
OSerror["4"]="%CARDNAME% .* card initializing error"
OSerror["5"]="%CARDNAME% .* Input/output error"
OSerror["6"]="%CARDNAME% .* T1 Resync command error, trying to reactivate"


## OScam's Logfile?
OSlog="/var/log/oscam.log"

## reporting logfile for this script?
OStolog="/var/log/oscam.error"

#### CONFIG - END


OSip="127.0.0.1"
[ "$OSssl" = 1 ] && URL="https://" || URL="http://"

# Simple URL encoding
proc_url_encode() {
    out=${1//%/%25}; out=${out//\{/%7B}; out=${out//\}/%7D}; out=${out//|/%7C};
    out=${out//\\/%5C}; out=${out//^/%5E}; out=${out//~/%7E}; out=${out//[/%5B};
    out=${out//]/%5D}; out=${out//\`/%60}; out=${out//#/%23}; out=${out//>/%3E};
    out=${out//\$/%24}; out=${out//&/%26}; out=${out//+/%2B}; out=${out//,/%2C};
    out=${out//\//%2F}; out=${out//:/%3A}; out=${out//;/%3B}; out=${out//=/%3B};
    out=${out//\?/%3F}; out=${out// /%20}; out=${out//</%3C};
    out=${out//\!/%21}; out=${out//\"/%22}; out=${out//\@/%40}; out=${out//\'/%27};
    out=${out//\(/%28}; out=${out//\)/%29}; out=${out//\*/%2A}; out=${out//\-/%2D};
    out=${out//\_/%5F}; out=${out//\./%2E}; out=${out//\./%80};
    echo $out
}

proc_parse_cfg() {
    i=0
    while read line; do
        line=$(echo $line | sed -e 's/ //g')
        if [[ "$line" =~ ^[^#]*= ]]; then
            cfg_name[$i]=$(echo $line | cut -d'=' -f 1)
            cfg_value[$i]=$(echo $line | cut -d'=' -f 2-)
            ((++i))
        fi
    done < $1
}

get_cfg_value() {
    i=0
    for name in ${cfg_name[@]}; do
        [ "$1" = "$name" ] && echo "${cfg_value[$i]}" && break
        ((++i))
    done
}

proc_get_infos() {
    proc_parse_cfg $OScfg
    WEBPORT=$(get_cfg_value httpport)
    [ -z "$WEBPORT" ] && "ERROR: WebIf isnt enabled! Abort!" && exit 1
    if [[ "$WEBPORT" =~ "\+" ]]; then
        URL="https://"
        WEBPORT=$(echo $WEBPORT | tr -d '+')
    fi
    USERNAME=$(get_cfg_value httpuser)
    if [ ! -z "$USERNAME" ]; then
        PASSWORD=$(get_cfg_value httppwd)
        URL="$URL"`proc_url_encode "${USERNAME}"`":"`proc_url_encode "${PASSWORD}"`"@${OSip}:${WEBPORT}"
    else
        URL="${URL}$OSip:$WEBPORT"
    fi
}

proc_get_infos

for card in "${CARD[@]}" ; do
    for idx in "${!OSerror[@]}" ; do
        Em=${OSerror[$idx]}
        ERRORmsg=${Em//%CARDNAME%/$card}
        founds=`tail -10 $OSlog | grep "$ERRORmsg" | wc -l`
        if [ $founds -gt 0 ]; then
            echo "`date +%d-%b-%Y` `date +%H:%M:%S`: $card Card lost" >> $OStolog
            curl -s --digest "$URL/readers.html?label=${card}&action=disable" >/dev/null
            curl -s --digest "$URL/readers.html?label=${card}&action=enable" >/dev/null
        fi
    done
done

exit 0

Nur passiert wirklich garnichts

Die Karte belibt auf CARDOK gibt Timeout errors wird sogar versucht wieder gelesen zu werden, aber nicht vom script sondern von Oscam selbst da ohne das script genau das selbe im LOG stand.

Quasi macht das Script granichts bei mir. Ist zwar drin wird sogar von Cron mit ausgeführt macht aber rein garnix. Es wurde nicht einmal eine oscam.error Datei erstellt.

Sehe auch nicht ob das Script überhaupt was macht ausser bei Cron. Da sehe ich das es ausgeführt wird aber ob alles stimmt also so wie manche vorgänger hier sehe ich nirgendwo.

Nur zur Info (kann ja sein das es mit 64bit nicht geht oder ein anderer vorgang nötig ist):

Server Debian Sequezze 6.0.7 64bit

Oscam rev 8923

Easymouse 2 Premium

danke im voraus

gruß

amassidda
 
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Hey Leute, bin erst seit ein paar Monaten im Linux Bereich unterwegs und bin fasziniert was man damit alles anstellen kann.
Habe zwar kein Raspberry, allerdings ein Qnap Linux Server auf dem Oscam läuft. Es kommt 1-2 mal im Monat vor, dass Oscam die Karte nicht aktiviert. Nach einem Restart funktioniert dann alles wieder einwandfrei.
Habe mir hier ein wenig durchgelesen, blicke allerdings gar nicht durch, wo ich anfangen soll. Meint ihr besteht diese Möglichkeit auch bei meinem Qnap mit Linux unter Intel Prozessor?
Bitte um Hilfe
 
AW: Überwachung Cardok - Watchdog für Überwachung Oscam läuft

Naja ich hatte das selbe Problem wie du und hab Abhilfe damit geschaffen das ich Oscam einfach via cronjob täglich nachts neustarten lasse


Sent from my iPad 2 oder iPhone 5 using
 
Zurück
Oben