Stefan Dreambox
Ist gelegentlich hier
- Registriert
- 6. November 2008
- Beiträge
- 69
- Reaktionspunkte
- 2
- Punkte
- 28
AW: Monitoring vairous CCcam parameters ith Munin -/- (graphische) Überwachung von CC
okay habe jetzt das ganze ubunto nachmal frisch aufgesetzt und habe mich an die anleitung gehalten das selbe problem.
Hier die ausgabe von Putty
das interesante auch die normalen lokalen hardware scripts gehen anscheinend nicht.
Hier mal die konfiguration meiner 6 Scripte.
Habe aber nur PW:Benutzer und IP der box sowie Port geändert sonnst nichts
und habe die dateien aus der rar datei genommen editiert und wieder als datei in den ortner
/etc/munin/plugins/ Gegeben und die rechte mittels filezilla auf 775 gesetzt von den 6 datein und munin neu gestartet.
Normalerweise müste zumindestens die grapen angezeigt werden auch wenn die werte nicht stimmen wie PW User Port.
Hier die ausgabe von Putty
cccam_cards
cccam_servers_clients
cccam_traffic
cccam_usercards
cccam_version_clients
cccam_version_servers
okay habe jetzt das ganze ubunto nachmal frisch aufgesetzt und habe mich an die anleitung gehalten das selbe problem.
Hier die ausgabe von Putty
Code:
root@Muninserver:~# munin-run /path/to/munin/script
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/cccam_cards
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/cccam_servers_clients
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/cccam_usercards
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/cccam_version_servers
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/cccam_version_clients
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/acpi
# ERROR: Invalid plugin name.
root@Muninserver:~# munin-run /path/to/munin/script/apt
# ERROR: Invalid plugin name.
das interesante auch die normalen lokalen hardware scripts gehen anscheinend nicht.
Hier mal die konfiguration meiner 6 Scripte.
Habe aber nur PW:Benutzer und IP der box sowie Port geändert sonnst nichts
und habe die dateien aus der rar datei genommen editiert und wieder als datei in den ortner
/etc/munin/plugins/ Gegeben und die rechte mittels filezilla auf 775 gesetzt von den 6 datein und munin neu gestartet.
Normalerweise müste zumindestens die grapen angezeigt werden auch wenn die werte nicht stimmen wie PW User Port.
Hier die ausgabe von Putty
cccam_cards
Code:
#!/bin/sh
# cccam_cards v0.51
#
# Monitoring CCcam's parameter using the WEBINFO HTTP port
#
### CONFIG - START
# /path/to/CCcam.cfg ... if your using USER/PASS ("" to disable or use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
USERNAME="xxx"
PASSWORD="xxx"
WEBINFOPORT="xxx"
# IP/Host of your CCcam-Server to connect to...
CCCAMIP="192.168.1.40"
# How many Hops you share or only want to monitor?
MAXHOPS="2"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract user/pass/port
proc_read_CCcamcfg() {
USERNAME=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
PASSWORD=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
WEBINFOPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
proc_get_infos() {
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ -z "$WEBINFOPORT" ]; then
WEBINFOPORT="16001"
fi
if [ -z "$USERNAME" ]; then
URL="http://${CCCAMIP}:${WEBINFOPORT}"
else
URL="http://${USERNAME}:${PASSWORD}@${CCCAMIP}:${WEBINFOPORT}"
fi
}
if [ ! -z "$HOME" ]; then
TMPFILE="${HOME}/.tmpfile"
elif [ -d "/tmp" ]; then
TMPFILE="/tmp/.tmpfile"
elif [ -d "/var/tmp" ]; then
TMPFILE="/var/tmp/.tmpfile"
elif [ -d "/usr/tmp" ]; then
TMPFILE="/usr/tmp/.tmpfile"
elif [ -d "/usr/local/tmp" ]; then
TMPFILE="/usr/local/tmp/.tmpfile"
else
TMPFILE=".tmpfile"
fi
if [ "$1" = "config" ]; then
echo 'graph_title CCcam available Cards and Shares'
echo 'graph_args --lower-limit 0'
echo 'graph_scale no'
echo 'graph_category CCcam'
#echo 'graph_vlabel cards'
echo 'shares.label Total available Shares'
count=1
while [ ! $count -gt $MAXHOPS ]; do
echo "hop${count}.label Cards in hop${count}"
count=$(($count + 1))
done
exit 0
fi
proc_get_infos
wget -q -O - "${URL}/shares" >$TMPFILE
AVAILABLE=$(grep Available ${TMPFILE} | awk '{print $3}')
echo "shares.value ${AVAILABLE}"
count=1
while [ ! $count -gt $MAXHOPS ]; do
CARDS=$(cat ${TMPFILE} | cut -d'|' -f7 | cut -c1-3 | grep "${count}" | wc -l)
echo "hop${count}.value ${CARDS}"
count=$(($count + 1))
done
rm -f ${TMPFILE}
cccam_servers_clients
Code:
#!/bin/sh
# cccam_servers_clients v0.51
#
# Monitoring CCcam's parameter using the WEBINFO HTTP port
#
### CONFIG - START
# /path/to/CCcam.cfg ... if your using USER/PASS ("" to disable and use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
USERNAME="xxx "
PASSWORD="xxx"
WEBINFOPORT="xxx"
# IP/Host of your CCcam-Server to connect to...
CCCAMIP="192.168.1.40"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract user/pass/port
proc_read_CCcamcfg() {
USERNAME=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
PASSWORD=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
WEBINFOPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
proc_get_infos() {
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ -z "$WEBINFOPORT" ]; then
WEBINFOPORT="16001"
fi
if [ -z "$USERNAME" ]; then
URL="http://${CCCAMIP}:${WEBINFOPORT}"
else
URL="http://${USERNAME}:${PASSWORD}@${CCCAMIP}:${WEBINFOPORT}"
fi
}
if [ ! -z "$HOME" ]; then
TMPFILE="${HOME}/.tmpfile"
elif [ -d "/tmp" ]; then
TMPFILE="/tmp/.tmpfile"
elif [ -d "/var/tmp" ]; then
TMPFILE="/var/tmp/.tmpfile"
elif [ -d "/usr/tmp" ]; then
TMPFILE="/usr/tmp/.tmpfile"
elif [ -d "/usr/local/tmp" ]; then
TMPFILE="/usr/local/tmp/.tmpfile"
else
TMPFILE=".tmpfile"
fi
if [ "$1" = "config" ]; then
echo 'graph_title CCcam Servers and Clients'
echo 'graph_category CCcam'
echo 'graph_args --lower-limit 0'
echo 'clients.label Connected Clients'
echo 'aclients.label Active Clients'
echo 'servers.label Connected Servers'
exit 0
fi
proc_get_infos
CLIENTSCONNECTED=CLIENTSACTIVE=SERVERSONLINE=0
wget -q -O - "${URL}" >$TMPFILE
CLIENTSCONNECTED=`grep Connected $TMPFILE | awk '{print $3}'`
CLIENTSACTIVE=`grep 'Active clients' $TMPFILE | awk '{print $3}'`
echo "clients.value $CLIENTSCONNECTED"
echo "aclients.value $CLIENTSACTIVE"
wget -q -O - "${URL}/servers" >$TMPFILE
SERVERSONLINE=`grep -e 'd [0-2][0-9]:[0-6][0-9]:[0-6][0-9]' $TMPFILE | wc -l`
echo "servers.value $SERVERSONLINE"
rm -f $TMPFILE
cccam_traffic
Code:
#!/bin/sh
# cccam_traffic v0.22
#
# Monitoring LOCAL running CCcam's traffic using iptraf
#
# HowTo:
# apt-get install iptraf
# run ' iptraf ' as root and go to Configure... Timers...
# change Logging interval... to your Munin-update-interval (default: 5min)
# go to Additional ports... and add your CCcam-Server-Port (default: 12000)
# Exit iptraf and start it into background:
# iptraf -s eth0 -B
# by default eth0 is the first network device of your server (check with: ifconfig)
#
### CONFIG - START
# /path/to/CCcam.cfg ... ("" to disable and use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# SERVER LISTEN PORT of your CCcam-Server for iptraf (default: 12000)
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
CCCAMPORT="15545"
# Network Device on which your CCcam-Server runs on (default: eth0)
NETDEVICE="eth0"
# Directory where iptraf saves the logfiles (default: /var/log/iptraf)
IPTRAFlogdir="/var/log/iptraf"
# Display also Total Traffic? (yes/no)
WITHtotal="yes"
# If we'r displaying Total Traffic should it draw the complete
# AREA or only a simple LINE1 like it does with traffic IN and OUT? (LINE1/AREA)
# (area looks better)
TOTALdraw="AREA"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract port
proc_read_CCcamcfg() {
CCCAMPORT=$(grep -i "SERVER LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ "$TOTALdraw" != "AREA" ] && [ "$TOTALdraw" != "LINE1" ]; then
TOTALdraw="AREA"
fi
if [ -z "$CCCAMPORT" ]; then
CCCAMPORT="12000"
elif [ -z "$NETDEVICE" ]; then
NETDEVICE="eth0"
elif [ -z "$IPTRAFlogdir" ]; then
IPTRAFlogdir="/var/log/iptraf"
fi
if [ "$1" = "config" ]; then
echo "graph_info This graph shows the CCcam traffic on the $NETDEVICE network interface."
echo 'graph_title CCcam Traffic'
echo 'graph_category CCcam'
echo 'graph_args --base 1024 -l 0'
echo 'graph_vlabel Bytes/sec'
if [ "$WITHtotal" = "yes" ]; then
echo 'graph_order traffictotal trafficin trafficout'
echo 'traffictotal.label Total traffic'
echo 'traffictotal.type DERIVE'
echo 'traffictotal.draw ${TOTALdraw}'
echo 'traffictotal.min 0'
echo 'traffictotal.cdef traffictotal,8,*'
else
echo 'graph_order trafficin trafficout'
fi
echo 'trafficin.label traffic IN'
echo 'trafficin.type DERIVE'
echo 'trafficin.draw LINE1'
echo 'trafficin.min 0'
echo 'trafficin.cdef trafficin,8,*'
echo 'trafficout.label traffic OUT'
echo 'trafficout.type DERIVE'
echo 'trafficout.draw LINE1'
echo 'trafficout.min 0'
echo 'trafficout.cdef trafficout,8,*'
exit 0
fi
LOG="$IPTRAFlogdir/tcp_udp_services-${NETDEVICE}.log"
TRAFFIC=$(grep "TCP/$CCCAMPORT" $LOG | tail -n1 | cut -f2 -d"," | cut -f2 -d" ")
TRAFFICIN=$(grep "TCP/$CCCAMPORT" $LOG | tail -n1 | cut -f4 -d"," | cut -f2 -d" ")
TRAFFICOUT=$(grep "TCP/$CCCAMPORT" $LOG | tail -n1 | cut -f6 -d"," | cut -f2 -d" ")
if [ -z "$TRAFFIC" ]; then
TRAFFIC=0
elif [ -z "$TRAFFICIN" ]; then
TRAFFICIN=0
elif [ -z "$TRAFFICOUT" ]; then
TRAFFICOUT=0
fi
if [ "$WITHtotal" = "yes" ]; then
echo "traffictotal.value ${TRAFFIC}"
fi
echo "trafficin.value ${TRAFFICIN}"
echo "trafficout.value ${TRAFFICOUT}"
cccam_usercards
Code:
#!/bin/sh
# cccam_usercards v0.51
#
# Monitoring CCcam's parameter using the WEBINFO HTTP port
#
### CONFIG - START
# /path/to/CCcam.cfg ... if your using USER/PASS ("" to disable and use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
USERNAME="xxx"
PASSWORD="xxx"
WEBINFOPORT="xxx"
# IP/Host of your CCcam-Server to connect to...
CCCAMIP="192.168.1.40"
# Create for each User/Peer you want to monitor, how many cards you get from him, an own array
# e.g.: USERCARDS[1]="dyndns.host"
# e.g.: USERCARDS[2]="74.125.79.99"
USERCARDS[1]="127.0.0.1"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract user/pass/port
proc_read_CCcamcfg() {
USERNAME=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
PASSWORD=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
WEBINFOPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
proc_get_infos() {
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ -z "$WEBINFOPORT" ]; then
WEBINFOPORT="16001"
fi
if [ -z "$USERNAME" ]; then
URL="http://${CCCAMIP}:${WEBINFOPORT}"
else
URL="http://${USERNAME}:${PASSWORD}@${CCCAMIP}:${WEBINFOPORT}"
fi
}
if [ ! -z "$HOME" ]; then
TMPFILE="${HOME}/.tmpfile"
elif [ -d "/tmp" ]; then
TMPFILE="/tmp/.tmpfile"
elif [ -d "/var/tmp" ]; then
TMPFILE="/var/tmp/.tmpfile"
elif [ -d "/usr/tmp" ]; then
TMPFILE="/usr/tmp/.tmpfile"
elif [ -d "/usr/local/tmp" ]; then
TMPFILE="/usr/local/tmp/.tmpfile"
else
TMPFILE=".tmpfile"
fi
if [ "$1" = "config" ]; then
echo 'graph_title CCcam User Cards'
echo 'graph_args --lower-limit 0'
echo 'graph_category CCcam'
echo 'graph_vlabel cards'
x=1
for UC in ${USERCARDS
[*]}; do
echo "user${x}cards.label ${x}. User Cards (${UC})"
x=$(($x + 1))
done
exit 0
fi
proc_get_infos
wget -q -O - "${URL}/servers" >$TMPFILE
x=1
for UC in ${USERCARDS
[*]}; do
RESULT=`grep ${UC} $TMPFILE | cut -d'|' -f7 | sed 's/ //g'`
if [ "$RESULT" = "remote" ]; then
RESULT=`grep ${UC} $TMPFILE | awk '{print $4}'`
fi
echo "user${x}cards.value $RESULT"
x=$(($x + 1))
done
rm -f $TMPFILE
cccam_version_clients
Code:
#!/bin/sh
# cccam_version_clients v0.51
#
# Monitoring CCcam's parameter using the WEBINFO HTTP port
#
### CONFIG - START
# List of Client versions you want to monitor, seperate by " "(<space>) (eg: "2.1.1 2.1.2")
CLIENTversLIST="2.0.1 2.0.11 2.1.1 2.1.2 2.1.3 2.1.4 2.2.0 2.2.1 2.2.2"
# Get current connected or generate from above "CLIENT vers LIST"? (yes/no)
USEversLIST="yes"
# /path/to/CCcam.cfg ... if your using USER/PASS ("" to disable and use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
USERNAME="xxx"
PASSWORD="xxx"
WEBINFOPORT="xxx"
# IP/Host of your CCcam-Server to connect to...
CCCAMIP="192.168.1.40"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract user/pass/port
proc_read_CCcamcfg() {
USERNAME=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
PASSWORD=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
WEBINFOPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
proc_get_infos() {
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ -z "$WEBINFOPORT" ]; then
WEBINFOPORT="16001"
fi
if [ -z "$USERNAME" ]; then
URL="http://${CCCAMIP}:${WEBINFOPORT}"
else
URL="http://${USERNAME}:${PASSWORD}@${CCCAMIP}:${WEBINFOPORT}"
fi
}
if [ ! -z "$HOME" ]; then
TMPFILE="${HOME}/.tmpfile"
elif [ -d "/tmp" ]; then
TMPFILE="/tmp/.tmpfile"
elif [ -d "/var/tmp" ]; then
TMPFILE="/var/tmp/.tmpfile"
elif [ -d "/usr/tmp" ]; then
TMPFILE="/usr/tmp/.tmpfile"
elif [ -d "/usr/local/tmp" ]; then
TMPFILE="/usr/local/tmp/.tmpfile"
else
TMPFILE=".tmpfile"
fi
# create array CLIENTvers
[*]
proc_get_client_vers() {
if [ "$USEversLIST" = "yes" ]; then
cVERSIONS=`echo $CLIENTversLIST | sort`
c=1
for V in $cVERSIONS; do
CLIENTvers[${c}]="$V"
c=$(($c + 1))
done
else
wget -q -O - "${URL}/clients" >$TMPFILE
cVERSIONS=`grep "|[0-9].[0-9].[0-9]" $TMPFILE | cut -d "|" -f5 | sort`
c=1
for cVER in ${cVERSIONS}; do
CVadded=""
if [ -z "$CVsetted" ]; then
CLIENTvers[${c}]="$cVER" ; CVsetted=1
else
for cVER2 in ${CLIENTvers
[*]}; do
if [ "$cVER2" = "$cVER" ]; then
CVadded=1
fi
done
if [ "$CVadded" != "1" ]; then
CLIENTvers[${c}]="$cVER" ; CVsetted=2
fi
fi
c=$(($c + 1))
done
fi
}
proc_get_infos
if [ "$1" = "config" ]; then
proc_get_client_vers
echo 'graph_title CCcam Clients by version'
echo 'graph_category CCcam'
echo 'graph_args --lower-limit 0'
echo 'graph_scale no'
if [ ! -z "$cVERSIONS" ]; then
for CLIENTver in ${CLIENTvers
[*]}; do
Cver2=`echo ${CLIENTver} | tr -d "."`
echo "CV${Cver2}.label ${CLIENTver}"
done
fi
rm -f $TMPFILE
exit 0
fi
proc_get_client_vers
if [ "$USEversLIST" = "yes" ]; then
wget -q -O - "${URL}/clients" >$TMPFILE
fi
if [ ! -z "$cVERSIONS" ]; then
for Cver in ${CLIENTvers
[*]}; do
cVc=`grep "|${Cver}" $TMPFILE | wc -l`
if [ -z "$cVc" ]; then
cVc=0
fi
Cver2=`echo ${Cver} | tr -d "."`
echo "CV${Cver2}.value ${cVc}"
done
fi
rm -f $TMPFILE
cccam_version_servers
Code:
#!/bin/sh
# cccam_version_servers v0.51
#
# Monitoring CCcam's parameter using the WEBINFO HTTP port
#
### CONFIG - START
# List of Server versions you want to monitor, seperate by " "(<space>) (eg: "2.1.1 2.1.2")
SERVERversLIST="2.0.1 2.0.11 2.1.1 2.1.2 2.1.3 2.1.4 2.2.0 2.2.1 2.2.2"
# Get current connected or generate from above "SERVER vers LIST"? (yes/no)
USEversLIST="yes"
# /path/to/CCcam.cfg ... if your using USER/PASS ("" to disable and use below settings)
# CCcam-default: /var/etc/CCcam.cfg
CCcamCFG="/var/etc/CCcam.cfg"
# ONLY if you dont run CCcam-Server on same Box as Munin (else set above CCcamCFG)
USERNAME="xxx"
PASSWORD="xxx"
WEBINFOPORT="xxx"
# IP/Host of your CCcam-Server to connect to...
CCCAMIP="192.168.1.40"
### CONFIG - END
# -------------------------------------------------------------- #
# >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< #
# -------------------------------------------------------------- #
# read CCcam.cfg and extract user/pass/port
proc_read_CCcamcfg() {
USERNAME=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
PASSWORD=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
WEBINFOPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
}
proc_get_infos() {
if [ ! -z "$CCcamCFG" ]; then
proc_read_CCcamcfg
fi
if [ -z "$WEBINFOPORT" ]; then
WEBINFOPORT="16001"
fi
if [ -z "$USERNAME" ]; then
URL="http://${CCCAMIP}:${WEBINFOPORT}"
else
URL="http://${USERNAME}:${PASSWORD}@${CCCAMIP}:${WEBINFOPORT}"
fi
}
if [ ! -z "$HOME" ]; then
TMPFILE="${HOME}/.tmpfile"
elif [ -d "/tmp" ]; then
TMPFILE="/tmp/.tmpfile"
elif [ -d "/var/tmp" ]; then
TMPFILE="/var/tmp/.tmpfile"
elif [ -d "/usr/tmp" ]; then
TMPFILE="/usr/tmp/.tmpfile"
elif [ -d "/usr/local/tmp" ]; then
TMPFILE="/usr/local/tmp/.tmpfile"
else
TMPFILE=".tmpfile"
fi
# create array SERVERvers
[*]
proc_get_server_vers() {
if [ "$USEversLIST" = "yes" ]; then
sVERSIONS=`echo $SERVERversLIST | sort`
c=1
for V in $sVERSIONS; do
SERVERvers[${c}]="$V"
c=$(($c + 1))
done
else
wget -q -O - "${URL}/servers" >$TMPFILE
sVERSIONS=`grep "|[0-9].[0-9].[0-9]" $TMPFILE | cut -d "|" -f5 | sort`
c=1
for sVER in ${sVERSIONS}; do
SVadded=""
if [ -z "$SVsetted" ]; then
SERVERvers[${c}]="$sVER" ; SVsetted=1
else
for sVER2 in ${SERVERvers
[*]}; do
if [ "$sVER2" = "$sVER" ]; then
SVadded=1
fi
done
if [ "$SVadded" != "1" ]; then
SERVERvers[${c}]="$sVER" ; SVsetted=2
fi
fi
c=$(($c + 1))
done
fi
}
proc_get_infos
if [ "$1" = "config" ]; then
proc_get_server_vers
echo 'graph_title CCcam Servers by version'
echo 'graph_category CCcam'
echo 'graph_args --lower-limit 0'
echo 'graph_scale no'
if [ ! -z "$sVERSIONS" ]; then
for SERVERver in ${SERVERvers
[*]}; do
Sver2=`echo ${SERVERver} | tr -d "."`
echo "SV${Sver2}.label ${SERVERver}"
done
fi
rm -f $TMPFILE
exit 0
fi
proc_get_server_vers
if [ "$USEversLIST" = "yes" ]; then
wget -q -O - "${URL}/servers" >$TMPFILE
fi
if [ ! -z "$sVERSIONS" ]; then
for Sver in ${SERVERvers
[*]}; do
sVc=`grep "|${Sver}" $TMPFILE | wc -l`
if [ -z "$sVc" ]; then
sVc=0
fi
Sver2=`echo ${Sver} | tr -d "."`
echo "SV${Sver2}.value ${sVc}"
done
fi
rm -f $TMPFILE
Zuletzt bearbeitet: