Created
May 24, 2017 22:57
-
-
Save josephoaks/e65e337dc5565e32416a1341a977f360 to your computer and use it in GitHub Desktop.
This file contains 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
--- custom fact --- | |
Facter.add(:if_speed) do | |
setcode do | |
Facter::Core::Execution.exec('bash script') | |
end | |
end | |
--- bash script --- | |
#!/bin/bash | |
for i in `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d'`; do | |
ethtool $i | if [[ "Speed: 1000" ]]; then | |
line=$(head -n 1) | |
echo $line|awk '{print $3}'|sed 's/://' | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment