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

Hilfe bei RRDTool und Munin

    Nobody is reading this thread right now.

Mufamba

Hacker
Registriert
2. September 2009
Beiträge
370
Reaktionspunkte
67
Punkte
88
Moin moin, ich bin grade dabei mit RRD die CCcam infopage auszulesen um mir die daten über munin darstellen zu lassen.

Hier geht es in erster linie darum peaks zu erkennen um einen gewissen überblick über die server aktivtät zu erlagen.

Ich teste derzeit ein script bzw. tut von einer anderen page, aber hier bekomme ich jedesmal beim auslesen einen Fehler.

Leider bin ich mit der RRD Programierung nicht sonderlich vertraut und mir fehlen somit die nötigen komandos bzw. deren bedeutung um an dem script was zu ändern . . .

Vielleicht findet sich je ja jemand der sich damit ein bischen auseinander gesetzt hat und weiter hilft . .

Danke im voraus.

Hier mal das Script was ich teste:

Munin is a network/system monitoring application that presents output in graphs through a web interface. Its emphasis is on simple plug and play capabilities. A large number of monitoring plugins are available. Using Munin you can easily monitor the performance of your computers, networks, SANs, and applications as well. It uses the RRDtool (written by Tobi Oetiker) and is written in Perl. It stores the data in RRD files, and (if needed) updates the graphs. One of the main goals has been ease of creating new plugins (graphs).

Munin is available as a package in most distros. In Ubuntu for example, to install it, just type: sudo apt-get install munin.

With the plugins below, you can very easily monitor vairous CCcam parameters along the many others inside your Munin installation on your Linux system.

If you use Ubuntu, go to /usr/share/munin/plugins/ (other distros may have some other location for this) and create there a file called cccam_cards

Paste the following text in the file, then save it:
Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam available cards
graph_vlabel cards
graph_category CCcam
hop1.label Cards in hop1
hop2.label Cards in hop2
hop3.label Cards in hop3
hop4.label Cards in hop4

EOM
exit 0;;
esac

echo -n "hop1.value "
echo shares | nc localhost 16000 | grep "|1 " | wc -l

echo -n "hop2.value "
echo shares | nc localhost 16000 | grep "|2 " | wc -l

echo -n "hop3.value "
echo shares | nc localhost 16000 | grep "|3 " | wc -l

echo -n "hop4.value "
echo shares | nc localhost 16000 | grep "|4 " | wc -l

Paste this into a new file, cccam_servers_clients:
Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Servers and Clients
#graph_vlabel CCcam
graph_category CCcam
clients.label Connected clients
aclient.label Active clients
servers.label Server connections

EOM
exit 0;;
esac

echo -n "clients.value "
echo info | nc localhost 16000 | grep Connected | awk '{print $3}'

echo -n "aclient.value "
echo info | nc localhost 16000 | grep 'Active clients' | awk '{print $3}'

echo -n "servers.value "
echo servers | nc localhost 16000 | grep 'Server connections' | awk '{print $3}'

Paste this into a new file, cccam_shares_ecm:

Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Shares and ECM
#graph_vlabel cccam
graph_category CCcam
shares.label Available shares
ecms.label Total handled client ecms

EOM
exit 0;;
esac

echo -n "shares.value "
echo shares | nc localhost 16000 | grep Available | awk '{print $3}'

echo -n "ecms.value "
echo info | nc localhost 16000 | grep ecm | awk '{print $5}'

Make these files executable (change permissions with chmod to 755).
Create symlinks for each file to folder /etc/munin/plugins.

Restart munin: sudo service munin-node restart. Sit back and relax for 15 minutes, and look at your graphs growing.

Lots of parameters of CCcam can be monitored. Based on the code above, with simple modifications almost anything can be graphed.

Any other plugin suggestions?
Quelle: ECS
 
AW: Hilfe bei RRDTool und Munin

das ist auch interessant. Ich denke, das wenn ich wieder zuhause bin, dies mal versuche. Wenn du neue Erkenntnisse hast, dann lass es mich wissen. Schwer sollte es nicht wirklich sein.
 
AW: Hilfe bei RRDTool und Munin

ich musste mir grade sagen lassen, dass es Voraussetzung ist, dass die infopage nicht passwort geschützt ist . . . ich denke das ist nicht sinn der sache . . . zumindest nicht bei mir
 
AW: Hilfe bei RRDTool und Munin

@Mufamba: Dein Problem dabei ist nur, dass "nc" das password nicht kennt was du in der CCcam.cfg warscheinlich für TELNETINFO eingestellt hast

Das liesse sich beheben indem du das Script ein wenig anpasst - dafür musst du zunächst ein seperates File anlegen in dem TELNETINFO USERNAME und PASSWORD drin stehen, zum beispiel als username 123 und password 321:

/var/etc/nc.cccam:
Code:
123
321
Damit nc das auch benutzt muss es wie folgt aufgerufen werden: nc -i1 localhost </var/etc/nc.cccam

Dein obiges Script passt du dann folgendermasen an

cccam_cards:
Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam available cards
graph_vlabel cards
graph_category CCcam
hop1.label Cards in hop1
hop2.label Cards in hop2
hop3.label Cards in hop3
hop4.label Cards in hop4

EOM
exit 0;;
esac

echo -n "hop1.value "
echo shares | nc -i1 localhost 16000 </var/etc/nc.cccam | grep "|1 " | wc -l

echo -n "hop2.value "
echo shares | nc -i1 localhost 16000 </var/etc/nc.cccam | grep "|2 " | wc -l

echo -n "hop3.value "
echo shares | nc -i1 localhost 16000 </var/etc/nc.cccam | grep "|3 " | wc -l

echo -n "hop4.value "
echo shares | nc -i1 localhost 16000 </var/etc/nc.cccam | grep "|4 " | wc -l

cccam_servers_clients:
Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Servers and Clients
#graph_vlabel CCcam
graph_category CCcam
clients.label Connected clients
aclient.label Active clients
servers.label Server connections

EOM
exit 0;;
esac

echo -n "clients.value "
echo info | nc -i1 localhost 16000 </var/etc/nc.cccam | grep Connected | awk '{print $3}'

echo -n "aclient.value "
echo info | nc -i1 localhost 16000 </var/etc/nc.cccam | grep 'Active clients' | awk '{print $3}'

echo -n "servers.value "
echo servers | nc -i1 localhost 16000 </var/etc/nc.cccam | grep 'Server connections' | awk '{print $3}'

cccam_shares_ecm:
Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Shares and ECM
#graph_vlabel cccam
graph_category CCcam
shares.label Available shares
ecms.label Total handled client ecms

EOM
exit 0;;
esac

echo -n "shares.value "
echo shares | nc -i1 localhost 16000 </var/etc/nc.cccam | grep Available | awk '{print $3}'

echo -n "ecms.value "
echo info | nc -i1 localhost 16000 </var/etc/nc.cccam | grep ecm | awk '{print $5}'

Ohne TELNETINFO USERNAME / PASSWORD brauch man obige abänderungen nicht machen

ABER davon würde ich jedem abraten! Auf jedenfall immer und überall ne password Abfrage - ist das sicherste!
 
Zuletzt bearbeitet:
AW: Hilfe bei RRDTool und Munin

@feissmaik
schönes ding, dank dir . . . werd ich später versuchen zu testen.

Hast du das bei dir bereits getestet ob es läuft!?
 
AW: Hilfe bei RRDTool und Munin

Nein, nur die scripts selber

Munin will ich nicht unbedingt nutzen - um so mehr "fremde" Dienste regelmässig Abfragen/Aktionen machen um so mehr Leistung des Servers wird verbraten und CCcam neigt (bei mir) auch dazu zu crashen wenn zb zu oft das webif abgefragt wird etc

Never change a running System :D
 
AW: Hilfe bei RRDTool und Munin

hhmmm das musste ich bei meinem Futro s300 auch festellen.
Hier hatte ich das RRDTool installiert um OScam zu überwachen, dadurch hatte ich dann aber immer wieder aussetzer . . . rrd und dazugehörige Datein gelöscht bzw. deinstalliert . . . zack alles wieder gut . . .

ich will die munin rrdtool geschichte auf meinem vserver laufen lassen, da muss ich mir erstmal keine sorgen machen aber wie sagt man so schön . . . probieren geht über studieren :)
 
AW: Hilfe bei RRDTool und Munin

mmh ich hab gerade festgestellt das das so doch noch nicht funktioniert... durch das seperate übergeben ( < ) des user/pass's funktioniert die pipe ( | ) nicht mehr

Ich hab die Scripts nochmal ein wenig mehr angepasst:
(im oberen Bereich das ensprechend configurieren)
(Funktioniert auch mit Munin)
cccam_cards:
Code:
#!/bin/sh

PWFILE="/var/etc/nc.cccam"
TELIP="localhost"
TELPORT="16000"
TMP="/tmp"
TMPFILE="$TMP/.nc.cccam"


cat $PWFILE > $TMPFILE
echo "shares" >> $TMPFILE


case $1 in
config)
cat <<'EOM'
graph_title CCcam available cards
graph_vlabel cards
graph_category CCcam
hop1.label Cards in hop1
hop2.label Cards in hop2
hop3.label Cards in hop3
hop4.label Cards in hop4

EOM
exit 0;;
esac

echo -n "hop1.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep "|1 " | wc -l

echo -n "hop2.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep "|2 " | wc -l

echo -n "hop3.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep "|3 " | wc -l

echo -n "hop4.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep "|4 " | wc -l

rm -f $TMPFILE

cccam_servers_clients:
Code:
#!/bin/sh

PWFILE="/var/etc/nc.cccam"
TELIP="localhost"
TELPORT="16000"
TMP="/tmp"
TMPFILE="$TMP/.nc.cccam"

cat $PWFILE > $TMPFILE
echo "info" >> $TMPFILE  


case $1 in
config)
cat <<'EOM'
graph_title CCcam Servers and Clients
#graph_vlabel CCcam
graph_category CCcam
clients.label Connected clients
aclient.label Active clients
servers.label Server connections

EOM
exit 0;;
esac

echo -n "clients.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep Connected | awk '{print $3}'

echo -n "aclient.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep 'Active clients' | awk '{print $3}'

rm -f $TMPFILE
cat $PWFILE > $TMPFILE
echo "servers" >> $TMPFILE
echo -n "servers.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep 'Server connections' | awk '{print $3}'               

rm -f $TMPFILE

cccam_shares_ecm:
Code:
#!/bin/sh

PWFILE="/var/etc/nc.cccam"
TELIP="localhost"
TELPORT="16000"
TMP="/tmp"
TMPFILE="$TMP/.nc.cccam"

cat $PWFILE > $TMPFILE
echo "shares" >> $TMPFILE

case $1 in
config)
cat <<'EOM'
graph_title CCcam Shares and ECM
#graph_vlabel cccam
graph_category CCcam
shares.label Available shares
ecms.label Total handled client ecms

EOM
exit 0;;
esac

echo -n "shares.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep Available | awk '{print $3}'              

rm -f $TMPFILE
cat $PWFILE > $TMPFILE
echo "info" >> $TMPFILE   
echo -n "ecms.value "
nc -i1 $TELIP $TELPORT <$TMPFILE | grep ecm | awk '{print $5}'            

rm -f $TMPFILE

Ausserdem würde ich dir empfehlen in dem script cccam_cards die HOPs Zeilen auszukommentiern die du nicht brauchst (ich hab zb nur hop1 und hop2 Karten und hab 3 und 4 auskommentiert)
 
AW: Hilfe bei RRDTool und Munin

sry . . . das war natürlich etwas unfreundlich von mir
 
AW: Hilfe bei RRDTool und Munin

...leider gab es doch noch Probleme mit Munin wenn man TELNETINFO User und Pass benutzt, und zwar in form von Munin-Fehlermeldungen: Plugin timeout

Um das zu beheben muss man das file /etc/munin/plugin-conf.d/munin-node bearbeiten und folgendes einfügen:
Code:
[cccam_*]
user root
timeout 60


Ich hab die Scripts auch nochmal überarbeitet
Wenn man Munin und CCcam auf der gleichen Box laufen hat, kann man CCcamCFG einstellen und das Script liest sich die nötigen Informationen selber aus - ansonsten kann man die nötigen Daten auch manuell in die Scripts eintragen...
(ich hoffe es wirkt nicht zu kompliziert?)


cccam_cards:
Code:
#!/bin/sh
# cccam_cards

### CONFIG - START
# /path/to/CCcam.cfg ... if your using TELNETINFO USER/PASS ("" to disable)
CCcamCFG="/home/CS/CCcam/etc/CCcam.cfg"
# IP/Host of your CCcam-Server to connect to with telnet
TELNETIP="localhost"
# How many Hops you share or only want to display? (1-5)
MAXHOPS="2"
TMPFILE="/tmp/.nc.cccam"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set CCcamCFG)
TELNETUSER=""
TELNETPASS=""
TELNETPORT=""
### CONFIG - END


# read CCcam.cfg and extract telnet user/pass
proc_read_CCcamcfg() {
	TELNETPORT=$(grep -i "TELNETINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')      
	TELNETUSER=$(grep -i "TELNETINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
	TELNETPASS=$(grep -i "TELNETINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')        
}

proc_tmpfile() {
	rm -f $TMPFILE
	if [ ! -z "$CCcamCFG" ]; then
		proc_read_CCcamcfg
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	elif [ "$TELNETUSER" != "" -a "$TELNETPASS" != "" -a "$TELNETPORT" != "" ]; then
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	fi
}

if [ "$1" = "config" ]; then
	echo 'graph_title CCcam available cards'
	echo 'graph_vlabel cards'
	echo 'graph_category CCcam'
	count=1
	while [ ! $count -gt $MAXHOPS ]; do
		echo "hop${count}.label Cards in hop${count}"
		count=$[$count+1]
	done
	exit 0
fi

proc_tmpfile
echo "shares" >> $TMPFILE

count=1
while [ ! $count -gt $MAXHOPS ]; do
	echo -n "hop${count}.value "
	nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep "|${count} " | wc -l
	count=$[$count+1]
done

rm -f $TMPFILE
cccam_servers_clients:
Code:
#!/bin/sh
# cccam_servers_clients

### CONFIG - START
# /path/to/CCcam.cfg ... if your using TELNETINFO USER/PASS ("" to disable)
CCcamCFG="/home/CS/CCcam/etc/CCcam.cfg"
# IP/Host of your CCcam-Server to connect to with telnet
TELNETIP="localhost"
# How many Hops you share or only want to display? (1-5)
MAXHOPS="2"
TMPFILE="/tmp/.nc.cccam"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set CCcamCFG)
TELNETUSER=""
TELNETPASS=""
TELNETPORT=""
### CONFIG - END


# read CCcam.cfg and extract telnet user/pass
proc_read_CCcamcfg() {
	TELNETPORT=$(grep -i "TELNETINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')      
	TELNETUSER=$(grep -i "TELNETINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
	TELNETPASS=$(grep -i "TELNETINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')        
}

proc_tmpfile() {
	rm -f $TMPFILE
	if [ ! -z "$CCcamCFG" ]; then
		proc_read_CCcamcfg
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	elif [ "$TELNETUSER" != "" -a "$TELNETPASS" != "" -a "$TELNETPORT" != "" ]; then
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	fi
}

if [ "$1" = "config" ]; then
	echo 'graph_title CCcam Servers and Clients'
	#echo 'graph_vlabel CCcam'
	echo 'graph_category CCcam'
	echo 'clients.label Connected clients'
	echo 'aclient.label Active clients'
	echo 'servers.label Server connections'
	exit 0
fi

proc_tmpfile
echo "info" >> $TMPFILE

echo -n "clients.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep Connected | awk '{print $3}'

echo -n "aclient.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep 'Active clients' | awk '{print $3}'

proc_tmpfile
echo "servers" >> $TMPFILE
echo -n "servers.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep 'Server connections' | awk '{print $3}'

rm -f $TMPFILE
cccam_shares_ecm:
Code:
#!/bin/sh
# cccam_servers_clients

### CONFIG - START
# /path/to/CCcam.cfg ... if your using TELNETINFO USER/PASS ("" to disable)
CCcamCFG="/home/CS/CCcam/etc/CCcam.cfg"
# IP/Host of your CCcam-Server to connect to with telnet
TELNETIP="localhost"
# How many Hops you share or only want to display? (1-5)
MAXHOPS="2"
TMPFILE="/tmp/.nc.cccam"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set CCcamCFG)
TELNETUSER=""
TELNETPASS=""
TELNETPORT=""
### CONFIG - END


# read CCcam.cfg and extract telnet user/pass
proc_read_CCcamcfg() {
	TELNETPORT=$(grep -i "TELNETINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')      
	TELNETUSER=$(grep -i "TELNETINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
	TELNETPASS=$(grep -i "TELNETINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')        
}

proc_tmpfile() {
	rm -f $TMPFILE
	if [ ! -z "$CCcamCFG" ]; then
		proc_read_CCcamcfg
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	elif [ "$TELNETUSER" != "" -a "$TELNETPASS" != "" -a "$TELNETPORT" != "" ]; then
		echo "$TELNETUSER" > $TMPFILE
		echo "$TELNETPASS" >> $TMPFILE
	fi
}

if [ "$1" = "config" ]; then
	echo 'graph_title CCcam Servers and Clients'
	#echo 'graph_vlabel CCcam'
	echo 'graph_category CCcam'
	echo 'clients.label Connected clients'
	echo 'aclient.label Active clients'
	echo 'servers.label Server connections'
	exit 0
fi

proc_tmpfile
echo "info" >> $TMPFILE

echo -n "clients.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep Connected | awk '{print $3}'

echo -n "aclient.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep 'Active clients' | awk '{print $3}'

proc_tmpfile
echo "servers" >> $TMPFILE
echo -n "servers.value "
nc -i1 $TELNETIP $TELNETPORT <$TMPFILE | grep 'Server connections' | awk '{print $3}'

rm -f $TMPFILE


/EDIT: Und hier noch ein Plugin was für den einen oder anderen nützlich sein könnte: Link veralten (gelöscht)
 
Zuletzt bearbeitet:
AW: Hilfe bei RRDTool und Munin

alles klar . . . hatte das gestern beim testen ebenfalls gesehen . . .
werd ich, wenn ich zu hause bin auch gleich mal austesten . . . thx
 
AW: Hilfe bei RRDTool und Munin

Funzt super :)

Endlich sieht man wann die meisten Clients active sind etc - jetzt fehlt mir nurnoch ne Statistik welche Sender am beliebtesten sind und wie stark davon die Locale belastet wird oder eher remote etc :)

...aber woher kommen diese starken Einbrüche bei mir auf hop1 obwohl mein CCcam durchgehend läuft?
Du musst angemeldet sein, um Bilder zu sehen.
 
AW: Hilfe bei RRDTool und Munin

also beim ersten scheint es so, also währe die verbindung kurz ganz weg gewesen . . . da oben bei hop2 ein komplett freier bereich ist . . . beim zweiten kann ich auch nichts sehen . . .

aber insg sieht das ja schon mal richtig gut aus ;D
 
Zurück
Oben