Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.
Merged
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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ deploy:
############################################################################
# Sandbox.
- provider: script
script: $TRAVIS_BUILD_DIR/deploy_prometheus_targets.sh mlab-sandbox global
script: $TRAVIS_BUILD_DIR/deploy_scraper_prometheus_targets.sh mlab-sandbox
skip_cleanup: true
on:
repo: m-lab/operator
Expand All @@ -54,7 +54,7 @@ deploy:
############################################################################
# Staging, on master.
- provider: script
script: $TRAVIS_BUILD_DIR/deploy_prometheus_targets.sh mlab-staging global
script: $TRAVIS_BUILD_DIR/deploy_scraper_prometheus_targets.sh mlab-staging
skip_cleanup: true
on:
repo: m-lab/operator
Expand All @@ -63,7 +63,7 @@ deploy:
############################################################################
# Production, on tags.
- provider: script
script: $TRAVIS_BUILD_DIR/deploy_prometheus_targets.sh mlab-oti global
script: $TRAVIS_BUILD_DIR/deploy_scraper_prometheus_targets.sh mlab-oti
skip_cleanup: true
on:
repo: m-lab/operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ CACHE_CONTROL="Cache-Control:private, max-age=0, no-transform"

USAGE="Usage: $0 <project>"
PROJECT=${1:?Please provide project name: $USAGE}
GROUP=${2:?Please provide monitoring group name: $USAGE}

# Root directory of this script.
SCRIPTDIR=$( dirname "${BASH_SOURCE[0]}" )
BASEDIR=${PWD}

# Generate the configs.
${SCRIPTDIR}/generate_prometheus_targets.sh ${GROUP} > /dev/null
${SCRIPTDIR}/generate_scraper_prometheus_targets.sh > /dev/null

# Be sure that gcloud is PATH
source "${HOME}/google-cloud-sdk/path.bash.inc"
Expand Down
253 changes: 0 additions & 253 deletions generate_prometheus_targets.sh

This file was deleted.

74 changes: 74 additions & 0 deletions generate_scraper_prometheus_targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

set -euxo pipefail

# Root directory of this script.
SCRIPTDIR=$( dirname "${BASH_SOURCE[0]}" )
BASEDIR=${PWD}

# Create all output directories.
for project in mlab-sandbox mlab-staging mlab-oti ; do
mkdir -p ${BASEDIR}/gen/${project}/prometheus/{legacy-targets,blackbox-targets,blackbox-targets-ipv6,snmp-targets,script-targets}
done

# All testing sites and machines.
SELECT_mlab_sandbox=$( cat ${SCRIPTDIR}/plsync/testing_patterns.txt | xargs | sed -e 's/ /|/g' )

# All mlab4's and the set of canary machines.
SELECT_mlab_staging=$( cat ${SCRIPTDIR}/plsync/staging_patterns.txt | xargs | sed -e 's/ /|/g' )

# All sites *excluding* test sites.
SELECT_mlab_oti=$( cat ${SCRIPTDIR}/plsync/production_patterns.txt | xargs | sed -e 's/ /|/g' )

# GCP doesn't support IPv6, so we have a Linode VM running three instances of
# the blackbox_exporter, on three separate ports... one port/instance for each
# project. These variables map projects to ports, and will be transmitted to
# Prometheus in the form of a new label that will be rewritten.
BBE_IPV6_PORT_mlab_oti="9115"
BBE_IPV6_PORT_mlab_staging="8115"
BBE_IPV6_PORT_mlab_sandbox="7115"


for project in mlab-sandbox mlab-staging mlab-oti ; do
pushd ${SCRIPTDIR}/plsync
output=${BASEDIR}/gen/${project}/prometheus

# Construct the per-project SELECT variable name to use below.
pattern=SELECT_${project/-/_}

# Construct the per-project blackbox_exporter port variable to use below.
# blackbox_exporter on for IPv6 targets.
bbe_port=BBE_IPV6_PORT_${project/-/_}

# Rsyncd on port 7999.
./legacyconfig.py --format=prom-targets \
--template_target={{hostname}}:7999 \
--label service=rsyncd \
--label module=rsyncd_online \
--rsync \
--select "${!pattern}" > ${output}/blackbox-targets/rsyncd.json

# SSH on port 806 over IPv4
./legacyconfig.py --format=prom-targets-nodes \
--template_target={{hostname}}:806 \
--label service=ssh806 \
--label module=ssh_v4_online \
--select "${!pattern}" > ${output}/blackbox-targets/ssh806.json

# SSH on port 806 over IPv6
./legacyconfig.py --format=prom-targets-nodes \
--template_target={{hostname}}:806 \
--label service=ssh806 \
--label module=ssh_v6_online \
--label __blackbox_port=${!bbe_port} \
--select "${!pattern}" \
--decoration "v6" > ${output}/blackbox-targets-ipv6/ssh806_ipv6.json

# Sidestream exporter in the npad experiment.
./legacyconfig.py --format=prom-targets \
--template_target={{hostname}}:9090 \
--label service=sidestream \
--select "npad.iupui.(${!pattern})" > \
${output}/legacy-targets/sidestream.json
popd
done