[Resolved] rrdgraph authorization error

Status
Not open for further replies.
#1
Hello,

I installed rrdgraph as per the instructions here (https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:rrd-graph-monitoring) but experience authorization issues when running the cron.

This is what I see when I manually run 'ls_stats/update.php'

Code:
#!/usr/bin/php
Working on cpu
    Updating RRD-file
Working on load
    Updating RRD-file
Working on memory
    Updating RRD-file
Working on lsws_stats

Warning: file_get_contents(http://localhost:7080/status?rpt=summary): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized
 in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 80

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 265

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 267

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 268

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 270

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 271

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 272

Notice: Trying to get property of non-object in /home/[my_cpanel_user]/public_html/ls_stats/sources/lsws_stats.php on line 273
    Updating RRD-file
I went into 'ls_stats/sources/lsws_stats.php' and changed line 80 from

Code:
$content = file_get_contents('http://localhost:7080/status?rpt=summary');
to
Code:
$content = file_get_contents('http://username:password@localhost:7080/status?rpt=summary');
(using my LiteSpeed WebAdmin Console username/password)

but it didn't help either.

When I curl the above URL manually, I get the following:
Code:
# curl -I http://localhost:7080/status?rpt=summary
HTTP/1.1 401 Unauthorized
Date: Tue, 26 Jul 2016 11:27:37 GMT
Accept-Ranges: bytes
Server: LiteSpeed
WWW-Authenticate: Basic realm="StatusAccess"
Connection: Keep-Alive
Is there any other setting I need to enable in LiteSpeed, for rrdgraph to operate?

Best regards,
George T.
 
L

Long

Guest
#2
Hi,

It's a warning. Shouldn't affect the usage.
You can try to view the rrd graph: http://virtual-host-domain/ls_stats/index.php

Regards,
Long
 
Last edited by a moderator:
L

Long

Guest
#3
Further update:

Please change ownership of this file to lsadm:nobody : /usr/local/lsws/admin/htpasswds/status
and permission to 0640.

Plus your modification of the line 80 code to add user: password.

This should fix the warning.

Long
 
#4
Further update:

Please change ownership of this file to lsadm:nobody : /usr/local/lsws/admin/htpasswds/status
and permission to 0640.

Plus your modification of the line 80 code to add user: password.

This should fix the warning.

Long
Thank you, this fixed the issue. I also had to disable cagefs on the cpanel user I used for rrdgraph, because of a shared library error - now graphs are being generated correctly.
 

NiteWave

Administrator
#6
I confirmed the solution as well.
Code:
#curl -I http://localhost:7080/status?rpt=summary
HTTP/1.1 401 Unauthorized

#curl -I http://username:password@localhost:7080/status?rpt=summary
HTTP/1.1 200 OK
username / password need put into /usr/local/lsws/admin/htpasswds/status
1) can have multiple username / password pairs in this file, one pair one line
2) password can be encrypted by apache's utility htpasswd (https://httpd.apache.org/docs/current/programs/htpasswd.html)

the issue is started from 5.0.19 after adding authentication for "localhost:7080/status?"
before this version no authentication required.
 
Last edited by a moderator:
Status
Not open for further replies.
Top