Author Topic: Monitoring CCcam made easy  (Read 639 times)

0 Members and 1 Guest are viewing this topic.

Offline labud

  • Administrator
  • Hero Member
  • *****
  • Posts: 9026
Monitoring CCcam made easy
« on: December 23, 2010, 01:55:58 AM »
Monitoring CCcam made easy

Monitoring CCcam made easy by Munin







You need a running webserver to be able to use munin.

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
This gives a view of how many cards you get in different hops 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
hop5.label Cards in hop5


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

echo -n "hop5.value "
echo shares | nc localhost 16000 | grep "|5 " | wc -l
cccam_ecm
This gives a view of how many ECM goes trough you box, and how many your local card have handled. (Does not work correct if you have more than one card. Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam ECM
#graph_vlabel cccam
graph_category CCcam
ecms.label Total handled client ecms
ecmsl.value Local card hadled client ecms

EOM
exit 0;;
esac


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

echo -n "ecmsl.value "
echo entitlements | nc localhost 16000 | grep handled | awk '{print $2}' | awk 'BEGIN { FS = "(" } ; { print $1 }'
cccam_peak
Lists the largest peak number of your server Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Peak
#graph_vlabel cccam
graph_category CCcam
peak.label Peak load

EOM
exit 0;;
esac

echo -n "peak.value "
echo info | nc localhost 16000 | grep Peak | awk '{print $8}'
cccam_server_clients
Lists number of connected server and clients. (it should count number instead of using the value form the server page, this also lists users that has gone offline. 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
online.label Online CCcam Servers

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}'

echo -n "online.value "
echo servers | nc localhost 16000 | cut -d'|' -f3 | cut -c3-3 | grep "d" | wc -l
cccam_share
Liste the numbers of shares(cards) your server sees. Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam Shares
#graph_vlabel cccam
graph_category CCcam
shares.label Available shares

EOM
exit 0;;
esac

echo -n "shares.value "
echo shares | nc localhost 16000 | grep Available | awk '{print $3}'
cccam_user
Shows how many cards you get from different users. You can add many users. (replace user1.no-ip.com with users correct DNS or IP) Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title CCcam User Cards
#graph_vlabel cccam
graph_category CCcam
user1.label name user1
user2.label name user2


EOM
exit 0;;
esac


echo -n "user1.value "
echo servers | nc localhost 16000 | grep user1.no-ip.com | awk '{print $5}'

echo -n "user2.value "
echo servers | nc localhost 16000 | grep user1.no-ip.com | awk '{print $5}'
cccam_version_server
Lists how many server you have of different version. You can easy see if some of your peers upgrade to new version. Code:
#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title Online CCcam Servers by version
#graph_vlabel CCcam
graph_category CCcam
S2011.label 2.0.11
S210.label 2.1.0
S211.label 2.1.1
S212.label 2.1.2
S213.label 2.1.3
S214.label 2.1.4
S220.label 2.2.0
S221.label 2.2.1

EOM
exit 0;;
esac

echo -n "S2011.value "
echo servers | nc localhost 16000 | grep "|2.0.11 " | wc -l

echo -n "S210.value "
echo servers | nc localhost 16000 | grep "|2.1.0 " | wc -l

echo -n "S211.value "
echo servers | nc localhost 16000 | grep "|2.1.2 " | wc -l

echo -n "S212.value "
echo servers | nc localhost 16000 | grep "|2.1.2 " | wc -l

echo -n "S213.value "
echo servers | nc localhost 16000 | grep "|2.1.3 " | wc -l

echo -n "S214.value "
echo servers | nc localhost 16000 | grep "|2.1.4 " | wc -l

echo -n "S220.value "
echo servers | nc localhost 16000 | grep "|2.2.0 " | wc -l

echo -n "S221.value "
echo servers | nc localhost 16000 | grep "|2.2.1 " | wc -l

Make these files executable (change permissions with chmod to 755).
eks
chmod 755 /usr/share/munin/plugins/cccam_user

Create symlinks for each file to folder /etc/munin/plugins.
eks
ln -s /usr/share/munin/plugins/cccam_user /etc/munin/plugins/cccam_user


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

By default the webpage of Munin get installed to /var/www/
So to see Munin graph type:
You are not allowed to view links. Register or Login

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

Gracias a jotne
-----------------------------------------------








UNAUTHORIZED DECODING OF ENCRYPTED SIGNALS FROM EITHER DOMESTIC OR FOREIGN PROVIDERS IS AGAINST THE LAW !!!
INFORMATION CONTAINED IN MY POSTS ["C/P FROM ANOTHER SITE"] ARE FOR LEARNING AND EDUCATIONAL PURPOSES ONLY !!!
PLEASE, DO NOT SEND ME PRIVATE MESSAGES WITH TECHNICAL QUESTIONS, USE FORUM FOR IT !!!