Apache monitoring problem

Dear Percona,

I encountered my cacti monitoring about apache.
other graphs (system, mysql, …) are works fine.

# sudo -u cacti php /usr/share/cacti/scripts/ss_get_by_ssh.php --type apache --host --items gg,gh


But, server-status has values. wget command returns:

# wget -U Cacti/1.0 -q -O - -T 5 ""

May cacti user need login setting and passwd for ssh connection?
sudo command asked a password.

# cat /etc/passwd

Thank you,

Apache template does not use SSH at all. But depending from vars specified it could use the different hostnames in wget command.
So cacti user does not require ssh or password and you did everything right.

Are you using the latest PMP version?

cat /usr/share/cacti/scripts/ss_get_by_ssh.php|grep version

$version = ‘1.0.3’;

If not it won’t work with ‘–items gg,gh’ as all items were renamed in 1.0.3.

I had the same problem as SU, and found that this line in ss_get_by_ssh.php was the culprit:

$status_server = 'localhost';

Since I’m trying to monitor a remote server, replacing this with the server’s IP addresses made the graphs work. This is OK for now since I’m only monitoring one server with this plugin, but could prove problematic if I setup monitoring for another server.

Seems like it would be ideal to have this added to the data source template so it could be a per-graph value.


I am having same issue. I am using $version = ‘1.1.4’; and its not creating any graph.

After manually using the command:

wget -U Cacti/1.0 -q -O - -T 5 “
Total Accesses: 19023
Total kBytes: 652953
CPULoad: .71728
Uptime: 86637
ReqPerSec: .219571
BytesPerSec: 7717.53
BytesPerReq: 35148.2
BusyWorkers: 2
IdleWorkers: 10
Scoreboard: ______WR

when I run the PHP script:

ssh -q -o “ConnectTimeout 10” -o “StrictHostKeyChecking no” cacti@ -p 22 -i /etc/cacti/id_rsa wget -U Cacti/1.0 -q -O - -T 5 “
Total Accesses: 19172
Total kBytes: 658535
CPULoad: .71785
Uptime: 86890
ReqPerSec: .220647
BytesPerSec: 7760.85
BytesPerReq: 35173.2
BusyWorkers: 1
IdleWorkers: 11
Scoreboard: W_______…

but still I do not see the graph…

Can some one help me here… .where I am doing wrong!

Appreciated your help!


Hi everybody.

I came here with the same doubt, becouse my servers do not answer to http requests at the address due to the load ballance configuration. I had do restrict the arp response to the interface it came from so as to use IPVSADM to manage the load ballancing.

As bfdonny said, if you change the variable " $status_server = ‘localhost’;", inside the script ss_get_by_ssh.php, to the IP address of the host you want to check, it will work. But this is not a good solution, since I wanted to graph more than one host.

After messing around and reading a lot, I am not a programmer, I came to the simple solution. You just need to edit the “Data Input Methods” of the templates, so as you can insert the option “–use-ssh 0” on the calling command line.

This this the example of what I did for “Percona Get Apache Stats/Apache Bytes IM”

I changed it from:

<path_php_binary> -q <path_cacti>/scripts/ss_get_by_ssh.php --host <hostname> --type apache --items gh


<path_php_binary> -q <path_cacti>/scripts/ss_get_by_ssh.php --use-ssh 0 --host <hostname> --type apache --items gh

I did the same to the remaining Data Input Methods and now all my serves are being pulled and graphed.



I’m a little late to this discussion but figured I could try and help anyone else that has this same issue. Like others have said the issue is with the localhost being hard coded in the script. When in reality it should be using the --host value supplied from the command line. I am using version 1.1.5 of the script. On line 963 inside the function apache_cmdline there is a line of code:

[PHP]$srv = $status_server;[/PHP]

This is where it is pulling the value from the top section of the script. Which is why if you change it from localhost to your server IP it works. But as Carlos pointed out it will then only work for one host. An alternative to editing every single Data Input Method, I opted to edit the script and change this line to:

[PHP]$srv = $options[‘host’];[/PHP]

This way it will pull the --host value passed in when the script is ran and will work for all your hosts.

Good luck,