Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php error : Call to a member function count() on a non-object in graph.php on line 1176 #343

Open
adriansev opened this issue Mar 22, 2019 · 16 comments

Comments

@adriansev
Copy link
Contributor

Hi! I am trying to export to json a graphic and i get a 500 httpd error and this error message in logs:
PHP Fatal error: Call to a member function count() on a non-object in /var/www/html/ganglia/graph.php on line 1176
Does anyone have any idea about this?
Thank you!!!

@vvuksan
Copy link
Member

vvuksan commented Mar 22, 2019

Can you try and update to the latest version and retry. Not really sure what version you are running.

@adriansev
Copy link
Contributor Author

sorry, i forgot to add, i am on master

@adriansev
Copy link
Contributor Author

sorry, my mistake, i'm a few commit behind .. i will update my gweb and update the issue asap

@adriansev
Copy link
Contributor Author

@vvuksan so, i can confirm that i am on master, with all php copied again to /ganglia .. the errors are:
ssl_access_log
XXX.XXX.XXX.XXX - - [22/Mar/2019:23:40:39 +0200] "GET /ganglia/graph.php?h=monitor.spacescience.ro&c=Misc&r=6hr&g=cpu_report&json=1 HTTP/1.1" 500 -
ssl_error_log
[Fri Mar 22 23:40:39.394219 2019] [:error] [pid 26862] [client XXX.XXX.XXX.XXX:34174] PHP Fatal error: Call to a member function count() on a non-object in /var/www/html/ganglia/graph.php on line 1164, referer: https://monitor.spacescience.ro/ganglia/?c=Misc&h=monitor.spacescience.ro&m=cpu_report&r=6hr&s=by%20name&hc=4&mc=3
ssl_request_log
[22/Mar/2019:23:40:39 +0200] 188.25.254.132 TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 "GET /ganglia/graph.php?h=monitor.spacescience.ro&c=Misc&r=6hr&g=cpu_report&json=1 HTTP/1.1" -

Thank you!!

@kevallakhani
Copy link

kevallakhani commented Oct 7, 2020

@vvuksan @adriansev did you figure out how to fix the issue with calling count on null? I am facing the same issue now with rrdtool v1.7 and gweb v3.7.4.

apache2 error.log:
PHP Fatal error: Uncaught Error: Call to a member function count() on null in /usr/share/ganglia-webfrontend/graph.php:1164\nStack trace:\n#0 /usr/share/ganglia-webfrontend/graph.php(1681): output_data_to_external_format(' DEF:'a0'='/var...', '-14400s', 'now', 'Aggregate softi...', '/usr/bin/rrdtoo...', NULL, NULL, 1, NULL, NULL, NULL, ' --daemon /tmp/...')\n#1 {main}\n thrown in /usr/share/ganglia-webfrontend/graph.php on line 1164

Thanks for your help!

@vvuksan-fastly
Copy link

The best thing to do is run the URL that was being invoked with

&debug=5

It should give you the RRDtool command that is being run. Then execute that on the command line.

@kevallakhani
Copy link

@vvuksan Thanks for your prompt reply :) do we need to switch on the debugger in the config somewhere? running the url with &debug=5 still results in internal server error with the same error message about calling count on null at line 1164.

@vvuksan-fastly
Copy link

It looks like you may need to just edit graph.php #343 (comment) and add e.g.

error_log($command);

then find out what exact command is being executed.

@kevallakhani
Copy link

kevallakhani commented Oct 8, 2020

@vvuksan Thanks for that. I tried to extract the command and run it on cmd line to see the output - but I am not sure if it is expected output as well. Btw, I do see this error message in the cmd line output for the xport tool cmd -
ERROR: ',' is not a valid function name in , hide-hf=false: command not found
among other output that is followed by the status Done and one with status Exit 1

I am not sure if that helps, but I also see another error log in apache2 which says ERROR: Unable to connect to rrdcached: No such file or directory and I am currently running ubuntu18.

Let me know if it doesn't help explain the issue.

@kevallakhani
Copy link

A little more looking into it gives an idea that it is probably because of rrdcached is not found because of which the $xml->data is empty which results into the count failing. any ideas about fixing the rrdcached not found issue? Thanks in advance.

@vvuksan
Copy link
Member

vvuksan commented Oct 8, 2020

Do you have this configured in conf.php

$conf['rrdcached_socket'] = "";

?

@kevallakhani
Copy link

@vvuksan Yes it is set to $conf['rrdcached_socket'] = '/tmp/rrdcached.limited.sock'; and the file exists in the tmp directory.

@vvuksan-fastly
Copy link

Based on the error rrdcached is either not running or there is a mismatch between the socket permissions. You should check the gmetad rrdcached settings and ganglia web settings.

@kevallakhani
Copy link

One of the files - /tmp/rrdcached.sock that changed to root owner because of which gmetad stopped working briefly, but even after changing it back to nobody:nogroup it still complains about the same. All other files have the correct owner. Although, the issue with gmetad was no longer there and we could get the data flushed from rrdcached.

@kevallakhani
Copy link

kevallakhani commented Oct 13, 2020

@vvuksan so when it runs the rrdtool xport command in graph.php any idea what user and group it runs it as? is it www-data? or as ganglia user? It mostly seems like this is a permissions issue because of which it cannot access rrdcached
I changed the rrdcached command to include FETCH and now I get the rrdtool export output on my command line but when it runs through the ganglia-web request (graph.php) it gives rrdcached: no such file or directory. I think it is some form of user permissions issue on the rrdcached.

@kevallakhani
Copy link

@vvuksan Remove the rrdcached_socket from conf.php config and everything works fine are there any tradeoffs to consider in this case?
I still have rrdcached flushing data to /var/lib/ganglia/rrds just that the ganglia-web is now not using rrdcached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants