Thruk icon indicating copy to clipboard operation
Thruk copied to clipboard

Configuration variable for Host Name in different pages

Open Muletia opened this issue 3 years ago • 2 comments

I've looked through the options but could not see anything that would do this for us. I've also had a search through all issues and could not see anything like being reported.

We have recently started migrated from Checmk Raw to to Checkmk Enterprise and have noticed that if we have an alias configured this value is populated into the display_name livestatus field which Thruk uses for displaying in the various pages.

It would be nice if a configuration option was added to allow us to override which column we use in the various pages, eg:

  • Host Status: use the "name" field when displaying web pages instead of "display_name"
  • Service Status: use the "host_name" field when displaying web pages instead of "host_display_name"

I looked through the template files and found a few places where I could update entries to make it display the correct value but it will take a bit of work to figure it all out and to create a patch we can apply when upgrading. Having a config option would be infinitely more useful.

A work around would be to delete all our alias fields as that forces Livestatus to default to the hostname if no alias is defined, however we use this field to supplement our alerting with the devices role so we can send this through as part of our alerting.

We use Thruk because we've found there are some places where it's much better and more useable than the native Checkmk interface and would like to continue with it as the primary interface our support teams use.

Muletia avatar Apr 09 '21 03:04 Muletia

As you already noticed, it will be quite some work to do this. A configuration option is quickly added, but you need to change all templates which use the host/servicename in some way and thats more or less almost all of them. I would add a wrapper function in the lib/Thruk/Utils/Filter.pm which could then decide which name to use. For example add a function hostname() which returns the configured host name. Then do the same for service descriptions. There is a similar thing for peer names already: https://github.com/sni/Thruk/blob/master/lib/Thruk/Utils/Filter.pm#L1257

sni avatar Apr 09 '21 13:04 sni

Good idea. I'll take a look at the code you've pointed to and see if I can follow it. Cheers for the feedback.

Muletia avatar Apr 10 '21 00:04 Muletia