Skip to content

Instantly share code, notes, and snippets.

@garthk
Last active April 8, 2020 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garthk/977a82f87cc824a8e2fdff46650b04dd to your computer and use it in GitHub Desktop.
Save garthk/977a82f87cc824a8e2fdff46650b04dd to your computer and use it in GitHub Desktop.
Demonstration of problem installing Scalyr Agent 2 on Amazon Linux 2

Demonstration of Problem Installing Scalyr Agent 2

Our most recently launched nodes' agents are crashing at startup with:

File "/usr/share/scalyr-agent-2/py/scalyr_agent/builtin_monitors/docker_monitor.py
class DockerClient(docker.APIClient): # pylint: disable=no-member
AttributeError: 'module' object has no attribute 'APIClient'

We can reproduce the AttributeError on the nodes with:

# python2
Python 2.7.16 (default, Dec 12 2019, 23:58:22) 
[GCC 7.3.1 20180712 (Red Hat 7.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.APIClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'APIClient'

We can also reproduce the AttributeError with this Dockerfile, which installs Scalyr Agent 2 the way we installed it on the nodes and then runs the Python code above:

docker build -t scalyr-agent-2-test .
docker run --rm -ti scalyr-agent-2-test
FROM amazonlinux:2
COPY scalyr.key /etc/pki/rpm-gpg/RPM-GPG-KEY-scalyr-1
COPY scalyr.repo /etc/yum.repos.d/
RUN yum install -y jq systemd-python python2-pip scalyr-agent-2
RUN pip2 install docker-py
CMD ["python2", "-c", "import docker; docker.APIClient"]
‎‎​-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFGKh7IBCADjfbnZ05xspGma+kHSS45R6Rc1L44rD2IoNbIU8iv39exbh7er
Ca88FBoNbrj59liO/cFU1yPi8EEfor0nBIoWgdcmxZeXhzayVQ9gYHNFZ+lz3H5t
8xgkLls2I7TaZ4OT5W1Kc/yIPRopyx9IHc4dhr9EbGWWqJHiB+yiIzJ2HOgO+v34
UVUe/qj7fA1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Vha6k7srUHABEBAAGJAR8EGAECAAkFAlGK
h7ICGwwACgkQ9wzu20rXtsaHwQgA4bTWizRJeKZo/UHE0lpn+bPDA4pzc2Ycegho
ALgqc19xJTPZ0xKk/JUyhvrKgksV//hHieXKLpIBUgBs2DXk955Zhd/mR/QcPaMe
pD7HQKLwKrhjFNlQZYUiAsm/YFPw+2upOwGfe5dh5BNSF/7qCZ/LxrxEnxBVQrPd
FTXkctSOWXR5UBgiKJBJamzFvVWaJO4Q1MJtZa5Evwgu6zJK8fVlA55RyDVLK/a/
AvtC17w/XMN6+ZqwnIdI5uR+SEPT1MtkelMecnbTcQdODr/lde8pbMU5rcQv06bl
FfxCdaL/aDAIKbRu/LEscrPRozHlnCIi/u1hqVRyj6QNEDQQbg==
=Bzac
-----END PGP PUBLIC KEY BLOCK-----
[scalyr]
includepkgs=scalyr-agent,scalyr-agent-2,scalyr-repo
name = Scalyr packages - noarch
baseurl = https://scalyr-repo.s3.amazonaws.com/stable/yum/binaries/noarch
mirror_expire = 300
metadata_expire = 300
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-scalyr-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment