# How to capture CPU context switch from metricbeat

**URL:** <https://discuss.elastic.co/t/how-to-capture-cpu-context-switch-from-metricbeat/135083>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [June 8, 2018, 5:27am UTC](https://discuss.elastic.co/t/how-to-capture-cpu-context-switch-from-metricbeat/135083 "2018-06-08T05:27:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SNJY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/snjy/32/42758_2.png) [@SNJY](https://discuss.elastic.co/u/SNJY)\
**Post date:** [June 8, 2018, 5:27am UTC](https://discuss.elastic.co/t/how-to-capture-cpu-context-switch-from-metricbeat/135083/1 "2018-06-08T05:27:32Z")

</div>

Hi,

Could someone please let me know if there is way to capture CPU context switch from metricbeat-6.2.3.  
Unable to find relevant field In official list of metricbeat fields in below URL -  
[https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-system.html](https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-system.html)

Thanks,  
Sanjay

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [June 8, 2018, 1:16pm UTC](https://discuss.elastic.co/t/how-to-capture-cpu-context-switch-from-metricbeat/135083/2 "2018-06-08T13:16:04Z")

</div>

The number of voluntary and involuntary context switches is not a metric that is exposed by Metricbeat. Feel free to open an enhancement request to have this information added to the Metricbeat system process metricset. I know we have some code that could provide these metrics.

- Linux - [https://github.com/andrewkroh/procfs/blob/cf8dbf0663923cf43115d08a9e4d990d587ab16f/proc\_status.go#L253-L256](https://github.com/andrewkroh/procfs/blob/cf8dbf0663923cf43115d08a9e4d990d587ab16f/proc_status.go#L253-L256)
- Darwin (macos) - [https://github.com/elastic/go-sysinfo/blob/63c073091b623652c928a706bd9d9990d4ef56ac/providers/darwin/ztypes\_darwin\_amd64.go#L75](https://github.com/elastic/go-sysinfo/blob/63c073091b623652c928a706bd9d9990d4ef56ac/providers/darwin/ztypes_darwin_amd64.go#L75)

---

<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:** [July 6, 2018, 1:16pm UTC](https://discuss.elastic.co/t/how-to-capture-cpu-context-switch-from-metricbeat/135083/3 "2018-07-06T13:16:10Z")

</div>

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