[hptools] Un peu plus de diagnostics...
darcs-hash:20100121005603-ffbb2-8112a623215196f73881692a19479cf52b9f6df1.gz
This commit is contained in:
parent
ee4bac81fe
commit
5c2cae01ef
1 changed files with 7 additions and 2 deletions
|
@ -16,6 +16,7 @@ from commands import getstatusoutput
|
|||
from annuaires import chbre_prises, all_switchs
|
||||
from os.path import exists
|
||||
from os import system
|
||||
import sys
|
||||
from re import findall
|
||||
from config import vlans
|
||||
|
||||
|
@ -126,7 +127,7 @@ class snmp :
|
|||
try:
|
||||
self._machine = cl.search("host=%(host)s" % {'host': host})["machineCrans"][0]
|
||||
except IndexError:
|
||||
raise ValueError(u"Cette machine n'est pas un switch du Cr@ns")
|
||||
raise ValueError(u"Cette machine n'est pas un switch du Cr@ns : %s" % host)
|
||||
|
||||
# l'engineid du switch n'est que sa mac avec quelques fioritures autour...
|
||||
mac = self._machine.mac().replace(':', '')
|
||||
|
@ -246,7 +247,11 @@ class hpswitch :
|
|||
mac[6:8], mac[8:10], mac[10:12])
|
||||
|
||||
# On interroge le switch
|
||||
data = self.walk('STATISTICS-MIB::hpSwitchPortFdbAddress');
|
||||
try:
|
||||
data = self.walk('STATISTICS-MIB::hpSwitchPortFdbAddress')
|
||||
except ValueError:
|
||||
print >> sys.stderr, "Le switch %s fait du caca..." % self.switch
|
||||
return None
|
||||
|
||||
# On cherche dans data la bonne adresse MAC
|
||||
for (onesnmp, onemac) in data.iteritems():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue