Feedback on power consumption graphs

  • Hi everyone,


    I wanted to create some graphs showing the current power consumption of my OMV server, so that I can monitor it over time.


    I could not find many hints on how to approach this matter, so I decided to use a plugin-like approach. I also could not find many best practices for adding custom graphs to the OMV web UI. Have I overlooked an existing plugin? I am fairly new to creating custom plugin-like extensions in OMV, so I am looking for advice and want to share my current work in progress.


    Perhaps some of the more experienced members of this forum could advise me on whether this is the best way to tackle my requirement.


    I should also mention that I measure the power consumption of my HP ProLiant server via hpasmcli (from hp-health), which gives me the current power consumption in watts for each running PSU. It might also be possible with iLo, but it is currently disabled on my server and I don't know how to configure it.


    This is my current approach:


    I created a small bash script that extracts the watt values from the hpasmcli -s show powersupply output as a collectd compatible string:

    After that, I added a custom collectd configuration file:

    Code: /etc/collectd/collectd.conf.d/99-hp-powersupply.conf
    LoadPlugin exec
    
    <Plugin exec>
      Exec "adminUser:adminGroup" "/usr/local/bin/hp_powersupply.sh"
      #Exec "root" "/usr/local/bin/hp_powersupply.sh"
    </Plugin>

    In order to run my hp_powersupply.sh script (especially hpasmcli) through collectd, I had to allow adminUser to run hpasmcli without a password prompt. Therefore, I had to create a custom sudoers configuration:

    Code: /etc/sudoers.d/adminUser_hpasmcli
    adminUser ALL=(ALL) NOPASSWD: /usr/sbin/hpasmcli

    After all this collectd was collecting my current power consumption for each PSU (and for all power supplies together) every minute. The already configured rrdcached daemon created the corresponding RRD files in /var/lib/rrdcached/db/localhost/hpasmcli-powersupply/:

    Quote from bash

    $ ls /var/lib/rrdcached/db/localhost/hpasmcli-powersupply/

    gauge-power_supply_1.rrd gauge-power_supply_2.rrd gauge-power_supply_total.rrd

    It took quite a while, until the first values were flushed to disk.

    I was now ready to create a Python script to render my graphs:

    After that, I created my graph page. I decided to use the same location as all the other graphs: Diagnostics/Performance Statistics. I also decided to put each PSU and the total consumption on a separate tab. I therefore created the following YAML files:

    YAML: /usr/share/openmediavault/workbench/navigation.d/diagnostics.performance-statistics.powersupply.yaml
    version: "1.0"
    type: navigation-item
    data:
      path: "diagnostics.performance-statistics.powersupply"
      text: _("Powersupply")
      icon: "mdi:lightning-bolt"
      url: "/diagnostics/performance-statistics/powersupply"
    YAML: /usr/share/openmediavault/workbench/route.d/diagnostics.performance-statistics.powersupply.yaml
    version: "1.0"
    type: route
    data:
      url: "/diagnostics/performance-statistics/powersupply"
      title: _("Powersupply")
      component: omv-diagnostics-performance-statistics-powersupply-rrd-page

    The result looks like this:



    I could see myself developing these power consumption graphs further if someone thinks they might be useful (e.g. currently, they only run on HP servers; I would like to be able to dynamically create tabs for every PSU; create a real plugin and configuration; etc.). However, I would need help with this, as I am new to OMV plugin and Debian package creation.


    I would be very grateful for any feedback. Maybe my approach is too over-engineered?


    Regards

    Edited 2 times, last by DerTyp: fixed typo in file path ().

  • chente

    Approved the thread.
    • Official Post

    I could see myself developing these power consumption graphs further if someone thinks they might be useful (e.g. currently, they only run on HP servers; I would like to be able to dynamically create tabs for every PSU; create a real plugin and configuration; etc.). However, I would need help with this, as I am new to OMV plugin and Debian package creation.


    I would be very grateful for any feedback. Maybe my approach is too over-engineered?

    I think they would be popular but possibly hard to expand to many systems. If you want to package it as a plugin, you could use the cputemp plugin as a model - https://github.com/OpenMediaVa…rs/openmediavault-cputemp It doesn't have the dynamic creation but that could be scripted or put in saltstack.


    Let me know what questions you have.

    omv 8.0.6-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!