It's been, ooh, probably almost 10 years since I last swam about in the sea of fun you could have with zsh - since then, I just stuck with what I'd already got working and concentrated on other things. I recently had a minor urge to write something to complete SNMP MIB names in the shell for me, since it's something I'd been doing a lot lately and by George you get bored of going to another terminal window, ls'ing your tree of MIBs and copying and pasting it over.
So here it is. zsh's completion system completely changed since I last understood it, so most of my time was spent simply learning the new completion system from scratch. I haven't yet worked out why the autoloading doesn't pick up the initialization part (where it works out where your MIBs are, depending on whether you'd set MIBDIRS
or put it in ~/.snmp/snmp.conf
). As such, until I sort that out, the best way to use it is to stick it in a place like ~/lib/zsh/_snmpcmd
and put a
. ~/lib/zsh/_snmpcmd
in your .zshrc
.
...I'll report back when I have an answer to this
Anyway, you should now find that you can type "snmpwalk -m "
, hit Tab and get told there's about 1700-odd MIBs to complete (if you've got all the Cisco MIBs handy - see below for a mirroring script). The completer handles a +
in front of MIB names, and you can colon-separate them and still have completion. Having solved that, I typed in some basic completion guff for the rest of the options to snmpwalk
, as you'll see in the file - most of them are generic options, and should work with other stuff like snmptranslate
and such.
size: 4 KB.
last modified: 2006-07-16.
If you want your own mirror of the Cisco MIBs, here's what I use to get 'em. You don't need a CCO account for this, they're publically available.
size: 239 B.
last modified: 2006-07-16.
Technorati Tags: completion, mib, snmp, snmpwalk, zsh
12:07 geek · comments (0)
Comments have been closed for this post. If you've got something to say, please contact me by other means. Thanks!
Archives
...the last 3 months :
Recent Posts
Posts Recently Commented Upon
Other Recent Listening
Hair
sorta dark red with one blond bit.Wasting Time On
Links
Help Save The World
I may not (so far) run the kind of blog that posts social conscience linkage - other friends seem to have it covered better than I could manage (yes, I'm aware that's no excuse), but this doesn't mean that I don't care about the State of ThingsTM.
i donate to :
but there's other things worth worrying about too, like :
Looking For Something ?
Feed ?
yes indeed - a merged feed of my flickr photos, del.icio.us tags and posts here:
Licensing
This weblog is licensed under a Creative Commons License.