产品部提出在出厂的汇合录像机中,有些机器在现场使用时个别模拟视频输入窗口会出现黑屏的问题。
按照经验来说,应该是这些黑屏通道没有拿到视频输入的中断信号。
脚本目的有3个观测点
0.在多台机器上跑上拷机脚本,对比结果来确定是个别机器故障,还是每机器的普遍故障。
1.统计一下上万次开关机,出现个别窗口黑屏的概率。
2.出现黑屏的通道窗口是否固定,来适当排除驱动程序或软件的故障的可能性。
#!/bin/sh
counterFile=/etc/dvx_config/vicouter.log
errlogFile=/etc/dvx_config/vierr.log
detectFile=/proc/umap/vi
write_log_err()
{
if [ -f $counterFile ];
then
amount_counter=`head -n 1 $counterFile | awk -F ' ' '{print $1}'`
err_counter=`head -n 1 $counterFile | awk -F ' ' '{print $2}'`
else
amount_counter=0
err_counter=0
fi
if [ $1 = 1 ]
then
err_counter=`expr $err_counter + 1`
fi
amount_counter=`expr $amount_counter + 1`
echo $amount_counter $err_counter
echo $amount_counter $err_counter > $counterFile
}
if [ $# != 1 ];
then
echo input vichn amount : $0 16
exit 1;
fi
has_err=0
line_num=`grep -nr "VI CHN STATUS" /proc/umap/vi | awk -F ':' '{print $1}'`
line_start=`expr $line_num + 2`
line_end=`expr $line_start + $1 - 1`
echo line_num:$line_num line_start:$line_start line_end:$line_end
sed -n "$line_start,${line_end}p" $detectFile > /tmp/viInfo
while read ViChn bEnUsrP FrmTime FrmRate SendCnt SwLost Depth Rotate
do
#echo $ViChn $bEnUsrP $FrmTime $FrmRate $SendCnt $SwLost $Depth $Rotate
if [ $SendCnt = 0 ];
then
has_err=`expr $has_err + 1`
#echo has_err1 $has_err
echo ViChn=$ViChn $bEnUsrP $FrmTime $FrmRate $SendCnt $SwLost $Depth $Rotate >> $errlogFile
fi
done < /tmp/viInfo
if [ $has_err -gt 0 ];
then
write_log_err 1
echo amount_counter:$amount_counter err_counter:$err_counter
echo -e "--------`date +%Y%m%d-%H:%M:%S`-------\n" >> $errlogFile
else
write_log_err 0
echo amount_counter:$amount_counter err_counter:$err_counter
fi
效果如下, 固定通道故障,我手上这台肯定是硬件故障