mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-22 04:59:34 +01:00
72a5a3d8a8
GitOrigin-RevId: fc5c90c756d9cc21dbc4e55281bfa1d8b4a0a09b
22 lines
650 B
Python
Executable File
22 lines
650 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Generate network diagnostics information and generate a .txt file."""
|
|
|
|
import pathlib
|
|
import shutil
|
|
import subprocess
|
|
|
|
|
|
def generate_netstat():
|
|
if shutil.which("netstat") is None:
|
|
print('Command not found: netstat. Skipping "generate and upload network diagnostics".')
|
|
return
|
|
|
|
with open("network_diagnostics.txt", "w") as outfile:
|
|
subprocess.run(["netstat"], stdout=outfile, stderr=subprocess.STDOUT, check=True)
|
|
|
|
|
|
if not pathlib.Path("resmoke_error_code").is_file():
|
|
print('resmoke_error_code not found. Skipping "generate and upload network diagnostics".')
|
|
else:
|
|
generate_netstat()
|