| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- #!/usr/bin/env python3
- from cmk.graphing.v1 import Title
- from cmk.graphing.v1.graphs import Graph, MinimalRange
- from cmk.graphing.v1.metrics import (
- Color,
- DecimalNotation,
- Metric,
- SINotation,
- StrictPrecision,
- Unit,
- )
- # Voltage
- metric_p1_voltage = Metric(
- name="p1_voltage_v",
- title=Title("Voltage"),
- unit=Unit(
- DecimalNotation("V"),
- StrictPrecision(1),
- ),
- color=Color.BLUE,
- )
- graph_p1_voltage = Graph(
- name="p1_voltage",
- title=Title("P1 voltage"),
- simple_lines=["p1_voltage_v"],
- minimal_range=MinimalRange(200, 260),
- )
- # Power
- metric_p1_power = Metric(
- name="p1_power_w",
- title=Title("Power"),
- unit=Unit(
- SINotation("W"),
- StrictPrecision(0),
- ),
- color=Color.BLUE,
- )
- graph_p1_power = Graph(
- name="p1_power",
- title=Title("P1 power"),
- simple_lines=["p1_power_w"],
- minimal_range=MinimalRange(0, 3000),
- )
- # Current
- metric_p1_current = Metric(
- name="p1_current_a",
- title=Title("Current"),
- unit=Unit(
- DecimalNotation("A"),
- StrictPrecision(3),
- ),
- color=Color.BLUE,
- )
- graph_p1_current = Graph(
- name="p1_current",
- title=Title("P1 current"),
- simple_lines=["p1_current_a"],
- minimal_range=MinimalRange(0, 20),
- )
- # Energy import
- metric_p1_energy_total = Metric(
- name="p1_energy_total_kwh",
- title=Title("Total"),
- unit=Unit(
- SINotation("Wh"),
- StrictPrecision(3),
- ),
- color=Color.BLUE,
- )
- metric_p1_energy_t1 = Metric(
- name="p1_energy_t1_kwh",
- title=Title("Tariff 1"),
- unit=Unit(
- SINotation("Wh"),
- StrictPrecision(3),
- ),
- color=Color.GREEN,
- )
- metric_p1_energy_t2 = Metric(
- name="p1_energy_t2_kwh",
- title=Title("Tariff 2"),
- unit=Unit(
- SINotation("Wh"),
- StrictPrecision(3),
- ),
- color=Color.ORANGE,
- )
- graph_p1_energy = Graph(
- name="p1_energy",
- title=Title("P1 energy"),
- simple_lines=[
- "p1_energy_total_kwh",
- "p1_energy_t1_kwh",
- "p1_energy_t2_kwh",
- ],
- minimal_range=MinimalRange(0, 1),
- )
- # Gas
- metric_p1_gas = Metric(
- name="p1_gas_m3",
- title=Title("Gas"),
- unit=Unit(
- DecimalNotation("m³"),
- StrictPrecision(2),
- ),
- color=Color.BLUE,
- )
- graph_p1_gas = Graph(
- name="p1_gas",
- title=Title("P1 gas consumption"),
- simple_lines=["p1_gas_m3"],
- minimal_range=MinimalRange(0, 1),
- )
- # Voltage sag/swell counters
- metric_p1_voltage_sag_l1 = Metric(
- name="p1_voltage_sag_l1",
- title=Title("Voltage sags L1"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.BLUE,
- )
- metric_p1_voltage_sag_l2 = Metric(
- name="p1_voltage_sag_l2",
- title=Title("Voltage sags L2"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.GREEN,
- )
- metric_p1_voltage_sag_l3 = Metric(
- name="p1_voltage_sag_l3",
- title=Title("Voltage sags L3"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.ORANGE,
- )
- graph_p1_voltage_sags = Graph(
- name="p1_voltage_sags",
- title=Title("P1 voltage sags"),
- simple_lines=[
- "p1_voltage_sag_l1",
- "p1_voltage_sag_l2",
- "p1_voltage_sag_l3",
- ],
- minimal_range=MinimalRange(0, 1),
- )
- # Voltage swell counters
- metric_p1_voltage_swell_l1 = Metric(
- name="p1_voltage_swell_l1",
- title=Title("Voltage swells L1"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.BLUE,
- )
- metric_p1_voltage_swell_l2 = Metric(
- name="p1_voltage_swell_l2",
- title=Title("Voltage swells L2"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.GREEN,
- )
- metric_p1_voltage_swell_l3 = Metric(
- name="p1_voltage_swell_l3",
- title=Title("Voltage swells L3"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.ORANGE,
- )
- graph_p1_voltage_swells = Graph(
- name="p1_voltage_swells",
- title=Title("P1 voltage swells"),
- simple_lines=[
- "p1_voltage_swell_l1",
- "p1_voltage_swell_l2",
- "p1_voltage_swell_l3",
- ],
- minimal_range=MinimalRange(0, 1),
- )
- # Power failures
- metric_p1_any_power_fail = Metric(
- name="p1_any_power_failure",
- title=Title("Any power failures"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.BLUE,
- )
- metric_p1_long_power_fail = Metric(
- name="p1_long_power_failure",
- title=Title("Long power failures"),
- unit=Unit(DecimalNotation(""), StrictPrecision(0)),
- color=Color.RED,
- )
- graph_p1_power_failures = Graph(
- name="p1_power_failures",
- title=Title("P1 power failures"),
- simple_lines=[
- "p1_any_power_failure",
- "p1_long_power_failure",
- ],
- minimal_range=MinimalRange(0, 1),
- )
|