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

Eng 1219 enable cloudwatch meteorops #2348

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions IaC/cloud.cd/init.groovy.d/cloud.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ initMap['docker'] = '''
sudo systemctl status docker || sudo systemctl start docker
sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker2'] = initMap['docker']
initMap['docker-32gb'] = '''
Expand Down Expand Up @@ -183,6 +188,11 @@ initMap['docker-32gb'] = '''
CRICTL_LATEST_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/cri-tools/releases/latest|grep tag_name | cut -d '"' -f 4)
sudo curl -Lo /tmp/crictl-${CRICTL_LATEST_VERSION}-linux-amd64.tar.gz https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_LATEST_VERSION}/crictl-${CRICTL_LATEST_VERSION}-linux-amd64.tar.gz
sudo tar xvfz /tmp/crictl-${CRICTL_LATEST_VERSION}-linux-amd64.tar.gz -C /usr/bin/

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['micro-amazon'] = '''
set -o xtrace
Expand All @@ -206,6 +216,11 @@ initMap['micro-amazon'] = '''
sudo amazon-linux-extras install java-openjdk11 -y || :
sudo yum -y install git aws-cli || :
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

capMap = [:]
Expand Down
60 changes: 60 additions & 0 deletions IaC/ps80.cd/init.groovy.d/cloud.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ initMap['docker'] = '''
sudo systemctl status docker || sudo systemctl start docker
sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker-32gb'] = initMap['docker']
initMap['docker-32gb-hirsute'] = '''
Expand Down Expand Up @@ -317,6 +322,16 @@ initMap['docker-32gb-hirsute'] = '''
echo '{"experimental": true, "ipv6": true, "fixed-cidr-v6": "fd3c:a8b0:18eb:5c06::/64"}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker-32gb-jammy'] = initMap['docker-32gb-hirsute']
initMap['docker-32gb-focal'] = initMap['docker-32gb-hirsute']
Expand Down Expand Up @@ -386,10 +401,22 @@ initMap['docker-32gb-bullseye'] = '''
echo '{"experimental": true, "ipv6": true, "fixed-cidr-v6": "fd3c:a8b0:18eb:5c06::/64"}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker2'] = initMap['docker']
initMap['micro-amazon'] = '''
set -o xtrace
RHVER=$(rpm --eval %rhel)
SYSREL=$(cat /etc/system-release | tr -dc '0-9.'|awk -F'.' {'print $1'})
if ! mountpoint -q /mnt; then
for DEVICE_NAME in $(lsblk -ndpbo NAME,SIZE | sort -n -r | awk '{print $1}'); do
if ! grep -qs "${DEVICE_NAME}" /proc/mounts; then
Expand Down Expand Up @@ -422,6 +449,19 @@ initMap['micro-amazon'] = '''
sudo yum -y install aws-cli || :
sudo yum -y install git || :
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#2-8-9Meteorops cloudwatch
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
if [[ ${SYSREL} == "2" ]]; then
sudo yum -y install amazon-cloudwatch-agent
elif [[ ${RHVER} == "8" ]] || [[ ${RHVER} == "9" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
fi
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['min-amazon-2-x64'] = initMap['micro-amazon']
initMap['min-centos-6-x64'] = '''
Expand Down Expand Up @@ -483,6 +523,16 @@ initMap['min-bionic-x64'] = '''
done
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install openjdk-11-jre-headless git
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['min-buster-x64'] = '''
set -o xtrace
Expand Down Expand Up @@ -521,6 +571,16 @@ initMap['min-buster-x64'] = '''
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get -y install ${JAVA_VER} git
fi
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['min-jammy-x64'] = initMap['min-bionic-x64']
initMap['min-focal-x64'] = initMap['min-bionic-x64']
Expand Down
34 changes: 34 additions & 0 deletions IaC/psmdb.cd/init.groovy.d/cloud.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ initMap['docker'] = '''
sudo systemctl status docker || sudo systemctl start docker
sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.188.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker-32gb'] = '''
set -o xtrace
Expand Down Expand Up @@ -172,11 +177,17 @@ initMap['docker-32gb'] = '''
sudo systemctl status docker || sudo systemctl start docker
sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.188.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['rpmMap'] = '''
set -o xtrace
RHVER=$(rpm --eval %rhel)
SYSREL=$(cat /etc/system-release | tr -dc '0-9.'|awk -F'.' {'print $1'})
ARCH=$(uname -m)

if ! mountpoint -q /mnt; then
Expand Down Expand Up @@ -210,6 +221,19 @@ initMap['rpmMap'] = '''
sudo yum -y install git || :
sudo yum -y install aws-cli || :
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#2-8-9Meteorops cloudwatch
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
if [[ ${SYSREL} == "2" ]]; then
sudo yum -y install amazon-cloudwatch-agent
elif [[ ${RHVER} == "8" ]] || [[ ${RHVER} == "9" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
fi
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['debMap'] = '''
Expand Down Expand Up @@ -253,6 +277,16 @@ initMap['debMap'] = '''
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get -y install ${JAVA_VER} git
fi
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''


Expand Down
28 changes: 28 additions & 0 deletions IaC/pxb.cd/init.groovy.d/cloud.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ initMap['docker'] = '''
sudo systemctl status docker || sudo systemctl start docker
sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker-32gb'] = initMap['docker']

Expand Down Expand Up @@ -179,6 +184,19 @@ initMap['rpmMap'] = '''
cd /tmp/aws && sudo ./install
fi
fi

#2-8-9Meteorops cloudwatch
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
if [[ ${SYSREL} == "2" ]]; then
sudo yum -y install amazon-cloudwatch-agent
elif [[ ${RHVER} == "8" ]] || [[ ${RHVER} == "9" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
fi
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['debMap'] = '''
Expand Down Expand Up @@ -218,6 +236,16 @@ initMap['debMap'] = '''
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get -y install ${JAVA_VER} git
fi
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/vorsel/aux/master/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['micro-amazon'] = initMap['rpmMap']
Expand Down
28 changes: 28 additions & 0 deletions IaC/pxc.cd/init.groovy.d/cloud.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ initMap['docker'] = '''
sudo systemctl status docker || sudo systemctl start docker
echo sudo service docker status || sudo service docker start
echo "* * * * * root /usr/sbin/route add default gw 10.177.1.1 eth0" | sudo tee /etc/cron.d/fix-default-route

#Meteorops cloudwatch
sudo yum -y install amazon-cloudwatch-agent
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''
initMap['docker-32gb'] = initMap['docker']

Expand Down Expand Up @@ -253,6 +258,19 @@ initMap['rpmMap'] = '''
cd /tmp/aws && sudo ./install
fi
fi

#2-8-9Meteorops cloudwatch
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
if [[ ${SYSREL} == "2" ]]; then
sudo yum -y install amazon-cloudwatch-agent
elif [[ ${RHVER} == "8" ]] || [[ ${RHVER} == "9" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm -o /tmp/amazon-cloudwatch-agent.rpm
sudo yum -y install /tmp/amazon-cloudwatch-agent.rpm
fi
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['rpmMapRamdisk'] = '''
Expand Down Expand Up @@ -327,6 +345,16 @@ initMap['debMap'] = '''
sudo DEBIAN_FRONTEND=noninteractive sudo apt-get -y install ${JAVA_VER} git
fi
sudo install -o $(id -u -n) -g $(id -g -n) -d /mnt/jenkins

#Meteorops cloudwatch
if [[ ${DEB_VER} == "buster" ]] || [[ ${DEB_VER} == "bullseye" ]] || [[ ${DEB_VER} == "bookworm" ]]; then
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
else
sudo curl https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o /tmp/amazon-cloudwatch-agent.deb
fi
sudo apt -y install /tmp/amazon-cloudwatch-agent.deb
sudo curl https://raw.githubusercontent.com/Percona-Lab/release-aux/main/amazon-cloudwatch-agent-config/config.json -o /mnt/config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/mnt/config.json
'''

initMap['debMapRamdisk'] = '''
Expand Down