diff --git a/elstat/blueprints/api.py b/elstat/blueprints/api.py index 16fd91e..9e7bbed 100644 --- a/elstat/blueprints/api.py +++ b/elstat/blueprints/api.py @@ -52,8 +52,6 @@ def get_graphs(manager): def _raw_uptime(cur, service_name: str, worker, time_period: int) -> str: """Calculate uptime for a service given a timeframe.""" - - # get total period of the last 24 hours max_tstamp = time.time() * 1000 min_tstamp = max_tstamp - time_period @@ -68,8 +66,8 @@ def _raw_uptime(cur, service_name: str, worker, time_period: int) -> str: row = cur.fetchone() down_hits = row[0] - # total downtime in seconds - downtime = down_hits * worker.service['poll'] + # total downtime in milliseconds + downtime = down_hits * worker.service['poll'] * 1000 # calculate total downtime in percentage percent = Decimal(downtime) / Decimal(t_period)