python 2.7.6到2.7.12打破了我的脚本

时间:2016-09-06 20:42:35

标签: python elasticsearch snmp

我正在使用一个简单的脚本将数据发送到elasticsearch节点,但在更改我的python版本后,该脚本不再运行。它说错误在第6行,但我不明白为什么。我已尝试在“是”之后添加逗号,但它没有效果。我试过移动我的牙套和括号,它必须起作用。 (为了简洁起见,我省略了导入和其他定义的变量)

if "Temporary failure in name resolution" or "Timeout" in output:
            es.index(index='data', doc_type='data', body={
            'macs' : '',
            'data' : line,
            'date' : datetime.now(),
            'down' : 'yes' })

以下是错误:

    snmpwalk: Timeout

Traceback (most recent call last):
  File "script.py", line 6, in <module>
    'down' : 'yes' })
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/utils.py", line 69, in _wrapped
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/__init__.py", line 279, in index
  File "build/bdist.linux-x86_64/egg/elasticsearch/transport.py", line 327, in perform_request
  File "build/bdist.linux-x86_64/egg/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution)

由于

1 个答案:

答案 0 :(得分:1)

这可能是网络问题,也可能是弹性搜索已用尽的mmapfs目录。

尝试运行以下命令重新启动网络服务器

sudo service network-manager restart

如果它不起作用,请通过运行此命令来更改您的mmap计数

sudo sysctl -w vm.max_map_count=262144

参考 https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html