-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Overrides to enable (opt-out) Prometheus Java Agent in Java Bina…
…ry image
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ss.container.prometheus-override/artifacts/opt/jboss/container/prometheus/prometheus-opts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
# ============================================================================== | ||
# Configure JVM options for Prometheus Agent | ||
# | ||
# Usage: JAVA_OPTS="$JAVA_OPTS $(source ${JBOSS_CONTAINER_PROMETHEUS_MODULE}/prometheus-opts && get_prometheus_opts)" | ||
# | ||
# Env Vars respected: | ||
# | ||
# AB_PROMETHEUS_OFF: Disables the use of Prometheus Java Agent. | ||
# | ||
# AB_PROMETHEUS_PORT: Port to use for the Prometheus JMX Exporter. | ||
# Defaults to 9779. | ||
# | ||
# AB_PROMETHEUS_JMX_EXPORTER_CONFIG: Path to configuration to use for the | ||
# Prometheus JMX Exporter. Defaults to: | ||
# /opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml | ||
# | ||
|
||
source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" | ||
|
||
# echo's a complete -javaagent option based on the above variables. | ||
function get_prometheus_opts() { | ||
if ! echo "${AB_PROMETHEUS_OFF:-false}" | grep -q -e '^\(true\|y\|yes\|1\)$'; then | ||
echo "-javaagent:/usr/share/java/prometheus-jmx-exporter/jmx_prometheus_javaagent.jar=${AB_PROMETHEUS_PORT:-9779}:${AB_PROMETHEUS_JMX_EXPORTER_CONFIG:-/opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml}" | ||
fi | ||
echo "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
# Configure module | ||
set -e | ||
|
||
SCRIPT_DIR=$(dirname $0) | ||
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts | ||
|
||
chown -R jboss:root ${ARTIFACTS_DIR} | ||
chmod 755 ${ARTIFACTS_DIR}/opt/jboss/container/prometheus/prometheus-opts | ||
|
||
pushd ${ARTIFACTS_DIR} | ||
cp -pr * / | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
schema_version: 1 | ||
name: jboss.container.prometheus-override | ||
version: 1.0.0 | ||
description: ^ | ||
Overrides prometheus options script defined in jboss module. | ||
https://github.com/jboss-openshift/cct_module/tree/8411125f8e1b45d48c93c8bcd51d39541ce4a755/jboss/container/prometheus | ||
|
||
envs: | ||
- name: AB_PROMETHEUS_OFF | ||
description: Disable the use of prometheus agent | ||
example: true | ||
- name: AB_PROMETHEUS_PORT | ||
description: Port to use for the Prometheus JMX Exporter. | ||
example: 9799 | ||
|
||
execute: | ||
- script: configure.sh |