Commit 3c638177 authored by Olav Kvittem's avatar Olav Kvittem

Added zabbix reporting and remove bb, small fix to qstream

parent efac0979
#!/usr/bin/perl
$Version="1.3";
$Version="1.0";
# compute packet stream quality statistics for UDP/RTP from network or captured files(pcap)
# Base Olav Kvittem
......@@ -8,8 +8,9 @@ $Version="1.3";
# Mos values computation Gurvinder Singh, 2010-05-07
# XML, RTMP, TCP support, Pål Moen Møst, 2011
use locale;
# use Socket;
# use Net::RTP;
use Net::RTP;
use IO::Socket qw(:DEFAULT :crlf);
use IO::Socket::INET;
......@@ -46,6 +47,11 @@ $DEFAULT_PORT = 1234;
#my oh my,more globals
my ($rtmp,$period,$last,$debug,$swfurl,$pageurl,$flash_version,$reconnect);
my $PTS_MAX = 95443;
use Encode qw(decode);
@ARGV = map { decode 'utf8', $_ } @ARGV;
use Getopt::Long;
......@@ -371,6 +377,7 @@ sub end_xml{
$filename = $opt_xml;
$filename = $date."_".$time.".xml" if $opt_xml eq "date_time";
open (MYFILE, '>'.$filename) || die "Could not open $filename : $!";
binmode MYFILE, ":utf8";
my $final_xml = $doc->toString();
$twig->parse($final_xml);
$twig->flush(\*MYFILE);
......@@ -683,7 +690,7 @@ sub eat_stream {
die "Could not connect to port $port : $!";
$mc->mcast_add($address) || die "could not join $address:$port : $!";
} else { # unicast
$mc = IO::Socket::INET->new( LocalAddr=> $address, LocalPort => $port);
$mc = IO::Socket::INET->new( LocalAddr=> $address, LocalPort => $port, ReuseAddr=>1) || die "Could not create socket : $!";
}
my $tjoined=[gettimeofday];
......
......@@ -7,9 +7,11 @@ m=`date +%m`
d=`date +%d`
h=`date +%H`
export LANG=nb_NO.utf8
export LC_ALL=nb_NO.utf8
tv=/var/lib/qstream/data/iptv
ydir=$tv/$y
mpeg=/local/net-status/iptv/data
ydir=$mpeg/$y
test -d $ydir || mkdir $ydir
mdir=$ydir/$m
test -d $mdir || mkdir $mdir
......@@ -18,7 +20,7 @@ test -d $ddir || mkdir $ddir
#hdir=$ddir/$h
#test -d $hdir || mkdir $hdir
# tmp=$tv/data/tmp/$$
# tmp=$mpeg/data/tmp/$$
# test -d $tmp || mkdir $tmp
cd $ddir
......@@ -27,18 +29,21 @@ export IFS=";"
# export MALLOC_CHECK_=1 # write comprehensive error message when fail
ulimit -c 500000000
while read kanal mcaddr opt rest; do
while read kanal mcaddr opt navn rest; do
echo $kanal | egrep -q '^\s*#'
if test $? = 1 ; then # no comment
log=`echo $kanal | sed -e 's/ /_/g'`
xml=$log.`date +%T`.xml
/usr/bin/qstream -name "$kanal" -xml "$xml" -q -last 10 -nperiod 1 -net $opt $mcaddr >> $log.log 2>>$log.error
/usr/bin/qstream -name "$navn" -xml "$xml" -q -last 10 -nperiod 1 -net $opt $mcaddr >> $log.log 2>>$log.error
if test $? != 0 ; then # possible error - add CR
echo >> $log.log
fi
/usr/bin/qstream-check-bb -bb 158.38.130.84 "$xml"
# /local/net-status/bin/qstream-check-bb -bb 158.38.130.84 "$xml"
# if grep -q $kanal /local/net-status/iptv/etc/monitor.cf ; then
/usr/bin/qstream-check-zabbix "$xml" > /dev/null
# fi
if test ! -s $log.log ; then rm $log.log ; fi
if test ! -s $log.error ; then rm $log.error ; fi
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment