Last active
June 26, 2023 10:51
-
-
Save nomaster/3f2e13c4bbbe412e7e30 to your computer and use it in GitHub Desktop.
Ansible facts script for ethtool
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
#!/usr/bin/env python | |
import json | |
import subprocess | |
result = {} | |
interface_stats = subprocess.check_output("/usr/sbin/ethtool -i eth0", shell=True) | |
for line in interface_stats.strip().split("\n"): | |
key, value = line.split(": ") | |
result[key] = value | |
print json.dumps(result, indent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment