diff --git a/wiki/macro/MonitStatus.py b/wiki/macro/MonitStatus.py index 1485efb2..d6442105 100644 --- a/wiki/macro/MonitStatus.py +++ b/wiki/macro/MonitStatus.py @@ -14,6 +14,9 @@ Exemple : statusfolder = '/usr/scripts/var/monit/status' +def is_ok(state): + return state.lower() in ['running','accessible', 'status ok'] + def NotRunningHosts() : """ Retourne la liste des hotes ou Monit ne tourne pas ou que @@ -93,7 +96,7 @@ def AllStatusOff () : for s in status[h][t].keys() : # on supprime un status s'il est Up - if status[h][t][s]['status'].lower() in ['running','accessible'] : + if is_ok(status[h][t][s]['status']): status[h][t].pop(s) # reste-t-il des services dans le groupe @@ -126,7 +129,7 @@ def FormatService(Type, Service, Data, f) : result += f.text(Service) result += f.strong(0) result += f.table_cell(0) - if Data['status'].lower() in ['running','accessible'] : + if is_ok(Data['status']): result += f.table_cell(1,{'style':'background-color:lime'}) else : result += f.table_cell(1,{'style':'background-color:red'}) @@ -267,7 +270,7 @@ def execute(macro, filtre) : # création de la chaine de retour code = f.table_cell(0) - if s['status'].lower() in ['running','accessible'] : + if is_ok(s['status']): code += f.table_cell(1,{'style':'background-color:lime'}) else : code += f.table_cell(1,{'style':'background-color:red'})