By the way, here is the difference between original stacked.php and the version
that works finally. Hopefully, the next person who meets with this problem in
future can find a simple solution like this.
Thanks.
Zhongdong
[root@leopet ganglia]# diff stacked.php.orig stacked.php
18c18
< escapeshellcmd(htmlentities($_REQUEST["cs"])) : NULL;
---
> sanitize(htmlentities($_REQUEST["cs"])) : NULL;
21c21
< escapeshellcmd(htmlentities($_REQUEST["ce"])) : NULL;
---
> sanitize(htmlentities($_REQUEST["ce"])) : NULL;
30c30
< $command .= "TZ='" . $_SESSION['tz'] . "' ";
---
> $command .= "TZ='" . sanitize($_SESSION['tz']) . "' ";
33,34c33,34
< $command .= " --start '${start}'";
< $command .= " --end '${end}'";
---
> $command .= " --start '" . sanitize(${start}) . "'";
> $command .= " --end '" . sanitize(${end}) . "'";
40c40
< $command .= " --title " . escapeshellarg($title);
---
> $command .= " --title '" . sanitize($title) . "'";
43c43
< $command .= " --upper-limit " . escapeshellarg($_GET[x]);
---
> $command .= " --upper-limit " . sanitize($_GET[x]);
46c46
< $command .= " --lower-limit " . escapeshellarg($_GET[n]);
---
> $command .= " --lower-limit " . sanitize($_GET[n]);
56c56
< $command .= " --vertical-label " . escapeshellarg($_GET['vl']);
---
> $command .= " --vertical-label " . sanitize($_GET['vl']);
120d119
< $command = sanitize($command);
From: Sun, Zhongdong
Sent: Friday, February 16, 2024 7:49 PM
To: 'Vladimir Vuksan' <[email protected]>; [email protected]
Subject: RE: [Ganglia-general] stacked graph not working
Hi Vladimir,
I think I figured it out, which was still the single quote issue.
I read again old threads in 2021 when you helped Janet. At that time, you
provided a solution here
https://github.com/ganglia/ganglia-web/commit/14e657ac8e63012309b25307478b562a348175ee
Originally, I tried this solution but it didn't work in Rocky 8.4. After
discussing this issue with you, I have more knowledge on how the stack.php
works and how to debug. This solution actually fixed the single quote issue for
the start and end time, but it missed quote for the title. So I put the quote
back around the title. After it, everything work well. Now the stacked graph
finally shows up. I believe this problem exists in all versions of Rocky OS or
Redhat 8.x. I tested it in several machines and all had the same issue. And
this simple solution fixed the issue in all machines.
Thank you very much for your time and helps in this matter. I really appreciate
that.
Zhongdong
From: Sun, Zhongdong <[email protected]<mailto:[email protected]>>
Sent: Friday, February 16, 2024 11:28 AM
To: Vladimir Vuksan <[email protected]<mailto:[email protected]>>
Subject: RE: [Ganglia-general] stacked graph not working
Hi Vladimir,
I can comment out this line and look at the /tmp folder. There are many
ganglia-graph files in PNG format. I can read the files which show some
pictures in the normal ganglia-webpage, such as CPU, memory, load, network and
individual nodes. However, I cannot find a picture showing the stacked graph.
There is one file with zero KB in size. Probably it's the missing stacked
graph. This hints the stacked graph is possibly never produced correctly. Any
advices for this?
Thanks.
Zhongdong
From: Vladimir Vuksan <[email protected]<mailto:[email protected]>>
Sent: Thursday, February 15, 2024 11:29 PM
To: Sun, Zhongdong <[email protected]<mailto:[email protected]>>;
[email protected]<mailto:[email protected]>
Subject: Re: [Ganglia-general] stacked graph not working
Indeed htmlspecialchars will do that however it's not used in stacked.php at
least not in the Github repo. You could try and comment out this line
https://github.com/ganglia/ganglia-web/blob/master/functions.php#L1416
Then look in /tmp for a ganglia-graph file with full invocation to make sure
that output is somehow not getting encoded.
Vladimir
On 2/15/24 16:08, Sun, Zhongdong wrote:
Hi Vladimir,
Thanks for your quick response.
As I understand, the apostrophe or single quote will be converted to ' with
the PHP function htmlspecialchars because it's considered as a special
character. See this: PHP: htmlspecialchars -
Manual<https://www.php.net/htmlspecialchars>. Later, we can convert it back
with function htmlspecialchars_decode if needed. I search the folder
/usr/share/ganglia and find a lot of instances of htmlspecialchars but don't
know which one cause this problem. I'm not familiar with Ganglia and don't know
how to debug further. This seems to happen in many Rocky 8.4 machines, all are
fresh installed. The ganglia-web version is 3.7.5-40. Could you please provide
more advice how to debug this?
Thanks.
Zhongdong
From: Vladimir Vuksan <[email protected]><mailto:[email protected]>
Sent: Thursday, February 15, 2024 10:56 AM
To:
[email protected]<mailto:[email protected]>
Subject: Re: [Ganglia-general] stacked graph not working
It looks like a command line arguments encoding issue somewhere around here
https://github.com/ganglia/ganglia-web/blob/master/functions.php#L1410
Not sure why apostrophe is being replaced with '. That's breaking the
rrdtool invocation. You will need to investigate how to change that behavior.
Vladimir
On 2/14/24 12:19, Sun, Zhongdong wrote:
Hi everyone,
We just installed a new instance of Ganglia on Rocky OS 8.4. Everything works
well except the stacked graph doesn't show up. I searched this forum and found
a few similar cases. For example, Janet reported this issue in 2021, but in a
CentOS 7 system. Vladimir provided some solution but didn't work in Rocky 8
system. I also following some instructions for debug. Copied the address of the
stacked graph and appended '&debug=5', which produced a command like this.
/usr/bin/rrdtool graph - -E --start \&\#039\;-3600s\&\#039\; --end
\&\#039\;N\&\#039\; --width 700 --height 300 --title \&\#039\; aggregated
load_one last hour\&\#039\; --upper-limit \&\#039\;0\&\#039\; --lower-limit
\&\#039\;0\&\#039\; CDEF:total=0 CDEF:mean=total,0,/
CDEF:last_total=total,POP,0 CDEF:last_mean=last_total,0,/ COMMENT:'\j'
GPRINT:'total':AVERAGE:'Avg Total\: %5.2lf' GPRINT:'last_total':LAST:'Current
Total\: %5.2lf\c' GPRINT:'mean':AVERAGE:'Avg Average\: %5.2lf'
GPRINT:'last_mean':AVERAGE:'Current Average\: %5.2lf\c'
When I ran this command in the machine, I got this result.
ERROR: start time: unparsable time: &'-3600s'
Does anyone know what can cause this? It seems a bug in stacked.php or relative
program, but I'm not familiar with this and cannot figure it out.
By the way, we have been using Ganglia for a long time. It works perfectly in
CentOS 7. But we have to upgrade CentOS 7 since it's near end-of-life.
Any help would be appreciated.
Zhongdong
_______________________________________________
Ganglia-general mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/ganglia-general
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general