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: http://1.1.1.1:1234/export?command=script_X&argument=10.20.30.40&target=127.0.0.1:5666 original: - job_name: 'test_job' metrics_path: /export scrape_interval: 5m scrape_timeout: 15s params: 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__ replacement: 1.1.1.1:1234 So would the job with the relabel just look like this? New: - job_name: 'test_job' metrics_path: /export scrape_interval: 5m scrape_timeout: 15s params: static_configs: - targets: ['127.0.0.1:5666'] labels: field1: 'text' field2: 'text' field3: 'text' 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 Thanks in advance, Kevin On Fri, Sep 25, 2020 at 7:00 PM Brian Candler <[email protected]> wrote: > 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: > > static_configs: > - targets: ['127.0.0.1:5666'] > labels: > field1: 'text' > field2: 'text' > field3: 'text' > - targets: ['1.2.3.4:5678'] > labels: > field1: 'text2' > field2: 'text2' > field3: 'text2' > > Or you can move this into file_sd_configs. The format of my_file.yml is > identical except indented to the left: > > - targets: ['127.0.0.1:5666'] > labels: > field1: 'text' > field2: 'text' > field3: 'text' > - targets: ['1.2.3.4:5678'] > labels: > field1: 'text2' > field2: 'text2' > field3: 'text2' > > > 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 > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/60293c82-63f1-49d4-bb7e-012740d52f28o%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/60293c82-63f1-49d4-bb7e-012740d52f28o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAB%2BSi9-diZNAkZjdSeMVVnSW%3DRZ2sP%3DtaJqD%3DqxxwbVtdV%3DnAw%40mail.gmail.com.

