Bonjour
J'ai un prog python (ci dessous simplifié) qui fait un set snmp.
Quand je le lance depuis mon Ubuntu 13.10 (avec Python 2.7.5+) ca marche nickel
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #! /usr/bin/env python # -*- coding: iso-8859-1 -*- from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.proto import rfc1902 cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBinds = cmdGen.setCmd( cmdgen.CommunityData('private', mpModel=0), cmdgen.UdpTransportTarget(('192.168.0.70', 161)), ('1.3.6.1.4.1.36582.32', rfc1902.Integer(1)) ) # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex)-1] or '?' ) ) else: for name, val in varBinds: print('%s = %s' % (name.prettyPrint(), val.prettyPrint()))
Quand je le lance depuis un Ubuntu 12.04 (avec Python 2.7.3) ca plante avec le message suivant :
A priori ca doit etre du soit a un addon python que j'ai pas sur l'Ubuntu 12.04 soit de la version python
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Traceback (most recent call last): File "./snmpset.py", line 10, in <module> cmdgen.CommunityData('private', mpModel=0), TypeError: __init__() takes at least 3 arguments (3 given)
(le snmpset en ligne de commande marche bien sur les 2 machines...)
Savez vous comment afficher la liste des plugins python que l'on a installé avec leurs versions ?
Ou avez vous une autre idee ;-)
Merci
Partager