How to see energy rate

Hi everyone,
i was used to use either

upower -i /org/freedesktop/UPower/devices/battery_BAT0

or (when AC is connected)

path="/sys/class/power_supply/BAT0"; value=$(echo "scale=1; $(cat ${path}/current_now) * $(cat ${path}/voltage_now) / 10^12" | bc); [[ $value == "0" ]] && echo "" || echo "${value}W"

to see my laptop power consumption till i have find this amazing netdata tool.
Unfortunately my “Sensors” tab is only reporting voltages while my “Power Supply” tab is only showing current charge %.
Is there a way to have access to the actual Watts or Wh?
I’m using docker with the latest container.

Regards,

You should enable the charts you need in Netdata configuration

[plugin:proc:/sys/class/power_supply]
	battery energy = yes

So if i make a copy of the conf from e.g. http://localhost:19999/netdata.conf and paste it with that command enabled in “./netdataconfig/” then according to docker command -v ./netdataconfig:/etc/netdata i should be good to go?
Also is there a way to make a Gauge with such value in the “Overview of the key system metrics.”

EDIT:
It seems that if i use ./netdataconfig:/etc/netdata:ro (e.g. local folder in order to copy/paste the new conf) as suggested for docker-compose, the tab “Sensor” disappears. I might open an issue on github soon

@maxdd check Install Netdata with Docker | Learn Netdata

That’s the guide i’ve followed but without luck, the “Sensor” tab is disappearing without even touching the config itself. I might look into it tomorrow but i’ve double checked going back to default volumes and “Sensor” tab came back again

Well, that indicates that there is a problem, lets check logs

docker logs NAME 2>&1 | grep -E -i “sensor|charts.d”

Here is the command

~/docker/netstat$ docker logs netdata 2>&1 | grep -E -i "sensor|charts.d"
    2021-03-30 06:38:11: netdata INFO  : PLUGINSD[charts.d] : thread created with task id 150
    2021-03-30 06:38:11: netdata INFO  : PLUGINSD[charts.d] : set name of thread 150 to PLUGINSD[charts
    2021-03-30 06:38:12: freeipmi.plugin ERROR : MAIN : ipmi_monitoring_sensor_readings_by_record_id(): internal syste                m error (errno 2, No such file or directory)
    2021-03-30 06:38:13: netdata INFO  : PLUGINSD[charts.d] : connected to '/usr/libexec/netdata/plugins.d/charts.d.pl                ugin' running on pid 239
    2021-03-30 06:38:13: charts.d: INFO: main: started from '/usr/libexec/netdata/plugins.d/charts.d.plugin' with options: 1
    2021-03-30 06:38:13: charts.d: INFO: main: Configuration file '/usr/lib/netdata/conf.d/charts.d.conf' loaded.
    2021-03-30 06:38:13: charts.d: WARNING: main: Configuration file '/etc/netdata/charts.d.conf' not found.
    2021-03-30 06:38:13: charts.d: INFO: example: is disabled. Add a line with example=force in '/etc/netdata/charts.d.conf' to enable it (or remove the line that disables it).
    2021-03-30 06:38:13: charts.d: INFO: sensors: is disabled. Add a line with sensors=force in '/etc/netdata/charts.d.conf' to enable it (or remove the line that disables it).
    2021-03-30 06:38:13: go.d ERROR: prometheus[pcsensor_temper_exporter_local] Get "http://127.0.0.1:9204/metrics": dial tcp 127.0.0.1:9204: connect: connection refused
    2021-03-30 06:38:13: go.d ERROR: prometheus[pcsensor_temper_exporter_local] check failed
    2021-03-30 06:38:13: charts.d: WARNING: ap: command 'iw' is not found in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin.
    2021-03-30 06:38:13: charts.d: ERROR: ap: module's 'ap' check() function reports failure.
    2021-03-30 06:38:13: charts.d: WARNING: apcupsd: command 'apcaccess' is not found in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin.
    2021-03-30 06:38:13: charts.d: ERROR: apcupsd: module's 'apcupsd' check() function reports failure.
    2021-03-30 06:38:13: charts.d: WARNING: libreswan: command 'ipsec' is not found in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin.
    2021-03-30 06:38:13: charts.d: ERROR: libreswan: module's 'libreswan' check() function reports failure.
    2021-03-30 06:38:13: charts.d: : nut: command 'upsc -l ' failed with code 127:
    2021-03-30 06:38:13: charts.d: ERROR: nut: Cannot find UPSes - please set nut_ups='ups_name' in /nut.conf
    2021-03-30 06:38:13: charts.d: ERROR: nut: module's 'nut' check() function reports failure.
    2021-03-30 06:38:13: charts.d: WARNING: opensips: command 'opensipsctl' is not found in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin.
    2021-03-30 06:38:13: charts.d: ERROR: opensips: module's 'opensips' check() function reports failure.
    2021-03-30 06:38:13: charts.d: FATAL: main: No charts to collect data from.
    2021-03-30 06:38:13: netdata INFO  : PLUGINSD[charts.d] : called DISABLE. Disabling it.
    2021-03-30 06:38:13: netdata INFO  : PLUGINSD[charts.d] : PARSER ended
    2021-03-30 06:38:13: netdata ERROR : PLUGINSD[charts.d] : '/usr/libexec/netdata/plugins.d/charts.d.plugin' (pid 239) disconnected after 0 successful data collections (ENDs). (errno 22, Invalid argument)
    2021-03-30 06:38:13: netdata INFO  : PLUGINSD[charts.d] : '/usr/libexec/netdata/plugins.d/charts.d.plugin' (pid 239) does not generate useful output but it reports success (exits with 0). Will not start it again - it is now disabled..
    2021-03-30 06:38:13: go.d ERROR: prometheus[pms5003_particulate_matter_sensor_exporter_local] Get "http://127.0.0.1:9662/metrics": dial tcp 127.0.0.1:9662: connect: connection refused
    2021-03-30 06:38:13: go.d ERROR: prometheus[pms5003_particulate_matter_sensor_exporter_local] check failed
    2021-03-30 06:38:14: python.d INFO: plugin[main] : [sensors] built 1 job(s) configs
    2021-03-30 06:38:14: python.d INFO: plugin[main] : [w1sensor] built 1 job(s) configs
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:15: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:16: python.d ERROR: sensors[sensors] : b'curr1_input': Can't read
    2021-03-30 06:38:16: python.d ERROR: sensors[sensors] : b'in0_input': Can't read
    2021-03-30 06:38:16: python.d INFO: plugin[main] : sensors[sensors] : check success
    2021-03-30 06:38:16: python.d ERROR: w1sensor[w1sensor] : [Errno 2] No such file or directory: '/sys/bus/w1/devices/'
    2021-03-30 06:38:16: python.d INFO: plugin[main] : w1sensor[w1sensor] : check failed

But i have noticed that after few minutes the “Sensors” tab appears again (i retyped the command but the result has been the same)

i have added in the config the command above and by browsing it via URL i see the following

# section 'plugin:proc:/sys/class/power_supply' is not used.
[plugin:proc:/sys/class/power_supply]
	battery energy = yes

Moreover i’ve noticed that if the AC is connected (e.g. battery charging) i can see the current (not the energy) and when there is only BAT0 i can see only the voltage (i can always see the temperature otherwise)

Please check if

[plugin:proc]
	/sys/class/power_supply = yes

It is as such (with # in front)

# /sys/class/power_supply = yes

am i wrong in thinking that the default behavior is “yes” when it is written a such?

Anyway i’ve changed it and now the config is shown as such

[plugin:proc:/sys/class/power_supply]
	battery energy = yes
	# battery capacity = yes
	# battery charge = no
	# power supply voltage = no
	# keep files open = auto
	# directory to monitor = /host/sys/class/power_supply

but yet i can’t see it.
Powersupply → BAT0 is only showing capacity
Sensors is only showing voltage

Any help? @ilyam8 @vlvkobal

What are the contents of /host/sys/class/power_supply/BAT0?

You are right. It’s very weird you get the message “section is not used” by default.

Where do i see the content of host/sys/class/power_supply/BAT0 ? you mean from the webpage or the conf? or what?

From the inside of the container. ls -al host/sys/class/power_supply/BAT0.

bash-5.0# ls -al host/sys/class/power_supply/BAT0
lrwxrwxrwx 1 root root 0 Mar 31 08:03 host/sys/class/power_supply/BAT0 → …/…/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0

Well, it’s not the information I wanted to see. Please do ls -alL instead of ls -al.

total 0
drwxr-xr-x    4 root     root             0 Mar 31 08:03 .
drwxr-xr-x    3 root     root             0 Mar 31 08:03 ..
-rw-r--r--    1 root     root          4096 Apr  2 12:54 alarm
-r--r--r--    1 root     root          4096 Mar 31 08:03 capacity
-r--r--r--    1 root     root          4096 Apr  2 12:54 capacity_level
-r--r--r--    1 root     root          4096 Mar 31 08:03 charge_full
-r--r--r--    1 root     root          4096 Mar 31 08:03 charge_full_design
-r--r--r--    1 root     root          4096 Mar 31 08:03 charge_now
-r--r--r--    1 root     root          4096 Mar 31 08:03 current_now
-r--r--r--    1 root     root          4096 Apr  2 12:54 cycle_count
drwxr-xr-x    5 root     root             0 Mar 31 08:03 device
drwxr-xr-x    3 root     root             0 Mar 31 08:03 hwmon2
-r--r--r--    1 root     root          4096 Mar 31 08:03 manufacturer
-r--r--r--    1 root     root          4096 Mar 31 08:03 model_name
drwxr-xr-x    2 root     root             0 Apr  2 12:54 power
-r--r--r--    1 root     root          4096 Mar 31 08:03 present
-r--r--r--    1 root     root          4096 Mar 31 08:03 serial_number
-r--r--r--    1 root     root          4096 Mar 31 08:03 status
drwxr-xr-x    2 root     root             0 Mar 31 08:03 subsystem
-r--r--r--    1 root     root          4096 Mar 31 08:03 technology
-r--r--r--    1 root     root          4096 Mar 31 08:03 type
-rw-r--r--    1 root     root          4096 Mar 31 08:03 uevent
-r--r--r--    1 root     root          4096 Mar 31 08:03 voltage_min_design
-r--r--r--    1 root     root          4096 Mar 31 08:03 voltage_now

current_now , voltage_now and power might be good, but i believe without AC current is 0.
How do i check their value?

That’s the guide i’ve followed but without luck, the “Sensor” tab is disappearing

Just realized that we are discussing two collectors:

Let’s don’t mix them up and try to figure out what is missing/why doesn’t work (?) Linux Power Supply.

makes sense to me, Linux Power Supply is only showing battery capacity then

There are no energy_* files in the directory. That’s why you don’t see the corresponding charts in the dashboard.