> Now, I want prometheus to read only from job 2,3 and drop 1, do we have a 
provision to do that in file_sd_config?

Yes. Use target relabelling using "drop" or "keep" rules. You will have to 
match on some label(s) which distinguish job 1 from jobs 2 and 3.

Note 1: the text you provided is not valid JSON. Even if it were, it is not 
structured correctly for consumption by Prometheus. The top level entity 
must be a list of objects [...], and each object needs to have 
{"targets":[...], "labels":{...}}

Note 2: it's a really bad idea to override the "job" label. This is set by 
prometheus, and should identify the scrape job which collected the data.

On Tuesday 23 January 2024 at 08:01:20 UTC akshay sharma wrote:

> Hi, 
>
> I have a file_sd_config defined in Prometheus configuration file 
> (/tmp/test.json)
> in that, I have 3-4 scrape targets as defined below:
>
> cat /tmp/test.json
>
> {        "targets": [            "x:123"        ],        "labels": {         
>    "job": "1",            "element_name": "x",            "__metrics_path__": 
> "/x/test"        }
>
>         "targets": [
>
>             "y:123"        ],        "labels": {            "job": "2",       
>      "element_name": "y",            "__metrics_path__": "/y/test"        }
>
>         "targets": [
>
>             "3:123"        ],        "labels": {            "job": "3",       
>      "element_name": "z",            "__metrics_path__": "/z/test"        }
>
>     }
>
> Now, I want prometheus to read only from job 2,3 and drop 1, do we have a 
> provision to do that in file_sd_config?
>
> How can I achieve this? please let me know.
>
>
> thanks,
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4ad74fdc-4a82-4a67-a915-4cfb20822ad1n%40googlegroups.com.

Reply via email to