Cacti name-based virtual host for Apache

29 Jan

I wanted to monitor my networking gear using Cacti. Below is my Apache httpd.conf to use name-based virtual hosting.
CentOS / RHEL:

sudo nano /etc/httpd/conf/httpd.conf (needed to uncomment the following line)

NameVirtualHost *:80

sudo nano /etc/httpd/conf.d/cacti.conf (add the virtual host lines around the existing Directory ones..and change to your network address subnet)

<VirtualHost *:80>

ServerAdmin noc@mydomain.com
DocumentRoot /usr/share/cacti
ServerName traffic.mydomain.com

<Directory /usr/share/cacti/>
Order Deny,Allow
Allow from 192.168.1.0/24
</Directory>

LogLevel warn
ErrorLog logs/traffic.mydomain.com-error_log
CustomLog logs/traffic.mydomain.com-access_log combined

</VirtualHost>

To make the changes take effect: sudo /sbin/service httpd reload

To make sure the httpd service restarts at boot: sudo /sbin/chkconfig httpd on

Also don’t forget to turn on the Cacti cronjob that polls the devices,use sudo nano /etc/cron.d/cacti and uncomment the following line:  */5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

To get a better understanding on DNS issues and Apache read: HERE

One thought on “Cacti name-based virtual host for Apache

Leave a Reply

Your email address will not be published. Required fields are marked *