[wiki-etch] suppression

darcs-hash:20090304160004-bd074-7e2630d385522d14ea3ad6a52ad0669b2ddc1b2e.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-03-04 17:00:04 +01:00
parent 4a1c67a459
commit aa5e8cdc52
67 changed files with 0 additions and 15442 deletions

View file

@ -1,56 +0,0 @@
# -*- coding: iso-8859-1 -*-
import re
from commands import getstatusoutput,getoutput
def execute(macro, text) :
lines = open('/usr/scripts/var/local.status').readlines()
f = macro.formatter
code = f.table(1)
typlist = ['routes', 'serveurs', 'serveurs de la ferme', 'switches', 'bornes', u'services extérieurs au crans']
for typ in typlist:
lines = lines [1:]
trucsdown = ''
while lines and not re.match('dummy_host_\d+ 0 \n', lines[0]):
if not re.search(' 0 ', lines[0]):
line = lines[0].split(' ')
trucsdown += f.table_row(1)
trucsdown += f.table_cell(1,{'style':'background-color:lightgrey;'})
trucsdown += unicode(f.text('%s (%s)' % (line [0], getoutput("grep '^%s[^-a-zA-Z.]' /usr/scripts/var/autostatus/hosts | cut -d ' ' -f 5-" % line [0])) ), "iso-8859-15")
trucsdown += f.table_cell(0)
# nombre de non réponse au ping
if int(line[1]) > 2 :
trucsdown += f.table_cell(1,{'style':'background-color:red;'})
trucsdown += f.text(u'down')
else :
trucsdown += f.table_cell(1,{'style':'background-color:blue;'})
trucsdown += f.text(u'état incertain')
trucsdown += f.table_cell(0)
trucsdown += f.table_row(0)
lines = lines [1:]
if trucsdown == '':
code += f.table_row(1)
code += f.table_cell(1,{'style':'background-color:silver;'})
code += f.text(u'Autostatus des '+typ)
code += f.table_cell(0)
code += f.table_cell(1,{'style':'background-color:lime;'})
code += f.text(u'OK')
code += f.table_cell(0)
code += f.table_row(0)
else:
code += f.table_row(1)
code += f.table_cell(1,{'style':'background-color:silver', 'colspan':'2'})
code += f.text(u'Autostatus des '+typ)
code += f.table_cell(0)
code += f.table_row(0)
code += trucsdown
trucsdown = ''
code += f.table(0)
return code