Mysql/nginx/apache not working

Hi all,

I have followed the instruction as per below but unable to get data on librenms graphs.


[email protected]:/opt/librenms$ python3.7 ./validate.php
File “./validate.php”, line 2
SyntaxError: invalid syntax
Error in sys.excepthook:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/”, line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File “/usr/lib/python3/dist-packages/apport/”, line 5, in
from import Report
File “/usr/lib/python3/dist-packages/apport/”, line 30, in
import apport.fileutils
File “/usr/lib/python3/dist-packages/apport/”, line 23, in
from apport.packaging_impl import impl as packaging
File “/usr/lib/python3/dist-packages/apport/”, line 24, in
import apt
File “/usr/lib/python3/dist-packages/apt/”, line 23, in
import apt_pkg
ModuleNotFoundError: No module named ‘apt_pkg’

Original exception was:
File “./validate.php”, line 2
SyntaxError: invalid syntax
[email protected]:/opt/librenms$

and this is host side results where i installed librenms agent for service monitoring.

[email protected]:/usr/lib/check_mk_agent/local# python3.5 ./nginx
File “./nginx”, line 14
params[“Reading”] =
IndentationError: expected an indented block
[email protected]:/usr/lib/check_mk_agent/local# ^C
[email protected]:/usr/lib/check_mk_agent/local# python3.5 ./apache
File “./apache”, line 14
use LWP::Simple;
SyntaxError: invalid syntax

please if you could help me where i am doing wrong.
Your quick response will be highly appreciated. Thanks.


From where you get that validate.php should be run with python?

Also, your topic is confusing. You say mysql/nginx/apache not working. Do you have both, apache and nginx running? And you link to the Agent-Setup and not librenms install/setup.

Please, refresh your mind and ask again what is your problem



What i meant is , i want to monitoring these applications (mysql, nginx or apache etc.) I have installed liberenms agent on my host like switch or web server. Switches and servers have been added on librenms. and i have enabled unix-agent (module )for each device and enabled mysql and apache in apps settings.

all good but graphs are not showing any data.
I have added this file (mysql) from here:

and saved in /etc/snmp/ directory with .cnf.

@Arooj_Tahir is your unix-agent correctly running in the host? port open in firewall?

Try running ./discovery.php -d -h hostname and ./poller.php -d -h hostname and check the output

Somehow mysql graphs are start working. This is very strange btw.
but when i run /usr/lib/check_mk_agent/local/apache, and the output is Data fetch failure.

Does it give any “more specific” error?

I just checked on librenms doc and found this.

It’s required to have the following directive in your nginx configuration responsible for the localhost server:

location /nginx-status {
    stub_status on;
    access_log   off;
    deny all;

Can you please advise where i can find/create this file? path?

and below is the error for nginx:
]# /usr/lib/check_mk_agent/local/nginx-stats
Traceback (most recent call last):
File “/usr/lib/check_mk_agent/local/nginx-stats”, line 6, in
data = urllib2.urlopen(‘’).read()
File “/usr/lib64/python2.6/”, line 126, in urlopen
return, data, timeout)
File “/usr/lib64/python2.6/”, line 397, in open
response = meth(req, response)
File “/usr/lib64/python2.6/”, line 510, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib64/python2.6/”, line 435, in error
return self._call_chain(*args)
File “/usr/lib64/python2.6/”, line 369, in _call_chain
result = func(*args)
File “/usr/lib64/python2.6/”, line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found

and no just got this error for apache.
“Data fetch failure”

Ok. You should put that in the localhost vhost (usually, /etc/nginx/sites-available/default ) but it depends on how you have configured your nginx

@TheGreatDoc Thanks its working now.