awslogs-agent-setup.py在Ubuntu 17.10上不起作用(巧妙) [英] awslogs-agent-setup.py not working on Ubuntu 17.10 (artful)

查看:184
本文介绍了awslogs-agent-setup.py在Ubuntu 17.10上不起作用(巧妙)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在ubuntu 16.04上正常工作,但在17.10上无效

This works fine on ubuntu 16.04, but not on 17.10

+ curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M100 56093  100 56093    0     0  56093      0  0:00:01 --:--:--  0:00:01 98929
+ chmod +x ./awslogs-agent-setup.py
+ ./awslogs-agent-setup.py -n -c /etc/awslogs/awslogs.conf -r us-west-2

Step 1 of 5: Installing pip ...^[[0mlibyaml-dev does not exist in system ^[[0m^[[92mDONE^[[0m

Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... ^[[0mTraceback (most recent call last):
  File "./awslogs-agent-setup.py", line 1317, in <module>
    main()
  File "./awslogs-agent-setup.py", line 1313, in main
    setup.setup_artifacts()
  File "./awslogs-agent-setup.py", line 858, in setup_artifacts
    self.install_awslogs_cli()
  File "./awslogs-agent-setup.py", line 570, in install_awslogs_cli
    subprocess.call([AWSCLI_CMD, 'configure', 'set', 'plugins.cwlogs', 'cwlogs'], env=DEFAULT_ENV)
  File "/usr/lib/python2.7/subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1025, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

我注意到,在此过程的早期,它在AWS样板中无法安装libyaml-dev,但不确定这是否是唯一的问题.

I noticed that earlier on in the process, in the AWS boilerplate it failed to install libyaml-dev but not sure if that's the only problem.

推荐答案

总是在我发布答案后立即找到答案...

Always find the answer right after I post it...

这是我修改过的CF模板命令:

Here's my modified CF template command:

    050_install_awslogs:
      command: !Sub 
        "/bin/bash -x\n
        exec >>/var/log/cf_050_install_awslogs.log 2>&1 \n
        echo 050_install_awslogs...\n
        set -xe\n
        # Get the CloudWatch Logs agent\n
        mkdir /opt/awslogs\n
        cd /opt/awslogs\n
        # Needed for python3 in 17.10\n
        apt-get install -y libyaml-dev python-dev \n
        pip3 install awscli-cwlogs\n
        # avoid it complaining about not having /var/awslogs/bin/aws binary\n
        if [ ! -d /var/awslogs/bin ] ; then\n
          mkdir -p /var/awslogs/bin\n
          ln -s /usr/local/bin/aws /var/awslogs/bin/aws\n
        fi\n
        curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O\n
        chmod +x ./awslogs-agent-setup.py\n
        # Hack for python 3.6 & old awslogs-agent-setup.py\n
        sed -i 's/3,6/3,7/' awslogs-agent-setup.py\n
        ./awslogs-agent-setup.py -n -c /etc/awslogs/awslogs.conf -r ${AWS::Region}\n
        echo 050_install_awslogs end\n
        "

不能完全确定是否需要创建dir,但是我希望这是一个临时情况,由于仍然需要对python 3.6兼容性检查进行摸索,因此这种情况将很快得到解决.

Not entirely sure about the need for the dir creation but I expect this is a temporary case that will get resolved soon as one still needs to fudge the python 3.6 compatibility check.

它也可以使用python 2.7进行安装,但是由于我对17.10的基本原理是python 3.6,因此在这一点上感觉倒退了.

it may be installable using python 2.7 as well, but that felt like going backwards at this point as the my rationale for 17.10 was python 3.6.

将yaml软件包和目录创建思路的信用贷给 https://forums .aws.amazon.com/thread.jspa?threadID = 265977 ,但我更喜欢避免easy_install.

Credit for the yaml package and dir creation idea to https://forums.aws.amazon.com/thread.jspa?threadID=265977 but I prefer to avoid easy_install.

这篇关于awslogs-agent-setup.py在Ubuntu 17.10上不起作用(巧妙)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆