Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
prometheus-*.tar.gz
exporters/*.tar.gz
exporters/queries.yaml
alertmanager/*.tar.gz
build/
2 changes: 1 addition & 1 deletion Dockerfile.builder8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- dockerfile -*-
FROM centos:8
FROM rockylinux:8

RUN yum install -y make git sudo epel-release yum-utils rpm-build && \
yum install -y python2 python2-pip python2-rpm-macros python2-setuptools && \
Expand Down
53 changes: 27 additions & 26 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,69 @@

build_prometheus() {
# Prometheus version
VERSION="2.27.1"
sudo wget https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz -O /workspace/prometheus-${VERSION}.tar.gz -c
VERSION="2.40.2"
wget https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz -O /workspace/prometheus-${VERSION}.tar.gz -c

sudo rpmbuild \
rpmbuild \
--clean \
--define "pkgversion ${VERSION}" \
--define "_topdir ${PWD}/tmp/rpm" \
--define "_sourcedir ${PWD}/workspace" \
--define "_topdir /tmp/rpm" \
--define "_sourcedir /workspace" \
-bb /workspace/prometheus.spec

sudo cp ${PWD}/tmp/rpm/RPMS/*/*.rpm ${PWD}/workspace/build/
cp /tmp/rpm/x86_64/*.rpm /workspace/build/
}

build_alertmanager() {
# alertmanager version
VERSION="0.22.2"
sudo wget https://github.com/prometheus/alertmanager/releases/download/v${VERSION}/alertmanager-${VERSION}.linux-amd64.tar.gz -O /workspace/alertmanager/alertmanager-${VERSION}.tar.gz -c
VERSION="0.24.0"
wget https://github.com/prometheus/alertmanager/releases/download/v${VERSION}/alertmanager-${VERSION}.linux-amd64.tar.gz -O /workspace/alertmanager/alertmanager-${VERSION}.tar.gz -c

sudo rpmbuild \
rpmbuild \
--clean \
--define "pkgversion ${VERSION}" \
--define "_topdir ${PWD}/tmp/rpm" \
--define "_sourcedir ${PWD}/workspace/alertmanager" \
--define "_topdir /tmp/rpm" \
--define "_sourcedir /workspace/alertmanager" \
-bb /workspace/alertmanager/prometheus-alertmanager.spec

sudo cp ${PWD}/tmp/rpm/RPMS/*/*.rpm ${PWD}/workspace/build/
cp /tmp/rpm/x86_64/*.rpm /workspace/build/
}

build_postgres_exporter() {
# postgres_exporter version
VERSION="0.10.0"
sudo wget https://github.com/prometheus-community/postgres_exporter/releases/download/v${VERSION}/postgres_exporter-${VERSION}.linux-amd64.tar.gz -O /workspace/exporters/postgres_exporter-${VERSION}.tar.gz -c
sudo wget https://raw.githubusercontent.com/prometheus-community/postgres_exporter/v${VERSION}/queries.yaml -O /workspace/exporters/queries.yaml
VERSION="0.11.1"
wget https://github.com/prometheus-community/postgres_exporter/releases/download/v${VERSION}/postgres_exporter-${VERSION}.linux-amd64.tar.gz -O /workspace/exporters/postgres_exporter-${VERSION}.tar.gz -c
wget https://raw.githubusercontent.com/prometheus-community/postgres_exporter/v${VERSION}/queries.yaml -O /workspace/exporters/queries.yaml

sudo rpmbuild \
rpmbuild \
--clean \
--define "pkgversion ${VERSION}" \
--define "_topdir ${PWD}/tmp/rpm" \
--define "_sourcedir ${PWD}/workspace/exporters" \
--define "_topdir /tmp/rpm" \
--define "_sourcedir /workspace/exporters" \
-bb /workspace/exporters/prometheus-postgres-exporter.spec

sudo cp ${PWD}/tmp/rpm/RPMS/*/*.rpm ${PWD}/workspace/build/
cp /tmp/rpm/x86_64/*.rpm /workspace/build/
}

build_node_exporter() {
# node_exporter version
VERSION="1.1.2"
sudo wget https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz -O /workspace/exporters/node_exporter-${VERSION}.tar.gz -c
VERSION="1.4.0"
wget https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz -O /workspace/exporters/node_exporter-${VERSION}.tar.gz -c

sudo rpmbuild \
rpmbuild \
--clean \
--define "pkgversion ${VERSION}" \
--define "_topdir ${PWD}/tmp/rpm" \
--define "_sourcedir ${PWD}/workspace/exporters" \
--define "_topdir /tmp/rpm" \
--define "_sourcedir /workspace/exporters" \
-bb /workspace/exporters/prometheus-node-exporter.spec

sudo cp ${PWD}/tmp/rpm/RPMS/*/*.rpm ${PWD}/workspace/build/
cp /tmp/rpm/x86_64/*.rpm /workspace/build/
}


sudo yum install wget epel-release -y
sudo mkdir -p ${PWD}/workspace/build/
sudo mkdir -p /workspace/build/
sudo chown builder: /workspace/build/

case $1 in
prometheus )
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ services:
build:
context: .
dockerfile: Dockerfile.builder8
image: dalibo/prometheus-builder:centos8
image: dalibo/prometheus-builder:rockylinux8
user: builder
environment:
- VERSION
volumes:
Expand Down
5 changes: 4 additions & 1 deletion exporters/postgres_exporter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ PG_EXPORTER_AUTO_DISCOVER_DATABASES=true
# Replace the version number in the filename for older version
PG_EXPORTER_EXTEND_QUERY_PATH=/usr/share/prometheus/postgres_exporter_queries-pg14.yaml
# Other command line options
POSTGRES_EXPORTER_OPTS=""
# Disable the database collector to use pg_database in
# postgres_export_queries-pg14.yaml instead.
# https://github.com/prometheus-community/postgres_exporter/issues/706
POSTGRES_EXPORTER_OPTS="--no-collector.database"
Loading