I just started with Nagios XI and i got this error and i cant find the right answer does anyone know what the problem is?
I already checked the proxy and i cant find where the problem is.
The code is to get notifications messages through whats app.
[root#localhost ~]# yowsup-cli registration --requestcode sms --phone 316******** --cc 31 --mcc 204 --mnc 10
yowsup-cli v2.0.15
yowsup v2.5.0
Copyright (c) 2012-2016 Tarek Galal
http://www.openwhatsapp.org
This software is provided free of charge. Copying and redistribution is
encouraged.
If you appreciate this software and you would like to support future
development please consider donating:
http://openwhatsapp.org/yowsup/donate
Traceback (most recent call last):
File "/usr/bin/yowsup-cli", line 368, in <module>
if not parser.process():
File "/usr/bin/yowsup-cli", line 189, in process
self.handleRequestCode(self.args["requestcode"], config)
File "/usr/bin/yowsup-cli", line 208, in handleRequestCode
result = codeReq.send()
File "/usr/lib/python2.6/site-packages/yowsup/registration/coderequest.py", line 62, in send
res = super(WACodeRequest, self).send(parser)
File "/usr/lib/python2.6/site-packages/yowsup/common/http/warequest.py", line 70, in send
return self.sendGetRequest(parser)
File "/usr/lib/python2.6/site-packages/yowsup/common/http/warequest.py", line 108, in sendGetRequest
self.response = WARequest.sendRequest(host, port, path, headers, params, "GET")
File "/usr/lib/python2.6/site-packages/yowsup/common/http/warequest.py", line 164, in sendRequest
conn.request(reqType, path, params, headers);
File "/usr/lib64/python2.6/httplib.py", line 973, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.6/httplib.py", line 1010, in _send_request
self.endheaders()
File "/usr/lib64/python2.6/httplib.py", line 967, in endheaders
self._send_output()
File "/usr/lib64/python2.6/httplib.py", line 831, in _send_output
self.send(msg)
File "/usr/lib64/python2.6/httplib.py", line 790, in send
self.connect()
File "/usr/lib64/python2.6/httplib.py", line 1171, in connect
sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
raise error, msg
socket.error: [Errno 111] Connection refused
thanks in advance.
Related
My goal is to read file from hdfs in airflow and do further manipulations.
After researching, I found that url I need to use is as follows:
df = pd.read_parquet('http://localhost:9870/webhdfs/v1/hadoop_files/sample_2022_01.parquet?op=OPEN'),
where localhost/172.20.80.1/computer-name.mshome.net can be interchangeably used,
9870 - namenode port,
hadoop_files/sample_2022_01.parquet - my folder and file created in the root.
I can access and read file locally in PyCharm, but I am unable to get the same result inside airflow in docker. I tried using local hdfs and hdfs hosted in docker and changing host to the host.docker.internal, but I am getting the same error.
Stack trace:
[2022-06-12, 17:52:45 UTC] {taskinstance.py:1889} ERROR - Task failed with exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/urllib/request.py", line 1350, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/local/lib/python3.7/http/client.py", line 1281, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1327, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1276, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1036, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 976, in send
self.connect()
File "/usr/local/lib/python3.7/http/client.py", line 948, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/local/lib/python3.7/socket.py", line 728, in create_connection
raise err
File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 207, in execute
branch = super().execute(context)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 171, in execute
return_value = self.execute_callable()
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/operators/python.py", line 189, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/opt/airflow/dags/includes/parquet_dag/main.py", line 15, in main
df_parquet = read('hdfs://localhost:9000/hadoop_files/sample_2022_01.parquet')
File "/opt/airflow/dags/includes/parquet_dag/utils.py", line 29, in read
df = pd.read_parquet('http://172.20.80.1:9870/webhdfs/v1/hadoop_files/sample_2022_01.parquet?op=OPEN')
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/parquet.py", line 500, in read_parquet
**kwargs,
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/parquet.py", line 236, in read
mode="rb",
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/parquet.py", line 102, in _get_path_or_handle
path_or_handle, mode, is_text=False, storage_options=storage_options
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/common.py", line 614, in get_handle
storage_options=storage_options,
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/common.py", line 312, in _get_filepath_or_buffer
with urlopen(req_info) as req:
File "/home/airflow/.local/lib/python3.7/site-packages/pandas/io/common.py", line 212, in urlopen
return urllib.request.urlopen(*args, **kwargs)
File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.7/urllib/request.py", line 1378, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/lib/python3.7/urllib/request.py", line 1352, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 113] No route to host>
With host.docker.internal:
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>
you need to use any routable address inside airflow docker container.
if hadoop is inside docker container as well, check it ip address using docker inspect CONTAINER (doc). if hadoop is on localhost you can set network_mode: "host" (doc)
also there is an important notice if you are on macos and have the docker desktop app which basically a virtual machine. so in this case you need some extra settings, check this, for example.
where localhost/172.20.80.1/computer-name.mshome.net can be interchangeably used,
They shouldn't be interchangeable inside Docker network.
From Airflow, you could use Docker service names, not IP addresses, and ensure the containers are in the same bridge network (not host mode, which only works on Linux). host.docker.internal isn't correct either since you're trying to reach another container, not your host
https://docs.docker.com/network/bridge/
I'd also recommend using Airflow Spark operators to actually read Parquet from HDFS, using Spark, not Pandas or WebHDFS. You can convert Spark dataframes to Pandas, if needed
I want to run many instances of Chrome (using Chromedriver) at the same time. I use Python and Celery. On the local computer everything works without problems, but on the server (Win7 and Win10) - only seven instances of Chrome are opened, the rest are crashed when it tries to run the next instance:
ConnectionRefusedError: [WinError 10061] No connection could be made because of the target machine actively refused it
[2017-04-18 08:14:43,988: ERROR/MainProcess] Task bid[7fce5818-41b5-4ff5-9ae2-41913bd88f43] raised unexpected: ConnectionRefusedError(10061, 'No connection could be made because the target machine actively refused it', None, 10061, None)
Traceback (most recent call last):
File "E:\env\bot\lib\site-packages\celery\app\trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "E:\env\bot\lib\site-packages\celery\app\trace.py", line 438, in _protected_call_
return self.run(*args, **kwargs)
File "E:\bot\app.py", line 100, in bid
home_page.open()
File "E:\env\bot\lib\site-packages\webium\base_page.py", line 57, in open
self._driver.get(self.url)
File "E:\env\bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in get
self.execute(Command.GET, {'url': url})
File "E:\env\bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "E:\env\bot\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 407, in execute
return self._request(command_info[0], url, body=data)
File "E:\env\bot\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 438, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "C:\Python35-32\Lib\http\client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "C:\Python35-32\Lib\http\client.py", line 1151, in _send_request
self.endheaders(body)
File "C:\Python35-32\Lib\http\client.py", line 1102, in endheaders
self._send_output(message_body)
File "C:\Python35-32\Lib\http\client.py", line 934, in _send_output
self.send(msg)
File "C:\Python35-32\Lib\http\client.py", line 877, in send
self.connect()
File "C:\Python35-32\Lib\http\client.py", line 849, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Python35-32\Lib\socket.py", line 711, in create_connection
raise err
File "C:\Python35-32\Lib\socket.py", line 702, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
I don't use Selenium Grid, I run lots of instances with next parameters:
def set_driver():
chrome_options = Options()
chrome_options.add_extension('extension_3_0_0_14.crx')
return webdriver.Chrome(chrome_options=chrome_options)
Has anyone met the problem? What could be the reason? How can I solve the issue?
PS Google says that there is a problem with sockets. But why everything goes fine on my local machine and there are troubles on VM?
I'm trying to get a Flask/Neo4j app set up on a remote Ubuntu server, and I've run into a problem that I haven't been able to figure out. My app uses py2neo, but when it tries to connect to the graph, the app crashes and the Neo4j process seems to stop. I've tried connecting in a python shell like this...
test = Graph('http://localhost:7474/db/data/',username='neo4j',password='myPassword')
which fails, and also renders neo4j inoperative until I restart it. However, these return 200 responses (and the web interface also works):
curl -u neo4j http://localhost:7474/db/data/
requests.get('http://localhost:7474/db/data/', auth=('neo4j','myPassword'))
I've tried to provide more information than this similar question, because it seems like the connection works from everywhere but py2neo.
Here's the full traceback:
Traceback (most recent call last):
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/database/__init__.py", line 318, in __new__
inst = cls.__instances[key]
KeyError: (<class 'py2neo.database.Graph'>, <ServerAddress settings={'http_port': 7474, 'host': 'localhost'}>, 'data')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 322, in submit
response = send()
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 317, in send
http.request(xstr(method), xstr(uri.absolute_path_reference), body, headers)
File "/usr/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 80, in connect
self.source_address)
File "/usr/lib/python3.5/socket.py", line 711, in create_connection
raise err
File "/usr/lib/python3.5/socket.py", line 702, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/database/__init__.py", line 327, in __new__
use_bolt = version_tuple(inst.__remote__.get().content["neo4j_version"]) >= (3,)
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/database/http.py", line 154, in get
response = self.__base.get(headers=headers, redirect_limit=redirect_limit, **kwargs)
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 966, in get
return self.__get_or_head("GET", if_modified_since, headers, redirect_limit, **kwargs)
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 943, in __get_or_head
return rq.submit(redirect_limit=redirect_limit, **kwargs)
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 433, in submit
http, rs = submit(self.method, uri, self.body, self.headers)
File "/home/deploy/toponimika/toponimikaenv/lib/python3.5/site-packages/py2neo/packages/httpstream/http.py", line 362, in submit
raise SocketError(code, description, host_port=uri.host_port)
py2neo.packages.httpstream.http.SocketError: Connection refused
Anything I might try to figure out what's going on would be appreciated.
Changed to http://username:password#localhost:7474/db/data/ and it works!
Example:
test = Graph('http://username:password#localhost:7474/db/data/')
I had the same issue, solved with a simple upgrade of pip version.
pip install --upgrade py2neo
I'm using selenium on my local computer, but sometimes I get a socket error that I don't fully understand. So far, restarting the (Python) application has worked for me.
What could be causing this?
driver = webdriver.Firefox(firefox_profile=someProfile)
driver.get(someLink)
Stack trace:
Traceback (most recent call last):
File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-cdc559ddfda1>", line 1, in <module>
driver.get(link)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in get
self.execute(Command.GET, {'url': url})
File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 231, in execute
response = self.command_executor.execute(driver_command, params)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute
return self._request(command_info[0], url, body=data)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 425, in _request
self._conn.request(method, parsed_url.path, body, headers)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1079, in endheaders
self._send_output(message_body)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 911, in _send_output
self.send(msg)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 854, in send
self.connect()
File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 826, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/home/foo/.conda/envs/myenv3/lib/python3.5/socket.py", line 711, in create_connection
raise err
File "/home/foo/.conda/envs/myenv3/lib/python3.5/socket.py", line 702, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
it looks the problem is related to some http libraries which ignores the proxy settings. what version of python you are using ? try using Python 2.x and see how it goes.
I am new to Python and trying to run attached code.
import urllib
url = 'https://www.google.com/'
print(url)
sock = urllib.urlopen(url)
But I get an error below:
>>> runfile('C:/Users/myname/Documents/Python Scripts/ex00.py', wdir=r'C:/Users/myname/Documents/Python Scripts')
https://www.google.com/
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "C:/Users/myname/Documents/Python Scripts/ex00.py", line 5, in <module>
sock = urllib.urlopen(url)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\urllib.py", line 87, in urlopen
return opener.open(url)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\urllib.py", line 208, in open
return getattr(self, name)(url)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\urllib.py", line 437, in open_https
h.endheaders(data)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\httplib.py", line 969, in endheaders
self._send_output(message_body)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\httplib.py", line 829, in _send_output
self.send(msg)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\httplib.py", line 791, in send
self.connect()
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\httplib.py", line 1172, in connect
self.timeout, self.source_address)
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\socket.py", line 571, in create_connection
raise err
IOError: [Errno socket error] [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Earlier I thought that it is may be because I am running the script from my office and VPN is causing issues. So I ran it from my home internet connection but no resolution :(