Skip to content

Commit

Permalink
Merge pull request #2090 from amnonh/remove_manager_agent_port
Browse files Browse the repository at this point in the history
Optionally remove manager-agent port from target file
  • Loading branch information
amnonh authored Oct 22, 2023
2 parents bfea7dc + 5f75cba commit 80eeda0
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 @@ -432,6 +432,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 80eeda0

Please sign in to comment.