#!/usr/bin/env python3
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
def parse_apc_ats_output(info):
parsed = {}
for index, voltage_str, current_str, perc_load_str, power_str in info:
for key, value_str, factor in [
("voltage", voltage_str, 1),
("current", current_str, 0.1),
("perc_load", perc_load_str, 1),
("power", power_str, 1),
]:
try:
value = float(value_str) * factor
except ValueError:
continue
instance = parsed.setdefault(index, {})
This file has been truncated. show original