Skip to content

Commit dcbc13f

Browse files
authored
Merge pull request #298 from jmtd/OPENJDK-777-take-2
[OPENJDK-777] Adjust Prometheus modules for 8.6 RPM scheme
2 parents 2b5271d + 92094e2 commit dcbc13f

File tree

18 files changed

+197
-3
lines changed

18 files changed

+197
-3
lines changed

modules/prometheus/8.6.11/module.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
schema_version: 1
2+
3+
name: jboss.container.prometheus
4+
version: '8.6.11'
5+
description: ^
6+
Provides support for configuring Prometheus. Basic usage is
7+
JAVA_OPTS="$JAVA_OPTS $(source $JBOSS_CONTAINER_PROMETHEUS_MODULE/prometheus-opts; get_prometheus_opts)"
8+
9+
envs:
10+
- name: JBOSS_CONTAINER_PROMETHEUS_MODULE
11+
value: /opt/jboss/container/prometheus
12+
- name: AB_PROMETHEUS_ENABLE
13+
description: Enable the use of the Prometheus agent
14+
example: true
15+
- name: AB_PROMETHEUS_JMX_EXPORTER_PORT
16+
description: Port to use for the Prometheus JMX Exporter.
17+
example: 9799
18+
- name: AB_PROMETHEUS_JMX_EXPORTER_CONFIG
19+
value: /opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml
20+
description: Path to configuration to use for the Prometheus JMX Exporter
21+
22+
execute:
23+
- script: configure.sh
24+
- script: backwards_compatibility.sh
25+
26+
packages:
27+
install:
28+
- prometheus-jmx-exporter-openjdk11
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Copyright 2018 Red Hat, Inc. and/or its affiliates
3+
# and other contributors as indicated by the @author tags.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
---
18+
lowercaseOutputName: true
19+
lowercaseOutputLabelNames: true
20+
blacklistObjectNames:
21+
# handled by agent's default exporter
22+
- "java.lang:*"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
# ==============================================================================
3+
# Configure JVM options for Prometheus Agent
4+
#
5+
# Usage: JAVA_OPTS="$JAVA_OPTS $(source ${JBOSS_CONTAINER_PROMETHEUS_MODULE}/prometheus-opts && get_prometheus_opts)"
6+
#
7+
# Env Vars respected:
8+
#
9+
# AB_PROMETHEUS_ENABLE: Enable the use of the Prometheus agent.
10+
#
11+
# AB_PROMETHEUS_JMX_EXPORTER_PORT: Port to use for the Prometheus JMX Exporter.
12+
# Defaults to 9799.
13+
#
14+
# AB_PROMETHEUS_JMX_EXPORTER_CONFIG: Path to configuration to use for the
15+
# Prometheus JMX Exporter. Defaults to:
16+
# /opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml
17+
#
18+
19+
# echo's a complete -javaagent option based on the above variables.
20+
function get_prometheus_opts() {
21+
if [ "${AB_PROMETHEUS_ENABLE^^}" = "TRUE" ]; then
22+
echo "-javaagent:/usr/share/java/prometheus-jmx-exporter/jmx_prometheus_javaagent.jar=${AB_PROMETHEUS_JMX_EXPORTER_PORT:-9799}:${AB_PROMETHEUS_JMX_EXPORTER_CONFIG:-/opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml}"
23+
fi
24+
echo ""
25+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ueo pipefail
3+
4+
# Legacy location
5+
ln -s /usr/share/java/prometheus-jmx-exporter/jmx_prometheus_javaagent.jar \
6+
$JBOSS_CONTAINER_PROMETHEUS_MODULE/jmx_prometheus_javaagent.jar
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# Configure module
3+
set -e
4+
5+
SCRIPT_DIR=$(dirname $0)
6+
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts
7+
8+
chown -R jboss:root ${ARTIFACTS_DIR}
9+
chmod 755 ${ARTIFACTS_DIR}/opt/jboss/container/prometheus/prometheus-opts
10+
chmod 775 ${ARTIFACTS_DIR}/opt/jboss/container/prometheus/etc
11+
chmod 775 ${ARTIFACTS_DIR}/opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml
12+
13+
pushd ${ARTIFACTS_DIR}
14+
cp -pr * /
15+
popd

modules/prometheus/8.6.17/module.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
schema_version: 1
2+
3+
name: jboss.container.prometheus
4+
version: '8.6.17'
5+
description: ^
6+
Provides support for configuring Prometheus. Basic usage is
7+
JAVA_OPTS="$JAVA_OPTS $(source $JBOSS_CONTAINER_PROMETHEUS_MODULE/prometheus-opts; get_prometheus_opts)"
8+
9+
envs:
10+
- name: JBOSS_CONTAINER_PROMETHEUS_MODULE
11+
value: /opt/jboss/container/prometheus
12+
- name: AB_PROMETHEUS_ENABLE
13+
description: Enable the use of the Prometheus agent
14+
example: true
15+
- name: AB_PROMETHEUS_JMX_EXPORTER_PORT
16+
description: Port to use for the Prometheus JMX Exporter.
17+
example: 9799
18+
- name: AB_PROMETHEUS_JMX_EXPORTER_CONFIG
19+
value: /opt/jboss/container/prometheus/etc/jmx-exporter-config.yaml
20+
description: Path to configuration to use for the Prometheus JMX Exporter
21+
22+
execute:
23+
- script: configure.sh
24+
- script: backwards_compatibility.sh
25+
26+
packages:
27+
install:
28+
- prometheus-jmx-exporter-openjdk17

0 commit comments

Comments
 (0)