SNMP Monitoring with Cacti

One of the easiest and most efficient methods of obtaining server or network statistics is to configure and install Cacti on a rpm/yum based system such as RedHat, CentOS, or FedoraCore. This post covers the basics of getting Cacti working on a RedHat or yum based system and monitoring the stats that are available on that system. I also cover the source method of installing Cacti for advance users at the bottom of the basic install/config.

Yum install method

You need to install Cacti, snmpd, httpd, php, php-mysql, php-snmp, MySQL and MySQL Server, if you have any of these installed you can omit them from the command below.

Run the command:

yum install httpd cacti net-snmp php php-mysql php-snmp mysql mysql-server

Next modify the /etc/httpd/conf.d/cacti.conf (allow from line) to allow your local network:

Allow from 192.168.0.

if that’s your network.

Restart apache:

service httpd restart

Make sure apache, mysqld, and snmpd start at boot.

chkconfig httpd on
chkconfig mysqld on
chkconfig snmpd on

Make sure that snmpd accepts public as community from localhost.

You can use the command

snmpconf -g basic_setup

to generate an snmpd.conf file.

Restart snmpd:

service snmpd restart

Yum should have setup the cacti database, if it did not then do the following:

mysqladmin create cacti
mysql cacti

Create mysql user for cacti (use a decent password, not just password):

mysql> GRANT ALL ON * . * TO 'cactiuser'@'localhost' IDENTIFIED BY 'password';

Enable the user and privileges for the user:

mysql> flush privileges;

If you are running a yum based distribution then you should be able to go to:
http://serverip/cacti

You will be presented with the Cacti Installation Guide, click Next >>

Since this is a New Install you will click Next >> again.

Be sure that the values are correct and all the fields have [FOUND] above them, if they
do not then correct them and click Finish.

The default User Name is admin, and the default Password is admin, you will be forced to change this so pick a secure password

Now you should be in the console, click Devices, click localhost, now click Create Graphs for this Host, check all the check boxes at the left in the Graph Templates, and Data Query sections then click create. Now click create again.

Now if you click the graphs and you should be able to see the start of the graphs that are being created for the local host. These will take a bit of time to populate so expect to see data in about 10 minutes.

Source Method

To install via the source method, make sure you have the following required software installed and configured:
Apache
RRDTool 1.0.49 or 1.2.x or greater
MySQL 4.1.x or 5.x or greater
PHP 4.3.6 or greater, 5.x greater highly recommended for advanced features

Yum should need to setup the cacti database, do the following:

mysqladmin create cacti
mysql cacti

Create mysql user for cacti (use a decent password, not just password):

mysql> GRANT ALL ON * . * TO 'cactiuser'@'localhost' IDENTIFIED BY 'password';

Enable the user and privileges for the user:

mysql> flush privileges;

Download cacti-xxxxx.tar.gz from sourceforge to /var/www/html or wherever your webserver DocumentRoot is located.

Untar gzip the file:

tar -zxf cacti-xxxxx.tar.gz

Rename the directory this creates

mv cacti-xxxxx cacti

Add a cacti user:

adduser -d /var/www/html/cacti cactiuser

Change the owner of the files to the user cacti:

chown -R cacti:cactiuser /var/www/html/cacti

Populate the cacti database (use your values for user and password)

mysql cacti -u cactiuser -ppassword < /var/www/html/cacti/cacti.sql

Edit the /var/www/html/cacti/include/config.php file to specify the user+password: Add the Cacti poller job as a cron job:

crontab -e

Add the following line:

*/5 * * * * cacti1 php /var/www/html/cacti1/poller.php > /dev/null 2>&1

Now you can go to http://serverip/cacti

You will be presented with the Cacti Installation Guide, click Next >>

Since this is a New Install you will click Next >> again.

Be sure that the values are correct and all the fields have [FOUND] above them, if they
do not then correct them and click Finish.

The default User Name is admin, and the default Password is admin, you will be forced to change this so pick a secure password

Now you should be in the console, click Devices, click localhost, now click Create Graphs for this Host, check all the check boxes at the left in the Graph Templates, and Data Query sections then click create. Now click create again.

Now if you click the graphs and you should be able to see the start of the graphs that are being created for the local host. These will take a bit of time to populate so expect to see data in about 10 minutes.

As always if you need further assistance with this or any other open source application or issue, the experts at Pantek Inc. are available 24/7 at info@pantek.com, 216-344-1614, and 1-877-LINUX-FIX! We look forward to working with you.

Pantek Scores Weatherhead 100 Hat-trick

Pantek has done it again. The prestigious Weatherhead 100 has recognized Pantek as one of the top regional companies for the third year running.

“We take a team approach with everything we do,” said Sales and Marketing Manager Jay Myers. “Working alongside our customers to achieve our objectives is a Win-Win for everyone.”

Based in Independence, Pantek has been providing business-class Linux and Open Sources consulting and support for over 15 years. For over 20 years the Weatherhead 100 has been recognizing Northeastern Ohio companies like Pantek who show positive growth and a proven track record for success.

“We are proud to be recognized for our growth over the past three years, especially with the current economic environment,” said Pantek President, Barry Zack. “We are committed to providing the best Linux and Open Source, consulting and support to the community and expect continued growth in the future.”