Untitled

 avatar
unknown
plain_text
2 years ago
630 B
2
Indexable
with open(agent_file, 'rt', encoding='latin-1') as file:
                for line in file:
                    if re.match(fr"^{i}\.\b", line):  # Match exact prefix pattern

                        if ".privatip" in line:
                            vm_ip = re.findall(r'[0-9]+(?:\.[0-9]+){3}', line)
                            vm_ip = vm_ip[0] if vm_ip else None
                        elif line.startswith(str(vm) + ".vmmetricskpi.log.filename"):
                            syslog_file_location = line.split("=")[1].strip()

                    if vm_ip and syslog_file_location:
                        break

Editor is loading...