Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing rke2-etcd metrics collection #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mlaguilharre
Copy link
Contributor

This part of the code is not working,
techo "Collecting rke2 etcd metrics"
ETCD_ENDPOINTS=$(grep -oE '\b([0-9]{1,3}.){3}[0-9]{1,3}:2379\b' $TMPDIR/etcd/memberlist | uniq)
for ENDPOINT in ${ETCD_ENDPOINTS}
do
curl -sL --connect-timeout 5 --cacert ${ETCD_CACERT} --key ${ETCD_KEY} --cert ${ETCD_CERT} https://$ENDPOINT/metrics > $TMPDIR/etcd/etcd-metrics-$ENDPOINT.txt
done
The metrics by default are published on line listen-metrics-urls: in file
/var/lib/rancher/rke2/server/db/etcd/config

This part of the code is not working, 
        techo "Collecting rke2 etcd metrics"
        ETCD_ENDPOINTS=$(grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}:2379\b' $TMPDIR/etcd/memberlist | uniq)
        for ENDPOINT in ${ETCD_ENDPOINTS}
          do
            curl -sL --connect-timeout 5 --cacert ${ETCD_CACERT} --key ${ETCD_KEY} --cert ${ETCD_CERT} https://$ENDPOINT/metrics > $TMPDIR/etcd/etcd-metrics-$ENDPOINT.txt
        done
The metrics by default are published on line listen-metrics-urls: in file
/var/lib/rancher/rke2/server/db/etcd/config
@dkeightley
Copy link
Contributor

Thanks @mlaguilharre, the endpoints could be retrieved from the config file.. however, am I correct in saying the for loop would still be necessary to cater for multiple etcd nodes (each endpoint)?

What is not working for you? Happy to simplify this to the config file, but if the memberlist file wasn't populated or the curl is failing it would indicate a larger issue outside of the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants