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

Add templating to metricshub.yaml to generate the list of resources to monitor dynamically #438

Open
bertysentry opened this issue Oct 6, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@bertysentry
Copy link
Member

Idea

Use Velocity for templating in metricshub.yaml.

Use Case

Generate the list of resources to monitor by MetricsHub dynamically from other sources (files, HTTP, scripts, etc.). Integrate with CMDB, etc.

How it would work

Configuration file would be metricshub.yaml.vm in this scenario. User would write YAML mixed with Velocity templating code. In Velocity, the user can use directives (#if, #foreach, etc.), variables and objects ($var), call object methods ($obj.myMethod(arg)). See the Velocity User Guide, Velocity Developer Guide,

User can also call tools exposed by Velocity, as well as our own tools (see how we created the Sentry Maven Skin Tools.

Example

resources:

#set($hostList = $json.fetch("https://my-cmdb/hostList")
#foreach ($host in $hostList.iterator() )
  host:
    attributes:
      host.name: $host.hostname
    protocols:
#if ($host.snmp == "true")
      snmp:
        community: public
#else
      http:
        username: op
        password: op
#end
#end

Ideally, we would create our own $http Velocity tool, with more capabilities than the simple fetch() method of $json.

@NassimBtk NassimBtk added enhancement New feature or request documentation Improvements or additions to documentation labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants