Skip to content

Commit

Permalink
Optionally remove manager-agent port from target file
Browse files Browse the repository at this point in the history
For backwords compatibilities reasons, if no manager-agent file is given
and the targets are taken from scylla_server file, ports will be
removed.

(cherry picked from commit 5f75cba)
  • Loading branch information
amnonh committed Oct 22, 2023
1 parent e43ad55 commit 6e9f371
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions prometheus-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ for arg; do
(--no-cdc)
NO_CDC="1"
;;
(--no-manager-agent-file)
NO_MANAGER_AGENT_FILE="1"
;;
(*) set -- "$@" "$arg"
;;
esac
Expand Down Expand Up @@ -75,6 +78,9 @@ elif [ "$NO_CAS" = "1" ]; then
elif [ "$NO_CDC" = "1" ]; then
sed -i "s/ *# FILTER_METRICS.*/ - source_labels: [__name__]\\n regex: '(.*_cdc_.*)'\\n action: drop/g" $PWD/prometheus/build/prometheus.yml
fi
if [ "$NO_MANAGER_AGENT_FILE" = "1" ]; then
sed -i "s/ *# MANAGER_AGENT_PORT_MAPPING.*/ - source_labels: [__address__]\\n regex: '(.*):\\\\d+'\\n target_label: __address__\\n replacement: \'\$\{1\}\'\\n/g" $PWD/prometheus/build/prometheus.yml
fi

for val in "${PROMETHEUS_TARGETS[@]}"; do
if [[ ! -f $val ]]; then
Expand Down
1 change: 1 addition & 0 deletions prometheus/prometheus.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ scrape_configs:
- files:
- /etc/scylla.d/prometheus/targets/scylla_manager_agents.yml
relabel_configs:
# MANAGER_AGENT_PORT_MAPPING
- source_labels: [__address__]
regex: '([^:]+)'
target_label: __address__
Expand Down
1 change: 1 addition & 0 deletions start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ if [ -z "$TARGET_DIRECTORY" ] && [ -z "$CONSUL_ADDRESS" ]; then
fi

if [ -z $SCYLLA_MANGER_AGENT_TARGET_FILE ]; then
PROMETHEUS_TARGETS="$PROMETHEUS_TARGETS --no-manager-agent-file"
SCYLLA_MANGER_AGENT_TARGET_FILE=$SCYLLA_TARGET_FILE
fi
if [ ! -f $NODE_TARGET_FILE ]; then
Expand Down

0 comments on commit 6e9f371

Please sign in to comment.