# Apache monitoring problem

**URL:** <https://forums.percona.com/t/apache-monitoring-problem/2711>\
**Category:** Percona Monitoring Plugins\
**Created:** [May 25, 2013, 11:13am UTC](https://forums.percona.com/t/apache-monitoring-problem/2711 "2013-05-25T11:13:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Byun\_SungUk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/byun_sunguk/32/934_2.png) [@Byun\_SungUk](https://forums.percona.com/u/Byun_SungUk)\
**Post date:** [May 25, 2013, 11:13am UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/1 "2013-05-25T11:13:43Z")

</div>

Dear Percona,

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

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

```

returns:

> [@](#):
>
> gg:-1 gh:-1

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

```auto
# wget -U Cacti/1.0 -q -O - -T 5 "http://127.0.0.1/server-status?auto"

```

> [@](#):
>
> Total Accesses: 256  
> Total kBytes: 1719  
> CPULoad: 4.88119  
> Uptime: 404  
> ReqPerSec: .633663  
> BytesPerSec: 4357.07  
> BytesPerReq: 6876  
> BusyWorkers: 1  
> IdleWorkers: 5  
> Scoreboard: W\_\_\_\_\_… … …

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

```auto
# cat /etc/passwd

```

> [@](#):
>
> …  
> cacti:x:498:498::/usr/share/cacti:/sbin/nologin  
> …

Thank you,  
SU

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [May 26, 2013, 2:58am UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/2 "2013-05-26T02:58:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bfdonny](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@bfdonny](https://forums.percona.com/u/bfdonny)\
**Post date:** [August 26, 2013, 12:54pm UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/3 "2013-08-26T12:54:25Z")

</div>

I had the same problem as SU, and found that this line in ss\_get\_by\_ssh.php was the culprit:

```auto
$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.

---

<div class="post-metadata">

**Author:** ![skonealone](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@skonealone](https://forums.percona.com/u/skonealone)\
**Post date:** [February 10, 2015, 4:09pm UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/4 "2015-02-10T16:09:31Z")

</div>

Hi,

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 “[http://127.0.0.1:80/server-status?auto](http://127.0.0.1:80/server-status?auto)”  
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@10.120.10.163 -p 22 -i /etc/cacti/id\_rsa wget -U Cacti/1.0 -q -O - -T 5 “[http://127.0.0.1:80/server-status?auto](http://127.0.0.1:80/server-status?auto)”  
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!

thanks,  
-SK

---

<div class="post-metadata">

**Author:** ![Carlos\_Xavier](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Carlos\_Xavier](https://forums.percona.com/u/Carlos_Xavier)\
**Post date:** [May 22, 2015, 9:26pm UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/5 "2015-05-22T21:26:31Z")

</div>

Hi everybody.

I came here with the same doubt, becouse my servers do not answer to http requests at the address 127.0.0.1 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](https://www.percona.com/forums/member/21121-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:

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

```

To:

```auto
<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.

Regards,  
Carlos.

---

<div class="post-metadata">

**Author:** ![davidiGo](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@davidiGo](https://forums.percona.com/u/davidiGo)\
**Post date:** [August 26, 2015, 10:17am UTC](https://forums.percona.com/t/apache-monitoring-problem/2711/6 "2015-08-26T10:17:25Z")

</div>

Hello,

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,  
David
