From 001b232cc7ea03976bb72baf8d952c151f53138f Mon Sep 17 00:00:00 2001 From: xchaos Date: Wed, 8 May 2013 22:15:33 +0000 Subject: [PATCH] bug fixes git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@225 251d49ef-1d17-4917-a970-b30cf55b089b --- optional-tools/hosts-ping.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/optional-tools/hosts-ping.py b/optional-tools/hosts-ping.py index 740a74b..ca19196 100755 --- a/optional-tools/hosts-ping.py +++ b/optional-tools/hosts-ping.py @@ -116,6 +116,8 @@ def merge_json_avgs(filename, smoke_array): if avg: if host['avg'] and avg['avg'] and avg['attempts']+host['attempts']-avg['loss']-host['loss'] > 0: host['avg'] = ((avg['attempts']-avg['loss'])*avg['avg']+(host['attempts']-host['loss'])*host['avg'])/(avg['attempts']+host['attempts']-avg['loss']-host['loss']) + else: + host['avg'] = avg['avg'] if not host['best'] or host['best'] > avg['best']: host['best'] = avg['best'] @@ -168,7 +170,7 @@ html = open(smokeping_html, 'w') html.write("

Aktuální odezva klientských zařízení

"); html.write(table_head % time.ctime()); -for kolikaty, host in enumerate(sorted(smokeping, key = lambda host: -host['loss']*attempts*timeout-host['avg'])): +for kolikaty, host in enumerate(sorted(smokeping, key = lambda host: -host['loss']*host['attempts']*timeout-host['avg'])): append_host(html, host, smokeping_url, kolikaty+1, red_treshold, green_treshold) html.write(table_end) @@ -182,7 +184,7 @@ html = open(smpater_html, 'w') html.write("

Aktuální odezva páteřních routerů

"); html.write(table_head % time.ctime()); -for kolikaty, host in enumerate(sorted(smpater, key = lambda host: -host['loss']*attempts*timeout-host['avg'])): +for kolikaty, host in enumerate(sorted(smpater, key = lambda host: -host['loss']*host['attempts']*timeout-host['avg'])): append_host(html, host, smpater_url, kolikaty+1, red_treshold, green_treshold) html.write(table_end) @@ -197,7 +199,7 @@ html = open(smokeping_avg_html, 'w') html.write("

Průměrná odezva klientských zařízení

"); html.write(table_head % time.ctime()); -for kolikaty, host in enumerate(sorted(smokeping, key = lambda host: -host['loss']*attempts*timeout-host['avg'])): +for kolikaty, host in enumerate(sorted(smokeping, key = lambda host: -host['loss']*host['attempts']*timeout-host['avg'])): append_host(html, host, smokeping_url, kolikaty+1, red_treshold, green_treshold) html.write(table_end) @@ -213,7 +215,7 @@ html = open(smpater_avg_html, 'w') html.write("

Průměrná odezva páteřních routerů

"); html.write(table_head % time.ctime()); -for kolikaty, host in enumerate(sorted(smpater, key = lambda host: -host['loss']*attempts*timeout-host['avg'])): +for kolikaty, host in enumerate(sorted(smpater, key = lambda host: -host['loss']*host['attempts']*timeout-host['avg'])): append_host(html, host, smpater_url, kolikaty+1, red_treshold, green_treshold) html.write(table_end) -- 2.30.2