Created
November 9, 2017 16:51
-
-
Save britcey/1f185b1c56a7a10b4bbaf7cbcf4f3291 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
#!/usr/bin/env ruby | |
# use snmptranslate to lookup OID if there's no comment after an existing numeric OID | |
def translate_oid(oid) | |
@cache ||= {} | |
@cache[oid] ||= `snmptranslate -Os -mALL #{oid}` | |
end | |
file = 'generator.yml.j2' | |
File.open(file).each do |l| | |
if l =~ /^(\s+)([\d\.]+),*$/ | |
print "#{$1}#{$2}, # #{translate_oid $2}" | |
else | |
print l | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment