# How to monitor kubernetes node filesystem from a container

**URL:** <https://discuss.elastic.co/t/how-to-monitor-kubernetes-node-filesystem-from-a-container/191919>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 23, 2019, 9:27pm UTC](https://discuss.elastic.co/t/how-to-monitor-kubernetes-node-filesystem-from-a-container/191919 "2019-07-23T21:27:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Labrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_labrot/32/2177_2.png) [@Nicolas\_Labrot](https://discuss.elastic.co/u/Nicolas_Labrot)\
**Post date:** [July 23, 2019, 9:27pm UTC](https://discuss.elastic.co/t/how-to-monitor-kubernetes-node-filesystem-from-a-container/191919/1 "2019-07-23T21:27:40Z")

</div>

Hi,

I'm trying to monitor the k8s node filesystem by using the metricbeat 7.2 deployment:

> <https://github.com/elastic/beats/blob/master/deploy/kubernetes/metricbeat-kubernetes.yaml>

I have adapted a little bit the drop event to drop the container filesystem:

```
  processors:
  - drop_event.when.regexp:
      system.filesystem.mount_point: '^/(hostfs/)?(sys|cgroup|proc|dev|etc|host|lib)($|/)'
  - drop_event.when.regexp:
      system.filesystem.mount_point: '^/$'

```

And I have mount the node root path to the container into "/hostfs" (following [https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html#monitoring-host](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html#monitoring-host)):

```
        - name: root
          mountPath: /hostfs
          readOnly: true 

```

I got the following result:

```
/hostfs	/dev/sda2	
/hostfs/boot	/dev/sda1
/hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m3444057142	/dev/sdh	
/hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m1430128950	/dev/sdg	
/hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m3444057142	/dev/sdh	
/hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m1524355945	/dev/sdi	
/hostfs/mnt/resource	/dev/sdb1

```

The issue is that the node filesystem has a mount on /var but it is not reported by metricbeat

A cat of mtab from the container (`kubectl -n kube-system exec -it metricbeat-24qrc -- cat /etc/mtab`) returns:

```
rootfs / rootfs rw 0 0
/dev/sdc1 / xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
/dev/sda2 /hostfs xfs ro,seclabel,relatime,attr2,inode64,noquota 0 0
/dev/sdc1 /hostfs/var xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
/dev/sdg /hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m1430128950 ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/sdh /hostfs/var/lib/kubelet/plugins/kubernetes.io/azure-disk/mounts/m3444057142 ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/sdh /hostfs/var/lib/kubelet/pods/fafc3b8b-a74b-11e9-8de9-000d3a291e50/volumes/kubernetes.io~azure-disk/pvc-azertyu-ssss-ssss-azert-azerty ext4 rw,seclabel,relatime,data=ordered 0 0

```

var is well returned. What could possibly be wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![Nicolas\_Labrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_labrot/32/2177_2.png) [@Nicolas\_Labrot](https://discuss.elastic.co/u/Nicolas_Labrot)\
**Post date:** [July 24, 2019, 5:42am UTC](https://discuss.elastic.co/t/how-to-monitor-kubernetes-node-filesystem-from-a-container/191919/2 "2019-07-24T05:42:44Z")

</div>

I guess it is because of those statements: [https://github.com/elastic/beats/blob/master/metricbeat/module/system/filesystem/helper.go#L93](https://github.com/elastic/beats/blob/master/metricbeat/module/system/filesystem/helper.go#L93)  
"/" of the container and "/hostfs/var" of the host are on the same device.

Would it be possible to add a configuration to let the user choose if he wants to filter?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2019, 5:42am UTC](https://discuss.elastic.co/t/how-to-monitor-kubernetes-node-filesystem-from-a-container/191919/3 "2019-08-21T05:42:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
