Skip to content

Commit ede9d3a

Browse files
committed
Make blackbox-exporter launcher a clickable link
This PR makes the output of the `blackbox-exporter` launcher script output a clickable link in the style of the `cluster-console` script. Signed-off-by: Chris Collins <[email protected]>
1 parent 6d35b5f commit ede9d3a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

utils/bin/blackbox-exporter

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
#!/usr/bin/env bash
2-
echo "Starting blackbox exporter on port $OCM_BACKPLANE_CONSOLE_PORT helping to identify the source of api-ErrorBudgetBurn..." | sed "s/${OCM_BACKPLANE_CONSOLE_PORT}/$(cat /tmp/portmap)/"
2+
3+
if [ "${OCMC_ENGINE}" != "podman" ]
4+
then
5+
echo "Blackbox exporter inside OCM Container is currently only supported with Podman"
6+
exit 1
7+
fi
8+
9+
if [ "${OCMC_DISABLE_CONSOLE_PORT}" == "true " ]
10+
then
11+
echo "Cluster console port (used by blackbox-exporter) disabled: OCMC_DISABLE_CONSOLE_PORT == true"
12+
exit 1
13+
fi
14+
15+
# if the file doesn't exist, or is empty, exit
16+
if [ ! -f /tmp/portmap ] || [ ! -s /tmp/portmap ]
17+
then
18+
echo "External port not mapped for cluster console (used by blackbox-exporter), exiting..."
19+
exit 1
20+
fi
21+
22+
323
oc port-forward \
424
--address 0.0.0.0 \
525
-n openshift-route-monitor-operator \
626
deployment/blackbox-exporter \
7-
$OCM_BACKPLANE_CONSOLE_PORT:9115 | sed "s/${OCM_BACKPLANE_CONSOLE_PORT}/$(cat /tmp/portmap)/"
27+
$OCM_BACKPLANE_CONSOLE_PORT:9115 \
28+
| sed "s|^Forwarding.*|== Blackbox exporter is available at http://0.0.0.0:$(cat /tmp/portmap) ==|"
829

0 commit comments

Comments
 (0)