Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

python library for servrmgrd (was Re: Xserve SNMP-MIBs for Vital Hardware Stats)




On Jun 4, 2007, at 4:07 PM, Andre LaBranche wrote:
...
However, one nice thing about SNMP is that it is extremely extensible. Any data that you can retrieve in some fashion using a unix shell can be made available to SNMP via the use of the 'extensible mib'. Here is an example of how to get server monitor data via a shell:



While researching this, I figured I should probably go ahead and crank out some decent cacti templates and accompanying scripts that get executed via snmpd, since I couldn't find any. It shouldn't be too hard to provide an snmp view of the same data that server admin can show. It was also a good excuse to learn python, and as it turns out, the servrmgrd stuff I came up with makes a tidy little python library. I'm still working out the snmp details, but the python side is pretty much done, so here it is: http://www.dreness.com/bits/tech/srvrmgrIO/srvrmgrdIO.py

Here's a quick chunk of sample code that uses the library. This would print a list of names and IPs of all afp connections.

request = srvrmgrdIO.buildXML('getConnectedUsers', '', '')
pl = srvrmgrdIO.sendXML('servermgr_afp', request)
print "AFP Users:"
for u in pl['usersArray'] :
  print u['ipAddress'] + " ==> " + u['name']
print ""

A much more thorough treatment: http://www.dreness.com/blog/?p=38

Cheers,
-Andre
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden

References: 
 >Xserve SNMP-MIBs for Vital Hardware Stats (From: Gregory Hedo <email@hidden>)
 >Re: Xserve SNMP-MIBs for Vital Hardware Stats (From: Andre LaBranche <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.