Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname in title (RAW edition) #60

Open
jplitza opened this issue May 24, 2022 · 11 comments
Open

Hostname in title (RAW edition) #60

jplitza opened this issue May 24, 2022 · 11 comments

Comments

@jplitza
Copy link

jplitza commented May 24, 2022

When using the plugin with the RAW edition, before plugin version 2.0 I could use multiple queries on different hosts in a single graph. Now, all data frames have the same name (e.g. "Input bandwidth" and "Output bandwidth", each repeated once for every host).

I hacked around this using the following:

--- a/src/DataSource.ts
+++ b/src/DataSource.ts
@@ -24,7 +24,7 @@ function buildMetricDataFrame(response: any, query: MyQuery) {
   const frame = new MutableDataFrame({
     refId: query.refId,
     fields: [{ name: 'Time', type: FieldType.time }].concat(
-      curves.map((x: any) => ({ name: x.title, type: FieldType.number }))
+      curves.map((x: any) => ({ name: get(query, "context.host.host") + "," + x.title, type: FieldType.number }))
     ),
   });
   zip(...curves.map((x: any) => x.rrddata)).forEach((d: any, i: number) =>

However, this most definitely isn't a proper solution, because it will probably break Enterprise Editions.

@BenediktSeidl
Copy link
Contributor

Thanks for the report, this is indeed a problem.

2022-05-25_16-29

We discussed this internally and came up with a possible solution: provide an optional text input field to configure the legend of the graph.
Perhaps it would also be useful to be able to choose from different variables as $hostname, $service, $metric or similar.

We are currently not sure when we will be able to implement this feature, please be patient with us.

@kobid84
Copy link

kobid84 commented Jul 29, 2022

hey @jplitza
i replaced the line to
+ curves.map((x: any) => ({ name: get(query, "context.host.host") + "," + x.title, type: FieldType.number }))

but still looks the same, without hostname

@kobid84
Copy link

kobid84 commented Aug 10, 2022

@BenediktSeidl any news with this issue ?
we cannot upgrade checkmk version because of this..

@BenediktSeidl
Copy link
Contributor

No news yet. I fear it will still take some time to implement this.
But I just tried the diff from jplitza, and it works just fine. It's not enough to simply change the line, but you have to rebuild the plugin after changing the line. This can be done by yarn install, then yarn build.

@iandk
Copy link

iandk commented Sep 19, 2022

I'm experiencing the same issue, I haven't tested the diff yet but I'd definitely appreciate an official solution.
But other than that the plugin is really great, thank you!

@michaelortnersanube
Copy link

I hope this will be implemented. This would be great, maybe "Hostname - Service" would be great. Something like this:

image

@jplitza
Copy link
Author

jplitza commented Dec 16, 2022

This command should patch the compiled version directly (now with the schema $HOST - $SERVICE - $TEMPLATE)

sed -i 's#\(refId:\(.\)\.refId,.*{name:\)\(.\.title\)#\1(\2.context.host||{}).host+" - "+(n.context.service||{}).service+" - "+\3#' dist/module.js

EDIT: Updated for version 3.1.0 (which has two backends and hence requires two patches):

sed -i -e 's#getGraphQuery(.,\(.\)).*=>({name:#\0\1.requestSpec.host_name+" - "+\1.requestSpec.service+" - "+#' -e 's#getSingleGraph(.,\(.\)).*\.push({name:#\0\1.requestSpec.host_name+" - "+\1.requestSpec.service+" - "+#' module.js

@LMSBrubaker
Copy link

Hello, we are a customer of the checkmk enterprise version... when will the feature be implemented... without that its nearly impossible to build custom network graphs as they have all the same name :/

@godspeed-you
Copy link
Contributor

Hi @LMSBrubaker,

user of the enterprise version should not have this problem as you can use the regular expression for filtering hosts or sevices.
This problem only occurs for users forced to use multiple queries in a Panel containing the same service names.

Independent of this side note: We just finished two big projects for the plugin. The following moves will be some clean up to our code as we want the plugin to be maintainable. This includes some bug fixing and fixing of other issues. As we have already an approach on how to handle the metric naming, we can do that either during this maintenance phase or shortly after.
We are aware of this issue and we will work on a solution as fast as possible. Currently, it only depends on our prioritization regarding other issues/bugs, we want to fix.

@kobid84
Copy link

kobid84 commented Oct 2, 2023

hi @BenediktSeidl
any updates with this issue?
I'm afraid to upgrade checkmk to latest version.

@BenediktSeidl
Copy link
Contributor

@lpetrora did the first step to overcome this issue: 5b35a6d
this should be usable with the current version 3.2.2b1. feedback is welcome.
this change allows you to work around the issue mentioned in this ticket.
the next step is to adapt checkmk to provide meta-data for the graph, so you can not only use data specified in the filter. for example It's currently not possible to use a host variable in the label if you fetch your hosts with a host regex filter. but this has to be changed in checkmk which takes some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants