Created
September 5, 2019 18:57
-
-
Save ShyamsundarR/88be83a24c1ba833a5b071bf2a37f187 to your computer and use it in GitHub Desktop.
Script to gather gRPC metrics from ceph-csi plugins
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
#!/bin/bash | |
# $1 namespace to query | |
# $2 csi plugin to query | |
# $3 container in pod to exec commands in | |
# $4 port to query | |
function get_metrics() | |
{ | |
for pod in $(oc get pod -l app="$2" -n "$1" -o jsonpath="{.items[*].metadata.name}"); do | |
echo "Gathering CSI gRPC metrics for pod ($pod) in namespace ($2) into ${pod}-metrics.log" | |
podip=$(oc get -n "$1" pod/"$pod" -o jsonpath="{.status.podIP}") | |
oc exec -it -n "$1" "$pod" -c "$3" -- curl http://"${podip}":"$4"/metrics > "$pod"-metrics.log | |
done | |
} | |
# Gather rbd node plugin metrics | |
container="csi-rbdplugin" | |
port="9090" | |
ns="rook-ceph" | |
csi="csi-rbdplugin" | |
get_metrics $ns $csi $container $port | |
# Gather rbd provisioner plugin metrics | |
ns="rook-ceph" | |
csi="csi-rbdplugin-provisioner" | |
get_metrics $ns $csi $container $port | |
# Gather cephfs node plugin metrics | |
container="csi-cephfsplugin" | |
port="9091" | |
ns="rook-ceph" | |
csi="csi-cephfsplugin" | |
get_metrics $ns $csi $container $port | |
# Gather cephfs provisioner plugin metrics | |
ns="rook-ceph" | |
csi="csi-cephfsplugin-provisioner" | |
get_metrics $ns $csi $container $port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment