Difference between revisions of "F5 clear stats"
Jump to navigation
Jump to search
(Created page with "``` for i in $(tmsh -q -c "list auth partition" | grep auth | awk '{print $3}'); do echo $i; tmsh -q -c "cd /$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
``` | ``` | ||
for i in $(tmsh -q -c "list auth partition" | grep auth | awk '{print $3}'); do echo $i; tmsh -q -c "cd /$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address"; done | for i in $(tmsh -q -c "list auth partition" | grep auth | awk '{print $3}'); do echo $i; tmsh -q -c "cd /$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address"; done | ||
+ | ``` | ||
+ | |||
+ | # Clear all partitions via ssh script | ||
+ | ``` | ||
+ | #!/bin/bash | ||
+ | set -eu | ||
+ | |||
+ | F5_USER="foo" | ||
+ | F5_PASS="bar" | ||
+ | |||
+ | hosts=( | ||
+ | "myf5.example.com" | ||
+ | ) | ||
+ | |||
+ | for host in "${hosts[@]}"; do | ||
+ | echo $host; echo sleep 3; sleep 3 | ||
+ | sshpass -p "$F5_PASS" ssh -T $F5_USER@$host << EOF | ||
+ | bash -c "for i in \$(tmsh -q -c \"list auth partition\" | grep auth | awk '{print \$3}'); do echo \$i; tmsh -q -c \"cd /\$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address\"; done" | ||
+ | EOF | ||
+ | done | ||
``` | ``` |
Latest revision as of 23:08, 1 March 2024
for i in $(tmsh -q -c "list auth partition" | grep auth | awk '{print $3}'); do echo $i; tmsh -q -c "cd /$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address"; done
Clear all partitions via ssh script
#!/bin/bash set -eu F5_USER="foo" F5_PASS="bar" hosts=( "myf5.example.com" ) for host in "${hosts[@]}"; do echo $host; echo sleep 3; sleep 3 sshpass -p "$F5_PASS" ssh -T $F5_USER@$host << EOF bash -c "for i in \$(tmsh -q -c \"list auth partition\" | grep auth | awk '{print \$3}'); do echo \$i; tmsh -q -c \"cd /\$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address\"; done" EOF done