On ajoute un who4J
This commit is contained in:
parent
e4857523d0
commit
a800a65793
1 changed files with 15 additions and 7 deletions
|
@ -43,7 +43,7 @@ def pretty_name(item):
|
|||
|
||||
def show_liste_by_prop(liste):
|
||||
by_owner = dict()
|
||||
|
||||
|
||||
for machine in liste:
|
||||
# ldap_crans or lc_ldap
|
||||
owner = (getattr(machine, 'proprietaire', None) or \
|
||||
|
@ -67,7 +67,7 @@ def _mucode(u):
|
|||
class WhosThere(object):
|
||||
""": Nom du local, tel qu'il apparaît sur munin, et cie"""
|
||||
name = u"Unamed Local"
|
||||
|
||||
|
||||
""": Liste de macs et hostsname qui doivent être ignorées"""
|
||||
expected = []
|
||||
|
||||
|
@ -79,7 +79,7 @@ class WhosThere(object):
|
|||
self._ignore_inactive = ignore
|
||||
if wifi_only is not None:
|
||||
self._ignore_wifi_only = wifi_only
|
||||
|
||||
|
||||
def populate_from_mac(self, mac):
|
||||
"""Rempli à partir de la mac"""
|
||||
fm = self.db.search("mac=%s" % mac)
|
||||
|
@ -180,13 +180,13 @@ graph_category environnement""" % _mucode(munin_title)
|
|||
%(name)s.colour %(color)06X""" % {'name': name, 'descr': _mucode(descr), 'color': color}
|
||||
# Dans le doute, n'affichons pas les adhérents
|
||||
print "adh.graph no"
|
||||
|
||||
|
||||
def munin_values(self):
|
||||
res = self.query()
|
||||
for name in STATE_DESCR.iterkeys():
|
||||
print """%(name)s.value %(value)d\n""" % \
|
||||
{'name': name, 'value': len(res[name]) }
|
||||
|
||||
|
||||
class WhoKfet(WhosThere):
|
||||
name = u"Kfet"
|
||||
|
||||
|
@ -197,7 +197,7 @@ class Who2B(WhosThere):
|
|||
name = u"2B"
|
||||
|
||||
expected = ['00:07:cb:b1:99:4e'] # Freebox
|
||||
|
||||
|
||||
def do_scan(self):
|
||||
# Tous les gens au 2B sont supposés actifs (local technique quoi)
|
||||
# mais on cache quand-même les personnes connectées en WiFi
|
||||
|
@ -206,17 +206,25 @@ class Who2B(WhosThere):
|
|||
|
||||
class WhoDAlembert(WhosThere):
|
||||
name = u"D'Alembert (PR)"
|
||||
|
||||
|
||||
expected = ['danae.wifi.crans.org']
|
||||
|
||||
def do_scan(self):
|
||||
self.populate_from_ap('danae')
|
||||
|
||||
class Who4J(WhosThere):
|
||||
name = u"4J"
|
||||
def do_scan(self):
|
||||
self.set_ignore_inactive(True, wifi_only=True)
|
||||
self.populate_from_switch('batj-3.adm.crans.org', 7)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
where = {
|
||||
'dalembert': WhoDAlembert,
|
||||
'2b': Who2B,
|
||||
'kfet': WhoKfet,
|
||||
'4j': Who4J,
|
||||
}
|
||||
for what in sys.argv[1:]:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue