tapi coba aku arep share command gawe F5 LB....nang ngisor iki insyallah iso di cakke nang F5..
kontjo-kontjo insyallah iso nglakoni ndelok-ndelok kahanan F5...suwunn
Seriously, there doesn't seem to be any other forum posts about this, which I find odd. I can't be the only person monitoring F5 config changes via RANCID!?!?!
The patch below applies against rancid-2.3.4, and changes f5rancid to using tmsh commands completely. Includes regex statements to remove fan RPM and temperatures from the tmsh show sys hardware output to reduce spurious emails.
It also dumps ZebOS.cfg and lists sockets associated with ZebOS bgpd by looking for TCP/179 sockets with lsof. If you're using ZebOS off an F5 this is absolutely critical IMHO.
--- bin/f5rancid.in.orig 2010-06-22 23:17:29.000000000 +0000
+++ bin/f5rancid.in 2011-12-07 21:05:25.551471472 +0000
@@ -305,6 +305,34 @@
return(0);
}
+# This routine parses "tmsh show sys hardware"
+sub ShowHardware {
+ print STDERR " In ShowHardware: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(1) if /(Invalid input detected|Type help or )/;
+ return(-1) if (/command authorization failed/i);
+
+ /fan speed/i && next;
+ /chassis temperature/i && next;
+ /degC/ && next;
+ s/\d+rpm//ig;
+ s/^\|//;
+ s/^\ \ ([0-9]+)(\ +).*up.*[0-9]/ $1$2up REMOVED/i;
+ s/^\ \ ([0-9]+)(\ +).*Air\ Inlet/ $1$2REMOVED Air Inlet/i;
+ s/^\ \ ([0-9]+)(\ +)[0-9]+\ +[0-9]+/ $1$2REMOVED REMOVED/;
+ /Type: / && ProcessHistory("COMMENTS","keysort","A0",
+ "#Chassis type: $'");
+
+ ProcessHistory("COMMENTS","keysort","B1","#$_") && next;
+ }
+ return(0);
+}
+
# This routine parses "bigpipe profile list"
sub ShowProfile {
print STDERR " In ShowProfile: $_" if ($debug);
@@ -413,6 +441,84 @@
return(0);
}
+# This routine parses "cat /config/ZebOS.conf"
+sub ShowZebOSconf {
+ my($line) = (0);
+ print STDERR " In ShowZebOSconf: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(1) if /(Invalid input detected|Type help or )/;
+ return(-1) if (/command authorization failed/i);
+
+ if (!$line++) {
+ ProcessHistory("ZEBOSCONF","","","#\n#/config/ZebOS.conf:\n");
+ }
+ ProcessHistory("ZEBOSCONF","","","# $_") && next;
+ }
+ return(0);
+}
+
+# This routine parses "lsof -n -i :179"
+sub ShowZebOSsockets {
+ my($line) = (0);
+ print STDERR " In ShowZebOSsockets: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(1) if /^\s*\^\s*$/;
+ return(1) if /(Invalid input detected|Type help or )/;
+ return(-1) if (/command authorization failed/i);
+
+ if (!$line++) {
+ ProcessHistory("ZEBOSSOCKETS","","","#\n#lsof -n -i :179:\n");
+ }
+ ProcessHistory("ZEBOSSOCKETS","","","# $_") && next;
+ }
+ return(0);
+}
+
+# This routine processes a "tmsh list"
+sub WriteTermTMSH {
+ my($lines) = 0;
+ print STDERR " In WriteTerm: $_" if ($debug);
+
+ while () {
+ tr/\015//d;
+ next if (/^\s*$/);
+ # end of config - hopefully. f5 does not have a reliable end-of-config
+ # tag.
+ if (/^$prompt/) {
+ $found_end++;
+ last;
+ }
+ return(-1) if (/command authorization failed/i);
+
+ $lines++;
+
+ if (/(bind-pw|encrypted-password|user-password-encrypted|passphrase) / && $filter_pwds >= 1) {
+ ProcessHistory("ENABLE","","","# $1 \n");
+ next;
+ }
+
+ # catch anything that wasnt matched above.
+ ProcessHistory("","","","$_");
+ }
+
+ if ($lines < 3) {
+ printf(STDERR "ERROR: $host configuration appears truncated.\n");
+ $found_end = 0;
+ return(-1);
+ }
+
+ return(0);
+}
+
# This routine processes a "bigpipe list"
sub WriteTerm {
my($lines) = 0;
@@ -515,18 +621,31 @@
sub DoNothing {print STDOUT;}
# Main
+# bigpipe commands
+#@commandtable = (
+# {'bigpipe version' => 'ShowVersion'},
+# {'bigpipe platform' => 'ShowPlatform'},
+# {'cat /config/bigip.license' => 'ShowLicense'},
+# {'bigpipe monitor list all' => 'ShowMonitor'},
+# {'bigpipe profile list' => 'ShowProfile'},
+# {'bigpipe base list' => 'ShowBaseRun'},
+# {'bigpipe db show' => 'ShowDb'},
+# {'bigpipe route static show' => 'ShowRouteStatic'},
+# {'ls --full-time --color=never /config/ssl/ssl.crt' => 'ShowSslCrt'},
+# {'ls --full-time --color=never /config/ssl/ssl.key' => 'ShowSslKey'},
+# {'bigpipe list' => 'WriteTerm'}
+#);
+# tmsh commands
@commandtable = (
- {'bigpipe version' => 'ShowVersion'},
- {'bigpipe platform' => 'ShowPlatform'},
- {'cat /config/bigip.license' => 'ShowLicense'},
- {'bigpipe monitor list all' => 'ShowMonitor'},
- {'bigpipe profile list' => 'ShowProfile'},
- {'bigpipe base list' => 'ShowBaseRun'},
- {'bigpipe db show' => 'ShowDb'},
- {'bigpipe route static show' => 'ShowRouteStatic'},
- {'ls --full-time --color=never /config/ssl/ssl.crt' => 'ShowSslCrt'},
- {'ls --full-time --color=never /config/ssl/ssl.key' => 'ShowSslKey'},
- {'bigpipe list' => 'WriteTerm'}
+ {'tmsh show /sys version' => 'ShowVersion'},
+ {'tmsh show /sys hardware' => 'ShowHardware'},
+ {'tmsh show /sys license' => 'ShowLicense'},
+ {'cat /config/ZebOS.conf' => 'ShowZebOSconf'},
+ {'lsof -i :179' => 'ShowZebOSsockets'},
+ {'tmsh show /net route static' => 'ShowRouteStatic'},
+ {'ls --full-time --color=never /config/ssl/ssl.crt' => 'ShowSslCrt'},
+ {'ls --full-time --color=never /config/ssl/ssl.key' => 'ShowSslKey'},
+ {'tmsh list' => 'WriteTermTMSH'},
);
# Use an array to preserve the order of the commands and a hash for mapping
# commands to the subroutine and track commands that have been completed.
Original bigpipe command | Equivalent tmsh command |
b platform | tmsh show sys hardware (or) tmsh show cm device (v11 only) (or) tmsh list cm device (v11 only) |
b version | tmsh show sys software (or) tmsh list sys software |
b virtual list | tmsh list ltm virtual |
b virtual show | tmsh show ltm virtual |
b load | tmsh load sys config |
b save | tmsh save sys config |
b export [filename.scf] | tmsh save sys scf [filename.scf] |
b import [filename.scf] | tmsh load sys scf [path][filename.scf] |
b interface show | tmsh show net interface |
b interface list | tmsh list net interface |
b vlan show | tmsh show net vlan |
b vlan list | tmsh list net vlan |
b self list | tmsh list net self |
b self show | tmsh show running-config net self |
b config sync all | tmsh sys config-sync |
|