:/usr/lib/check_mk_agent/local$ ./nginx
Traceback (most recent call last):
File “./nginx”, line 6, in
data = urllib2.urlopen(‘http://127.0.0.1/nginx-status’).read()
File “/usr/lib/python2.7/urllib2.py”, line 127, in urlopen
return _opener.open(url, data, timeout)
File “/usr/lib/python2.7/urllib2.py”, line 410, in open
response = meth(req, response)
File “/usr/lib/python2.7/urllib2.py”, line 523, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib/python2.7/urllib2.py”, line 448, in error
return self._call_chain(*args)
File “/usr/lib/python2.7/urllib2.py”, line 382, in _call_chain
result = func(*args)
File “/usr/lib/python2.7/urllib2.py”, line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
It doesn’t look to me like your NGINX server is serving up the nginx-status page like the script expects. On the NGINX server itself you could try running: curl http://127.0.0.1/nginx-status
Ideally you would see something like:
$ curl http://127.0.0.1/nginx-status
Active connections: 1
server accepts handled requests
274 274 357
Reading: 0 Writing: 1 Waiting: 0
If not there’s probably some kind of issue with the location /nginx-status config block in your nginx conf file from the docs page you linked above. Or in some rare cases your NGINX install might not have been compiled with the stub_status_module. You should be able to confirm with: nginx -V 2>&1 | grep -o with-http_stub_status_module
Unless you have a specific reason for not doing so, I would just take your location /nginx-status {} config block and move it into the same server config block as LibreNMS. Right under the location /api/v0 {} block for example.
You can run multiple virtual servers in NGINX but you would need more configuration to do so. listen port, server_name, etc. And assuming both are on the same port you would need to make one server the default.
Into the first server block if you specify a second serverblock you have to have servername added and modify the check_mk_agent/local/nginx file to point to the servername to get nginx-status to work.