How to fetch the information of cpu usage via command line?

Hi

i just wish to know, if we can fetch the details of service of cpu usage for specific host for some specific time period via command line in the form of data . is this feature available in check_mk 2.2?
can you please suggest how we can achieve that ?

I dont know if this is what you are looking for, but:

For a linux host you can use top command.

To make it do just one parse :

top -b -d1 -n1

Or, if you want to see which processes are using your cpu (sorted by cpu-usage):

ps -eo %cpu,command --sort -%cpu
  • Glowsome
1 Like

you can get any view in checkmk as JSON and you can run curl to get that data. If you include a filter for a time period then yes its possible

you can also use lq (live status query)

hi Anders

Thanks for reply .
can you please provide more details , like how we can fetch timestamp based data for cpu usage with curl ? or lq .

You can use the Checkmk REST API to fetch raw metric data.
Consult the built-in documentation or the interactive GUI.
You find both in the lower left of your Checkmk interface in the Help menu.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.