p1-metrics.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env python3
  2. #
  3. # This file is for combining metrics of a P1 Meter from https://www.homewizard.com/ in Checkmk (https://checkmk.com).
  4. #
  5. from cmk.gui.i18n import _
  6. from cmk.gui.plugins.metrics.utils import graph_info, metric_info
  7. # .
  8. # .--Metrics-------------------------------------------------------------.
  9. # | __ __ _ _ |
  10. # | | \/ | ___| |_ _ __(_) ___ ___ |
  11. # | | |\/| |/ _ \ __| '__| |/ __/ __| |
  12. # | | | | | __/ |_| | | | (__\__ \ |
  13. # | |_| |_|\___|\__|_| |_|\___|___/ |
  14. # | |
  15. # +----------------------------------------------------------------------+
  16. # | Definitions of metrics |
  17. # '----------------------------------------------------------------------'
  18. # Title are always lower case - except the first character!
  19. # Colors: See indexed_color() in cmk/gui/plugins/metrics/utils.py
  20. metric_info["active_power_w"] = {
  21. "title": _("Total active power"),
  22. "unit": "w",
  23. "color": "31/a",
  24. }
  25. metric_info["active_power_l1_w"] = {
  26. "title": _("Active power L1"),
  27. "unit": "w",
  28. "color": "#40a0b0",
  29. }
  30. metric_info["active_power_l2_w"] = {
  31. "title": _("Active power L2"),
  32. "unit": "w",
  33. "color": "#ff6000",
  34. }
  35. metric_info["active_power_l3_w"] = {
  36. "title": _("Active power L3"),
  37. "unit": "w",
  38. "color": "43/a",
  39. }
  40. # .
  41. # .--Graphs--------------------------------------------------------------.
  42. # | ____ _ |
  43. # | / ___|_ __ __ _ _ __ | |__ ___ |
  44. # | | | _| '__/ _` | '_ \| '_ \/ __| |
  45. # | | |_| | | | (_| | |_) | | | \__ \ |
  46. # | \____|_| \__,_| .__/|_| |_|___/ |
  47. # | |_| |
  48. # +----------------------------------------------------------------------+
  49. # | Definitions of time series graphs |
  50. # '----------------------------------------------------------------------'
  51. graph_info["p1_power"] = {
  52. "title": _l("P1 Power"),
  53. "metrics": [
  54. ("active_power_w", "stack"),
  55. ("active_power_l1_w", "stack"),
  56. ("active_power_l2_w", "stack"),
  57. ("active_power_l3_w", "stack"),
  58. ],
  59. }