Skip to content
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

(fix): add support for OpenEBS local PVs #2

Merged
merged 3 commits into from
May 13, 2020

Conversation

ksatchit
Copy link

@ksatchit ksatchit commented May 12, 2020

Changes

This PR consists of some small improvements to the existing monitor-pv bash script.

  • Uses findmnt --df as a way to determine PV mount points over using df. The local PV mounts do not show up in case of the latter. Findmnt has a broader reach, i.e., looks for filesystems in /etc/mtab, /etc/fstab & /proc/self/mountinfo by default. the --df flag (outputs in similar format as df) has been used to enable simpler command output parse.

  • The mount points for a given PV are filtered to the one in this path var/lib/kubelet/pods as this is the constant in a list of several mounts (including those depending on PV type and Cluster type. For example, /var/lib/kubelet/plugins/, /home/kubernetes/containerized_mounter/)

  • Fixes the command to obtain volume capacity in bytes

    • Determines whether the unit of PV contains "i"
    • cut doesn't accept multi-character delimiter, so tr is used instead
  • Adds a sample deployment spec that uses openebs namespace and serviceaccount.

Signed-off-by: ksatchit karthik.s@mayadata.io

Signed-off-by: ksatchit <karthik.s@mayadata.io>
@ksatchit ksatchit changed the title (fix): add support for hostpath volumes (fix): add support for OpenEBS local PVs May 12, 2020
Signed-off-by: ksatchit <karthik.s@mayadata.io>
@ksatchit ksatchit requested review from slalwani97 and kmova May 12, 2020 09:00
@@ -51,7 +55,7 @@ function collect_pv_utilization_metrics(){

for i in ${pv_list[@]}
do
pv_mount_list+=($(df -h | grep ${i} | awk '{print $NF}'))
pv_mount_list+=($(findmnt --df | grep ${i} | grep '/var/lib/kubelet/pods' | head -1 | awk '{print $NF}'))
Copy link
Contributor

@kmova kmova May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out loud, the path can be varying depending on the K8s distribution.

For example, in RKE, the path is /opt/rke/var/lib/kubelet/pods, this code will work even for RKE as the match is available. However, would it still be better to make this configurable via ENV? Maybe a future PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Kiran..agreed 👍

node-exporter.yaml Outdated Show resolved Hide resolved
Signed-off-by: ksatchit <karthik.s@mayadata.io>
@kmova kmova merged commit 77eed4f into openebs-archive:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants