Posts Tagged “snmp”

Following on from the python bindings post I found myself with a real problem,

the netsnmp bindings I could not for the life of me get to take the redhat cluste MIB files, so what did that leave me with, walking the entire parent cluster OID, manually matching the returned OID’s to their MIB names based on the value returned as I couldn’t find a decent mib browser or script to convert them …

At any rate here is a subset of OID’s for polling the redhat cluster service using snmp, please note that are more OID’s but these vary on your cluster config.

Python code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
rhc_oid = '.1.3.6.1.4.1.2312.8'
        data_oids = {
                                'rhcMIBVersion':'.1.1',
                                'rhcClusterName':'.2.1',
                                'rhcClusterStatusCode':'.2.2',
                                'rhcClusterStatusDesc':'.2.3',
                                'rhcClusterVotesNeededForQuorum':'.2.4',
                                'rhcClusterVotes':'.2.5',
                                'rhcClusterQuorate':'.2.6',
                                'rhcClusterNodesNum':'.2.7',
                                'rhcClusterNodesNames':'.2.8',
                                'rhcClusterAvailNodesNum':'.2.9',
                                'rhcClusterAvailNodesNames':'.2.10',
                                'rhcClusterUnavailNodesNum':'.2.11',
                                'rhcClusterUnavailNodesNames':'.2.12',
                                'rhcClusterServicesNum':'.2.13',
                                'rhcClusterServicesNames':'.2.14',
                                'rhcClusterRunningServicesNum':'.2.15',
                                'rhcClusterRunningServicesNames':'.2.16',
                                'rhcClusterStoppedServicesNum':'.2.17',
                                'rhcClusterStoppedServicesNames':'.2.18',
                                'rhcClusterFailedServicesNum':'.2.19',
                                'rhcClusterFailedServicesNames':'.2.20'}

        for item in data_oids:
                oid = '%s%s' % (rhc_oid,data_oids[item])
                print item,oid

Tags: , , ,

Comments No Comments »

UPDATE 28/06/10: added –libdir=/usr/lib64 –enable-shared otherwise shared libs are not built at all!

Having spent a few hours trying to get this working on CentOS 5.4 x64 I am posting this blog entry for others to reference:

Download and complie net-snmp >= 5.4.2.1 http://net-snmp.sourceforge.net/

1
2
3
4
5
./configure --with-python-modules --libdir=/usr/lib64 --enable-shared
make && make install
cd /path/to/net-snmp-src/python/
python ./setup.py build
python ./setup.py test

You may get ImportError: libnetsnmp.so.20, this is due to x64 build creating as /usr/lib64/libnetsnmp.so.10

1
2
ln -s /usr/lib64/libnetsnmp.so.10.0.3 /usr/lib64/libnetsnmp.so.20
python ./setup.py install

And you are done, you can now use the netsnmp python bindings, I’d recomend seeing the examples here: http://www.ibm.com/developerworks/aix/library/au-netsnmpnipython/

Tags: , , ,

Comments No Comments »