[rancid] custom command, need help with pipe
Deny IP Any Any
denyipanyany at gmail.com
Mon Jan 10 15:52:25 UTC 2011
Hello. I'm trying to write a custom command to store the output of
'show int status | inc trunk'. It seems to work OK without the pipe
and "inc trunk", so I assume something is eating the pipe (|)
character. How should I escape it properly?
This is what I have, and it isn't working (missed cmd(s)).. can
somebody point me in the right direction?
{'show int status | inc trunk' => 'ShowIntTrunk'},
sub ShowIntTrunk {
print STDERR " In ShowIntTrunk: $_" if ($debug);
my($lines) = 0;
while (<INPUT>) {
tr/\015//d;
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /Line has invalid autocommand /;
return(1) if /(Invalid input detected|Type help or )/;
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
if (/^(<-+ More -+>)/) {
my($len) = length($1);
s/^$1\s{$len}//;
}
/^No matching debug flags set$/ && next;
ProcessHistory("COMMENTS","keysort","J1","!TRUNK: $_");
$lines++;
}
if ($lines) {
ProcessHistory("COMMENTS","keysort","J0","!\n");
}
return(0);
}
--
deny ip any any (4393649193 matches)
More information about the Rancid-discuss
mailing list