Mysql/nginx/apache not working

Hi all,

I have followed the instruction as per below but unable to get data on librenms graphs.
https://docs.librenms.org/#Extensions/Agent-Setup/

output:
./validate.php

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

Original exception was:
File “./validate.php”, line 2
<?php
^
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”] = smallstat.group(1)
^
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.

Regards,
Arooj

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

2 Likes

Hi,

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: https://github.com/librenms/librenms-agent/tree/master/snmp

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;
    allow 127.0.0.1;
    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(‘http://127.0.0.1/nginx-status’).read()
File “/usr/lib64/python2.6/urllib2.py”, line 126, in urlopen
return _opener.open(url, data, timeout)
File “/usr/lib64/python2.6/urllib2.py”, line 397, in open
response = meth(req, response)
File “/usr/lib64/python2.6/urllib2.py”, line 510, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib64/python2.6/urllib2.py”, line 435, in error
return self._call_chain(*args)
File “/usr/lib64/python2.6/urllib2.py”, line 369, in _call_chain
result = func(*args)
File “/usr/lib64/python2.6/urllib2.py”, 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.