troubleshooting Question

strange simple error

Avatar of 3XLcom
3XLcom asked on
Perl
6 Comments1 Solution366 ViewsLast Modified:
there are 3 part of errors that we get

1. the beginning errors
2. in the code you should see if ($reason eq "mbps" ) {
but it still applie else part of if

3. why do we get numeric  error :S

[root@sflow islemler]# perl deneme.pl
Unquoted string "paketlimiti" may clash with future reserved word at deneme.pl line 19.
Unquoted string "trafiklimiti" may clash with future reserved word at deneme.pl line 23.
Name "main::paketlimiti" used only once: possible typo at deneme.pl line 4.
Name "main::trafiklimiti" used only once: possible typo at deneme.pl line 5.
Argument "trafiklimiti" isn't numeric in numeric gt (>) at deneme.pl line 23, <$fh> line 1.
paket limiti asildi
mbps

178.20.230.51 35mbps
1387666838 178.20.230.51 35 mbps
paket limiti asildi
pps

178.20.230.51 3072pps
1387666838 178.20.230.51 3072 pps
paket limiti asildi
mbps

178.20.227.86 11mbps
1387666838 178.20.227.86 11 mbps
paket limiti asildi
pps

79.110.81.134 1536pps
1387666838 79.110.81.134 1536 pps
paket limiti asildi
mbps

178.20.230.51 32mbps
1387666839 178.20.230.51 32 mbps
paket limiti asildi
pps

178.20.230.51 3328pps
1387666839 178.20.230.51 3328 pps









use warnings;

 $paketlimiti = 2500;
 $trafiklimiti = 10;

open(my $fh, '-|', 'sflowtool -4 -p 3601  | /scripts/DoSTargets') or die $!;
while (my $line = <$fh>) {

#print ((split(/ /, $line))[1],"\n");


my $ip  = (split(/ /, $line))[1];
my $size = (split(/ /, $line))[2];
my $reason = (split(/ /, $line))[3];


if ($reason eq "mbps" ) {
        if ($size >  paketlimiti) {
                print "trafik limiti asildi \n";
        }
}else{
        if ($size >  trafiklimiti) {
                print "paket limiti asildi \n";
        }
}

print $reason . "\n";
print $ip." ".$size.$reason;
print $line;
}

close $fh;
ASKER CERTIFIED SOLUTION
FishMonger

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros