Trying to restart nagios from api by sending commands as you showed in examples and api crusshes.
Here is the request
curl -X POST -H "content-type: application/json" -v 'http://admin:password@monitor.example.com:5000/control?restart'
* About to connect() to monitor.lanbilling.ru port 5000 (#0)
* Trying 192.168.x.1... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
[andruss@example ~]# curl -X POST -H "content-type: application/json" -v 'http://admin:password@monitor.lanbilling.ru:5000/control?restart'
* About to connect() to monitor.example.com port 5000 (#0)
* Trying 192.168.x.1... connected
* Connected to monitor.lanbilling.ru (192.168.x.1) port 5000 (#0)
* Server auth using Basic with user 'admin'
> POST /control?restart HTTP/1.1
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: andruss.example.net:5000
> Accept: */*
> content-type: application/json
>
* Empty reply from server
and api itself running everything is ok
[root@dhcp restlos]# python2.7 /opt/restlos/restlosapi.py 5000
* starting restlos V0.3
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
but when above curl command is sent got the following:
Traceback (most recent call last):
File "/opt/restlos/restlosapi.py", line 363, in
app.run(port=config['port'],host='0.0.0.0')
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 843, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 694, in run_simple
inner()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner
srv.serve_forever()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever
HTTPServer.serve_forever(self)
File "/usr/local/lib/python2.7/SocketServer.py", line 238, in serve_forever
self._handle_request_noblock()
File "/usr/local/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock
self.handle_error(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/SocketServer.py", line 651, in __init__
self.handle()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 216, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 251, in handle_one_request
return self.run_wsgi()
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 181, in execute
application_iter = app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1559, in handle_exception
handler = self._find_error_handler(InternalServerError())
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1476, in _find_error_handler
.get(code))
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1465, in find_handler
handler = handler_map.get(cls)
AttributeError: 'function' object has no attribute 'get'
Trying to restart nagios from api by sending commands as you showed in examples and api crusshes.
Here is the request
and api itself running everything is ok
but when above curl command is sent got the following:
Traceback (most recent call last): File "/opt/restlos/restlosapi.py", line 363, in app.run(port=config['port'],host='0.0.0.0') File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 843, in run run_simple(host, port, self, **options) File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 694, in run_simple inner() File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner srv.serve_forever() File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever HTTPServer.serve_forever(self) File "/usr/local/lib/python2.7/SocketServer.py", line 238, in serve_forever self._handle_request_noblock() File "/usr/local/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock self.handle_error(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/lib/python2.7/SocketServer.py", line 651, in __init__ self.handle() File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 216, in handle rv = BaseHTTPRequestHandler.handle(self) File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 251, in handle_one_request return self.run_wsgi() File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 193, in run_wsgi execute(self.server.app) File "/usr/local/lib/python2.7/site-packages/werkzeug/serving.py", line 181, in execute application_iter = app(environ, start_response) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__ return self.wsgi_app(environ, start_response) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1559, in handle_exception handler = self._find_error_handler(InternalServerError()) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1476, in _find_error_handler .get(code)) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1465, in find_handler handler = handler_map.get(cls) AttributeError: 'function' object has no attribute 'get'