Thanks Brian,when I sanitized my example I should have put in a fake value rather than ip:port, so 1.1.1.1:1234 just to clarify that part.
The Target and label part we have in place now and is working well, I have been reading over some of the relabeling and that is the part I am struggling with. I found some documentation on __param_ but most do not go into full examples and the original job definition I am not the original creator.
The end product I want to generate should look like:
original:
- job_name: 'test_job'metrics_path: /exportscrape_interval: 5mscrape_timeout: 15sparams:command: [script_X]
argument: ['10.20.30.40']
static_configs:- targets: ['127.0.0.1:5666']labels:field1: 'text'field2: 'text'field3: 'text'
relabel_configs:- source_labels: [__address__]target_label: __param_target- source_labels: [__param_target]target_label: instance- target_label: __address__
- job_name: 'test_job'metrics_path: /exportscrape_interval: 5mscrape_timeout: 15sparams:
command: 'script_X'argument: '10.20.30.40'
relabel_configs:- source_labels: [command]target_label: __param_command
- source_labels: [ipaddress]
target_label: __param_argument
- source_labels: [__address__]target_label: __param_target- source_labels: [__param_target]target_label: instance- target_label: __address__
replacement: 1.1.1.1:1234
That looks fine to me, except it should be "source_labels: [argument]" rather than "source_labels: [ipaddress]".
That example can't be right. What you have shown:
- target_label: __address__replacement: ip:port
would put the literal text "ip:port" in the __address__ label, so it can't possibly work.However, switching from static_configs to file_sd_configs isn't really related to this. The capabilities of file_sd_configs and static_configs are the same. If you want different labels per host, you can do this with static_configs:
Or you can move this into file_sd_configs. The format of my_file.yml is identical except indented to the left:
--There are more complex options such as making a structured value for the __address__, matching it with a regexp, and pulling out the values you require into specific labels. Examples of these sorts of relabelling configs have been posted to the list before.
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/sGppTk4JSZU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/60293c82-63f1-49d4-bb7e-012740d52f28o%40googlegroups.com.