Add HOSTTYPEURL/HOSTDESCURL templates to link DESCR fields on info page#6
Open
SoundGoof wants to merge 1 commit into
Open
Add HOSTTYPEURL/HOSTDESCURL templates to link DESCR fields on info page#6SoundGoof wants to merge 1 commit into
SoundGoof wants to merge 1 commit into
Conversation
hosts.cfg's DESCR:Hosttype:Description tag is rendered as plain text on the info page. Add two independent xymonserver.cfg templates, following the COLUMNDOCURL/HOSTDOCURL convention, so either or both parts can be turned into links (e.g. a CMDB lookup for the description). Unset/empty keeps today's plain-text behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add HOSTTYPEURL/HOSTDESCURL templates to link DESCR fields on the info page
Problem
hosts.cfg supports a DESCR:Hosttype:Description tag (e.g. DESCR:linux:CIID1234), which is rendered on the host's info page as two plain-text rows — "Host type:" and "Description:" — with no way to make either value a clickable link (e.g. to a CMDB entry, wiki page, or inventory system).
Solution
Add two independent, optional xymonserver.cfg templates, following the existing COLUMNDOCURL/HOSTDOCURL convention (printf-style %s format string, empty/unset = no link):
example:
DESCR="linux:CIID1234"
DESCR="windows:CIID5678"
DESCR="switch:CIID2345"
HOSTTYPEURL — links the host-type part (e.g. linux)
HOSTDESCURL — links the description part (e.g. CIID1234)
Either, both, or neither can be set per installation. When unset (the default), output is byte-for-byte identical to today. Values are urlencode()d before substitution since DESCR text is free-form.
Changes
environ.c: register HOSTTYPEURL/HOSTDESCURL defaults (both empty).
svcstatus-info.c: wrap the host-type/description values in "a href" when the corresponding template is set.
xymonserver.cfg.DIST, xymonserver.cfg.5, hosts.cfg.5: document the new settings.
Testing
Clean build (lib-build common-build xymond-build web-build).
testsuite: 14/14 passed.
groff -man -z clean on both touched man pages.
Manually rendered svcstatus.cgi's info page against a scratch host with DESCR:linux:CIID1234:
Both templates set → both rows linked.
Only HOSTDESCURL set → type plain, description linked.
Neither set → identical to current plain-text output (no regression).
DESCR with no Description part (no colon) → renders correctly.