Apache Running on Multiple Ports and Percona Cacti Templates for Apache

For some users, running Apache on different ports is more economical than adding multiple IPs to the same server i.e. when you have several Apache servers behind a load balancer where the public IP is in front of the load balancer. If you’re thinking of using the Percona Monitoring Templates for Cacti particularly for Apache, you might be surprised at first that it only polls Apache on the default port 80. Fortunately, this is not totally impossible and is even documented. And it is quite easy to enable this.

Once you have downloaded the template package, execute the command like below and then import the resulting template as you normally would instead of the default that comes with the package. In my case, I would import templates/cacti_host_template_percona_apache_server_ht_0.8.6i-sver1.0.1-custom-port.xml.

revin@bonnie:~/Downloads/percona-monitoring-plugins-1.0.1/cacti$ ./bin/pmp-cacti-template --mpds port2 --script scripts/ss_get_by_ssh.php definitions/apache.def > templates/cacti_host_template_percona_apache_server_ht_0.8.6i-sver1.0.1-custom-port.xml

Once imported, adding a Apache graphs for your devices would now ask for the port you want to monitor. However, your graphs would still be named with the default making it difficult to determine which graphs are for port 80 and which is for port 8080 for example. To fix this, simply go to Console > Graph Templates and select one of the Percona Apache * templates. Under the graph template section, check “Use Per-Graph Value (Ignore this Value)”. The next time you add an Apache graph, it will now ask you for the port and custom title within the graphs like the one pictured below.