1

We are trying to display the following in Grafana using the Bosun/OpenTSDB data source:

a. Hosts in descending order in terms of Top-n Load
b. Top 10 memory consuming processes
c. Top CPU usage consuming processes

However, we could not find suitable metrics for it.

How can this information be displayed?

Secondly, if the metrics are not available in Bosun/OpenTSDB, then how should you create or define new metrics for them?

1 Answer 1

4

Overview

  1. Install the Bosun Grafana App plugin (Github Repo) and then setup the Bosun datasource.
  2. Add a Table Panel, set your datasource to your new Bosun datasource.
  3. Use limit(), sort(), and filter() functions as documented in Bosun's Expression Documentation

Table Example

For example, you could have an expression like the following for a table of top CPU:

$avg_cpu = avg(q("avg:$ds-avg:rate{counter,,1}:os.cpu{host=ny-*}{}", "$start", ""))
sort(limit(sort($avg_cpu, "desc"), 10), "desc")

note: sort is called twice so the table has a default sorting of by value

enter image description here

Graph Example

If you wanted to do a Graph panel instead of a table, you could use the filter():

$cpu = q("avg:$ds-avg:rate{counter,,1}:os.cpu{host=ny-*}{}", "$start", "")
$avg_cpu = avg(q("avg:$ds-avg:rate{counter,,1}:os.cpu{host=ny-*}{}", "$start", ""))
filter($cpu, limit(sort($avg_cpu, "desc"), 10))

enter image description here

5
  • Thanks Kyle for your reply, and sorry for the delayed response. We used the table expression and we are getting the desired o/p. Many thanks, however, I have 1 more question. Feb 9, 2018 at 5:42
  • We want to display the Top Process Names both by CPU and Memory. Is it possible to have using Bosun? Feb 9, 2018 at 5:44
  • @user3436389 If you are using our agent, scollector, then sort of. The way scollector works is you list out processes you want to monitor in scollector's config, and then you could do a similar query to the one above but on the os.proc.cpu metric for processes that are monitored. This is because monitoring all processes would be a lot of TSDB data for many setups. In practice this works well for us, host CPU alerts will show CPU for monitored processes on the host. It is either one of those listed (that we monitor), or not one of those which means go check on the host. Feb 9, 2018 at 14:04
  • @KyleBrandt what if what you need are IIS application pools. In that case, all processes are w3wp. How would you go about monitoring individual apppoools? Oct 12, 2020 at 21:18
  • @JuanM.Elosegui I am no longer on the project, but in the agent that is part of the bosun project, scollector, would look those up Worker processes during process monitoring add is the app pool name as a tag github.com/bosun-monitor/bosun/blob/master/cmd/scollector/… Oct 14, 2020 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.