ef4cbb3b08
This updates the gather-prom-metrics role to include gathering metrics from the active ceph-mgr endpoint Change-Id: Icb5d27b6a070e9065f6276725bf06dec7d2cbc0d Signed-off-by: Steve Wilkerson <sw5822@att.com>
67 lines
2.5 KiB
YAML
67 lines
2.5 KiB
YAML
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: "creating directory for helm release descriptions"
|
|
file:
|
|
path: "{{ logs_dir }}/prometheus"
|
|
state: directory
|
|
|
|
- name: "Get prometheus metrics from exporters in all namespaces"
|
|
shell: |-
|
|
set -e
|
|
NAMESPACES=$(kubectl get namespaces -o json | jq -r '.items[].metadata.name')
|
|
for NS in $NAMESPACES; do
|
|
SERVICES=$(kubectl get svc -l component=metrics -n $NS -o json | jq -r '.items[].metadata.name')
|
|
for SVC in $SERVICES; do
|
|
PORT=$(kubectl get svc $SVC -n $NS -o json | jq -r '.spec.ports[].port')
|
|
curl "$SVC.$NS:$PORT/metrics" >> "{{ logs_dir }}"/prometheus/$NS-$SVC.txt || true
|
|
done
|
|
done
|
|
args:
|
|
executable: /bin/bash
|
|
ignore_errors: True
|
|
|
|
- name: "Get prometheus metrics from tiller-deploy"
|
|
shell: |-
|
|
set -e
|
|
curl tiller-deploy.kube-system:44135/metrics >> "{{ logs_dir }}"/prometheus/kube-system-tiller-deploy.txt
|
|
args:
|
|
executable: /bin/bash
|
|
ignore_errors: True
|
|
|
|
- name: "Get ceph metrics from ceph-mgr"
|
|
shell: |-
|
|
set -e
|
|
mgr_endpoints=$(kubectl get endpoints -n ceph -l component=manager -o json | jq -r '.items[].subsets[].addresses[].ip')
|
|
echo "ceph-mgr endpoints: $mgr_endpoints"
|
|
for endpoint in $mgr_endpoints; do
|
|
echo "checking ceph-mgr at $endpoint"
|
|
metrics_curl="curl $endpoint:9283/metrics"
|
|
op=$(eval "$metrics_curl")
|
|
if [[ -n $op ]]; then
|
|
curl $endpoint:9283/metrics >> "{{ logs_dir }}"/prometheus/ceph-ceph-mgr.txt
|
|
break
|
|
else
|
|
echo "$endpoint is a standby ceph-mgr. Trying next endpoint"
|
|
fi
|
|
done
|
|
args:
|
|
executable: /bin/bash
|
|
ignore_errors: True
|
|
|
|
- name: "Downloads logs to executor"
|
|
synchronize:
|
|
src: "{{ logs_dir }}/prometheus"
|
|
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
|
|
mode: pull
|
|
ignore_errors: True
|