加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Perl 监控批量错误

发布时间:2020-12-15 23:46:44 所属栏目:大数据 来源:网络整理
导读:pre name="code" class="sql"#!/usr/bin/perl $dir='/home/websphere/WebSphere/AppServer/profiles/AppSrv01/logs/server1';$file = 'SystemErr.log';$mon_file="$dir/$file";print "$mon_file is $mon_filen";@warn_arr = qw/连接已关闭 NullPointExcept
<pre name="code" class="sql">#!/usr/bin/perl 
$dir='/home/websphere/WebSphere/AppServer/profiles/AppSrv01/logs/server1';
$file = 'SystemErr.log';
$mon_file="$dir/$file";
print "$mon_file is $mon_filen";
@warn_arr = qw/连接已关闭 NullPointException IndexOutOfBound/;
foreach $a  (@warn_arr){
   open (C,"<","$a.tmp")  ;
       
              $count  = <C>;   
                        
        print "$count is $countn";   
                                       
        $info =`tac $mon_file  |  grep "$a" | head -1`;   
                                                   
        open (A,"$mon_file") || die "$!n";   
$i=0;
        while (<A>) {   
 if ($_ =~ /$a/i){$i++};
                    };   
 if ($i !=0 && $i != $count && defined($count)) {print "error--$infon";};
   open (B,">","$a.tmp");   
   print B ("$in"); 

};
 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读