opinkerfi / adagios

Adagios - Web Based Nagios Configuration
GNU Affero General Public License v3.0
330 stars 75 forks source link

Pynag/Json error when viewing graphs #242

Closed Ev1l closed 10 years ago

Ev1l commented 10 years ago

Adagios Version: 1.2.7-1.git.19.5f41b9f.el6

I am receiving the following error from Adagios when i go to view the performance graphs for a host.

We got an error while trying to talk with PNP4nagios: * Could not run command (return code= 1) * Error was: * Command was: php '/usr/share/nagios/html/pnp4nagios/index.php' 'json?host=Hostname' * Output was: 

Viewing the html because the rest of the error message gets cut off it tells me to check various things which I do and confirm that they are correct and then says to visit "/adagios/pnp/json" for output and i get the error below.

Environment:

Request Method: GET
Request URL: http://localdomain.com/adagios/pnp/json

Django Version: 1.3.7
Python Version: 2.6.6
Installed Applications:
['django.contrib.sites',
 'adagios.objectbrowser',
 'adagios.rest',
 'adagios.misc',
 'adagios.pnp',
 'adagios.status',
 'adagios.okconfig_',
 'adagios.pages',
 'adagios.bi']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware')

Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/adagios/pnp/views.py" in pnp
  30.     result = run_pnp(pnp_command, **request.GET)
File "/usr/lib/python2.6/site-packages/adagios/pnp/functions.py" in run_pnp
  37.     result = pynag.Utils.runCommand(command, raise_error_on_fail=True)
File "/usr/lib/python2.6/site-packages/pynag/Utils/__init__.py" in runCommand
  81.         raise PynagError(error_string)

Exception Type: PynagError at /pnp/json
Exception Value: * Could not run command (return code= 1)
* Error was:

* Command was:
php '/usr/share/nagios/html/pnp4nagios/index.php' 'json?'
* Output was:

If i view the host directly on /pnp4nagios I can see the graphs and don't receive any errors so seems like Pynag is the problem.

palli commented 10 years ago

Can you try to run this command as the nagios user:

php '/usr/share/nagios/html/pnp4nagios/index.php' 'json?'

And show me the output ?

Typical things to check are permissions and if selinux is active

Ev1l commented 10 years ago

Looks like this was a my fault. I made some changes to the php.ini that did not play nice with Adagios. Restored from backup and everything is working as expected.