Write simple netsnmp apps in Python

Here’s a couple of different ways you can use netsnmp in Python.

I had a hard time finding documentation, and what I did find was old and outdated. I figured most of it out just by playing around with the library.

#!/usr/bin/env python
import netsnmp

string = 'public'
ver = 1
port = 161
host = ''

# uptime using method 1
bind1 = netsnmp.Varbind('sysUpTime.0')
# 1 minute load using method 2
bind2 = netsnmp.Varbind('.')

snmpget = netsnmp.snmpget(bind1,
uptime_seconds = snmpget[0]
print uptime_seconds

list = ( bind1, bind2 )
x = netsnmp.Session(DestHost=host,
output_list = x.get(list)
if not output_list:
    print "FAILED TO CONNECT!!!"

if output_list[0]:
    uptime = output_list[0]

if output_list[1]:
    load1 = output_list[1]

python blue and yellow logoNext I wrote a class to wrap it up as an AWN applet. If you’ve never heard of AWN or haven’t tried the avant-window-navigator you should definitely check it out and consider continuing development on it. It was the best app bar available; very pretty. It fit my needs at the time anyway.

I replaced the bottom gnome-panel with it. If you remove everything except the Launcher/Taskmanager applet and add the Show Desktop applet, it directly replaces gnome-panels functionality completely.

Gnome 3 Fallback Desktop Better than Gnome 3 itself

I don’t like the Gnome 3 desktop.

angry dude cartoon character
If all you use a computer for is facebook and instant messaging, you’ll probably love it. Gnome 3 desktop hides everything from you under multiple layers of mouse clicks in order to try to simplify the user experience. But what it actually does is over categorize everything!

I don’t like to have to constantly click-click-click to get to where I’m going. I don’t care how easy it is to respond to instant messages as they pop up along the bottom of my screen, I don’t like this new interface at all! This would work just fine on a tablet pc, but I’m on a desktop or full laptop most of the time.

If you’re like me, you try out new .iso image distributions in virtual machines. It’s easier to install, reinstall, and play with different settings all while easily resetting back to a fresh installation with a click of the revert-to-snapshot button.

The only downfall is that I don’t get to fully utilize the pow-wah of my graphics cards. I’m currently using a pair of NVidia GTX 470′s, but inside a Virtual Machine the host is using a slow Virtualbox software driver. Gnome 3 doesn’t even attempt to play with my slow non-3D accelerated graphics.

So it drops to a fallback desktop… that rocks!!

I like Gnome 3′s Fallback Desktop!

Ahh that warm fuzzy comfy feeling I get from the familiar surrounding of Gnome panels along the top and bottom of my desktop. But it’s not just because I’m used to it and know where everything is, it’s the usability. It’s all right there just like before, only now it looks more polished.

In order to try out the fallback desktop, you’ll have to go dig around in the new interface.

1. Click “Activities”
2. Change to the “Applications” tab near the top.
3. Click “System Tools” along the right, near the bottom.
4. Click the button “System Settings”, in the middle area.

Do you see how this is going? Jump around here, hunt and peck there. Am I supposed to be feeling productive just because I had to jump all over the place to get a single action performed? Continuing on…

5. System Info
6. Graphics
7. Forced Fallback

The image i’m playing with is the Fedora 15 iso available at http://www.gnome3.org/tryit.html . Your Gnome 3 fallback desktop may not have panels already started, but the methods are the same as Gnome 2. Take a look in ~/.gconf and ~/.gnome2 for the xml files too.