-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add power consumption metric to power supply monitoring module #17329
Conversation
b41fd08
to
7148ec4
Compare
I rebased my branch and updated the section (and priority) for the new metric, but it seems like it has stopped displaying completely now. |
7148ec4
to
dedc4ec
Compare
dedc4ec
to
c305832
Compare
@eyusupov I see that the priority is NETDATA_CHART_PRIO_POWER_SUPPLY_CAPACITY for charge, energy, and voltage. You can add |
534d994
to
a121e69
Compare
} | ||
} | ||
|
||
if (likely(prop->fd != -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest instead to test prop->fd != -1
again, you write it as an else
for previous block.
|
||
if (likely(prop->fd != -1)) | ||
{ | ||
ssize_t r = read(prop->fd, buffer, 30); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you create a macro (define
) above, please, do not forget to change here.
I prepared another PR with the same change, where I have unified the code for single and multi-dimensional properties #17346. Let me know if you think it's better or if I should finish that one instead. |
0860237
to
2d1b0b9
Compare
Hello, I am sorry for the delay, I got some days off. |
@ilyam8 I cannot see on my host the charts, can you see on yours? |
2d1b0b9
to
fd73668
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have the file power_now
on my environments, but the plugin is running as expected with these changes. I am going to approve waiting for other reviewers that have conditions to see the chart.
Thank you @eyusupov !
Summary
Add a new metric for battery discharge rate (
![image](https://private-user-images.githubusercontent.com/173326/320084799-37817015-6aab-4439-933e-0e1dba1a181f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgyNjE3MzksIm5iZiI6MTcxODI2MTQzOSwicGF0aCI6Ii8xNzMzMjYvMzIwMDg0Nzk5LTM3ODE3MDE1LTZhYWItNDQzOS05MzNlLTBlMWRiYTFhMTgxZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYxM1QwNjUwMzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05ZGVmY2VjZDkzMDcxZmYyNjFlNGUxNjU0MzI2NGQyNjgzN2IyNjdmMjQ3MDg1ZDE0NTRlMDZlOGEyYTZjMGYzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.4v1VAIfQtO8vXRxuhPZDC6iIoYVqF57kDVGdy0YtBQ8)
/sys/class/battery/<BAT>/power_now
).Test Plan
Additional Information
There is a new metric that allows to track the machine (usually laptop) power consumption.
While it is possible to gauge this using existing power capacity metric, it is not very granular does not show the rate of discharge very clearly.
With this change it should possible to correlate other metrics with power consumption.
There seem to be some issues with the sections (BAT0 has appeared as the section heading and
capacity
metric is displayed undercharge
section). I think the reason might be in the dashboard code which source is not included in the repo.