Custom Plugin Graphing Exponents and Calculations

CMK version:
OS version: CentOS 7

Creating a plugin with some metric data and struggling to find the correct method to handle a few items.
Given metric data coming from an agent like this:

<<<broadworks_as:sep(0)>>>
{"ValidResponses":26787,"AuthChallenges":26961}
<<<>>>

In a metric configuration file located in $OMD_ROOT/local/share/check_mk/web/plugins/metrics/ I have defined metric_info:

metric_info["AuthChallenges"] = {
    "title": _l("Auth Challenges"),
    "unit": "count",
    "color": "34/a",
}
metric_info["ValidResponses"] = {
    "title": _l("Valid Responses"),
    "unit": "count",
    "color": "34/b",
}

AND graph_info

graph_info["bw_as_auth_challenges"] = {
    "title": _l("BW AS Auth Challenges"),
    "metrics": [
        ("AuthChallenges,60,*", "line", _l("Auth Challenges per Minute")),
        ("ValidResponses,60,*", "area", _l("Valid Responses per Minute")),
    ],
    "scalars": [
        ("ValidResponses,AuthChallenges,/,100,*", _l("Percentage")),
    ],
}

Trying to mimic a legacy cacti graph like this
image

In the Check_MK graph configuration I have a few questions I can’t figure out.

  1. I can’t seem to find the right placement to specify the scale of the number as the “K/1000” like I see as an option in the units.py file. Currently checkmk is showing it as exponential value.
  2. Is a scalars the appropriate way to add a metric not on the graph? e.g. Percentages
  3. Can a comment be added to the graph similar to the vertical “Challenges per Minute” on cacti image?
  4. General question, is defining a metric_info considered good practices since I did figured out I can specify color and title inline with the graph_info:metrics values.

Current CheckMK Graph (dark mode)

Sincerely,
Scotsie

Not a dev, so can’t help on the concrete topics. @mschlenker is typically a good resource for such knowledge or good input for him for our dev guide.

Regarding 4) We are implementing a Graphing API at the moment, which will therefore also set best practices. This will come in 2.3, which will be released early 2024.

Thanks for the tagging and looking forward to the new guide. I did see the 2.2 breadcrumb mentioning ‘coming soon’.

It’s a bit frustrating because some other graphs under the same service are scaling and abbreviating the numbers as expected with nothing different between the configuration.

I imagine it’s due to the value size on the graph rendering but don’t know what I can do about it.

Sincerely,
Scotsie

Upon further review, I realized that in mimicking the cacti graph, the value is being multiplied by 60 to provide a /minute display value.

But there is a “1/s” (per second) unit available. I have modified the metric_info from

to

metric_info["AuthChallenges"] = {
    "unit": "1/s",
}

And removed the `,60,*’ from the graph_info metric line items.
That seems to be displaying a more readable unit of measure. Now to see if my internal customer demands the ‘per minute’ displayed value.

Sincerely,
Scotsie