Cool. Thank you. Just started getting comfortable with Prometheus, so getting a lot of questions in mind. Thanks for the quick responses! :)
On Friday, March 6, 2020 at 1:29:05 AM UTC+5:30, Brian Candler wrote: > > On Thursday, 5 March 2020 19:23:51 UTC, Yagyansh S. Kumar wrote: >> >> Found my stupid mistake. It works now. Thanks! >> I have another query though. This maybe just a ridiculous question, but >> is there any way I can get the hostnames for the targets I configured as >> ICMP ping targets for Blackbox exporter? I know Blackbox exporter itself >> does not expose any hostname but still is there something that can be done? >> >> > Not a ridiculous question. You can do exactly the same with blackbox: you > need to set the __param_target rather than the __address__ (because you > will set __address__ to point to blackbox_exporter itself) > > > - job_name: blackbox > file_sd_configs: > - files: > - /etc/prometheus/targets.d/blackbox_targets.yml > metrics_path: /probe > relabel_configs: > - source_labels: [__address__] > regex: '([^/]+)' # name or address only > target_label: instance > > - source_labels: [__address__] > regex: '([^/]+)' # name or address only > target_label: __param_target > > - source_labels: [__address__] > regex: '(.+)/(.+)' # name/address > target_label: instance > replacement: '${1}' > > - source_labels: [__address__] > regex: '(.+)/(.+)' # name/address > target_label: __param_target > replacement: '${2}' > > - source_labels: [module] > target_label: __param_module > > - target_label: __address__ > replacement: 127.0.0.1:9115 # Blackbox exporter > > Then you create /etc/prometheus/targets.d/blackbox.yml like this: > > - labels: > module: icmp > targets: > - foo/1.2.3.4 > - bar/5.6.7.8 > > - labels: > module: http_2xx > targets: > - baz/9.10.11.12 > > -- 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 prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/6a9c6557-03a7-47b1-953e-3c985ba44b7f%40googlegroups.com.