promgen icon indicating copy to clipboard operation
promgen copied to clipboard

Add addition params feature into import prometheus configuration

Open tuan-phan opened this issue 5 years ago • 6 comments

Hi Team, Currently, promgen configuration only support some params. I have some configuration need migrate to Promgen like:


scrape_configs:
   - job_name: 'test_application'
     metrics_path: 'prometheus'
     params:
       token: ['xxxxxx']
     file_sd_configs:
     - files:
       - file-sd/jennifer_node*.json


jennifer_node*.json have this content

  {
    "targets": [
      "http://atrkadas-stream1.travel-dev.dev.jp.local/healthcheck.html",
      "http://atrsrm-api.travel-dev.dev.jp.local/healthcheck.html"
    ],
    "labels": {
      "type": "internal",
      "platform": "cloud"
    }

Can we add some params like token, type, platform .... ? It should be useful. Thank you,

tuan-phan avatar Sep 10 '19 05:09 tuan-phan

It's not possible now, but I have thought about supporting custom labels and params for scrape targets. Promgen would likely still pass its default labels (job/service/project) though you could handle that with relabel config

In your idea, how would you expect to handle the UI side of things? Would the same token/custom label apply to all targets in a project, or would it apply only to a specific target

kfdm avatar Sep 10 '19 05:09 kfdm

Hi @kfdm , Some case we need apply for whole project, some case we apply only to a specific target... Example: The token will apply for all targets. But some labels like: app_team_name, host_group will be use for specific target

  {
    "targets": [
      "dev-mon-test2.dev.local:7900"
    ],
    "labels": {
      "app_team_name": "booking",
      "host_group": "dev-mon-test2",
      "platform": "private"
    }
  },
  {
    "targets": [
      "dev-mon-test1.dev.local:7900"
    ],
    "labels": {
      "app_team_name": "apm",
      "host_group": "dev-mon-test1",
      "platform": "cloud1"
    }
  }

tuan-phan avatar Sep 10 '19 06:09 tuan-phan

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Nov 08 '19 00:11 github-actions[bot]

Hi! Is it possible to do something like this now? targets.json

[
    {
      "targets": [
        "x.x.x.x"
      ],
      "labels": {
        "job": "vmware"
      },
      "params": {
          "section": ["origin"]
      }
    }
]  

@kfdm

dykow avatar Aug 10 '20 15:08 dykow

Currently there is no support for something like that 🙇

kfdm avatar Aug 11 '20 00:08 kfdm

Currently there is no support for something like that bow

Oooh, ok. Thanks for the reply :)

dykow avatar Aug 11 '20 08:08 dykow