Created
October 29, 2019 08:41
-
-
Save thuhak/15dc7bc503c7de7b2b4f6828fdef8ca7 to your computer and use it in GitHub Desktop.
get keep alive VIP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def _get_keepalive_vip(conf='/etc/keepalived/keepalived.conf'): | |
result = [] | |
try: | |
with open(conf) as f: | |
pat = re.compile(r'virtual_ipaddress(?:\s|\t\|\n)*\{(.*?)\}', re.DOTALL) | |
keepalive = f.read() | |
match = pat.findall(keepalive) | |
for d in match: | |
result.extend(d.split()) | |
except: | |
pass | |
return set(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment