
GELÖST Ich brauche ATOP, um die Instanzen auf EC2 zu installieren, wenn die Maschinen von Beanstalk aus bereitstellen. Der AWS-Support hatte nur den unten stehenden Link, aber er zeigt nicht, wie man in den ebextensions-Konfigurationsdateien bereitstellt. Hat das schon jemand gemacht und bereits eine Konfigurationsdatei erstellt? Danke! -->https://www.tecmint.com/how-to-install-atop-to-monitor-logging-activity-of-linux-system-processes/
{{Bearbeiten 23.03.18}}
Ich habe das bisher alleine durchgearbeitet und das hier ist, was ich habe. Es funktioniert noch nicht ganz, aber ich arbeite noch daran.
packages:
rpm:
epel: https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
container_commands:
1_rpm_atop:
command: "sudo /bin/rpm -i --replacepkgs
https://www.atoptool.nl/download/atop-2.3.0-1.el6.x86_64.rpm"
2_add_atop:
command: "/sbin/chkconfig --add atop"
leader_only: true
3_add_atop:
command: "/sbin/chkconfig atop on --level 235"
leader_only: true
4_config_atop:
command: "/bin/sed 's/600/60/' /usr/share/atop/atop.daily -i"
leader_only: true
5_link:
command: "/bin/ln -sfn /var/log/atop /var/app/current/wp-content/uploads/atop"
leader_only: true
6_start:
command: "/etc/init.d/atop start"
leader_only: true
Antwort1
Mit der Hilfe des großartigen Yao vom AWS Beanstalk-Tech-Support konnten wir eine Datei erstellen, die ATOP auf allen Instanzen installiert. Außerdem schreibt es individuelle Instanzprotokolle in mein bereits vorhandenes, symbolisch verknüpftes EFS-Dateiverzeichnis, sodass die Protokolle bei Skalierung und Maschinenbereitstellungen erhalten bleiben. Dies funktioniert jetzt in meiner Entwicklungsbereitstellung. Wenn Sie nichts anderes hören, bedeutet dies, dass es in etwa einer Woche auch in der Produktion funktioniert. Hier ist der für meine Wordpress-Bereitstellung optimierte Inhalt. Viel Spaß!
container_commands:
1_install_config_atop:
command: /tmp/installatop.sh
files:
"/tmp/installatop.sh":
mode: "000755"
content : |
#!/bin/bash
#############################################
ATOPLOGDEST=/var/app/current/wp-content/uploads/atop/ #where to persist the atop log
LOGFILE=/tmp/atopinstall.log #installaton log
##############################################
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data/instance-id/)
exec 1>&- # close stdout
exec 2>&- # close stderr
echo "========" >> $LOGFILE
date >> $LOGFILE
echo "starting" >> $LOGFILE
echo "---- Step 1, install atop" >> $LOGFILE
echo "check if atop is installed" >> $LOGFILE
rpm -q atop >> $LOGFILE
if [ $? -ne 0 ]
then
echo "atop not installed yet" >> $LOGFILE
rpm -i https://www.atoptool.nl/download/atop-2.3.0-1.el6.x86_64.rpm
rpm -q atop >> $LOGFILE
echo "now installed" >> $LOGFILE
fi
echo "---- step 2, config atop in chkconfig" >> $LOGFILE
/sbin/chkconfig --add atop
/sbin/chkconfig atop on --level 235
echo "this is the output of chkconfig" >> $LOGFILE
/sbin/chkconfig | grep atop >> $LOGFILE
echo "---- setp 3, config atop's schedule to 60 seconds" >> $LOGFILE
/bin/sed 's/600/60/' /usr/share/atop/atop.daily -i
cat /usr/share/atop/atop.daily | grep "INTERVAL=" >> $LOGFILE
echo "---- step 4, presistent it in EFS" >> $LOGFILE
mkdir -p $ATOPLOGDEST$INSTANCEID
/bin/sed "s|/var/log/atop|$ATOPLOGDEST$INSTANCEID|" /usr/share/atop/atop.daily -i
cat /usr/share/atop/atop.daily | grep "LOGPATH=" >> $LOGFILE
stat $ATOPLOGDEST$INSTANCEID >> $LOGFILE
echo "---- step 5, restart atop" >> $LOGFILE
/etc/init.d/atop restart
sleep 5
ps aux | grep atop >> $LOGFILE
echo "---- finished!" >> $LOGFILE
date >> $LOGFILE
echo "========" >> $LOGFILE
Antwort2
Ich bin mir nicht sicher, aber ich glaube, wenn Sie diese Curl-URL von einer AWS-Instanz-CLI aus ausführen, wird die Instanz-ID zurückgegeben, von der aus Sie anrufen. Dies wird unter anderem verwendet, um Protokollverzeichnisse mit der Instanz-ID als Ordnernamen zu erstellen, damit sie pro Instanz, die ATOP ausführt, protokolliert und abgerufen werden können.