search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Cacti installation on CentOS 6 on Hyper-V – Part 2
Posted in Linux Server, Virtual Machine Manager | 23 Comments | 29,530 views | 15/08/2011 01:23

First part, we installed required components for Cacti. In this part, we’ll install and configure Cacti.

After MySQL installation, first we should set MySQL root password.

1
2
mysqladmin --user=root password p@ssw0rd!
mysqladmin --user=root --password reload

Let’s download latest Cacti release.

1
2
cd /home
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz

Untar tar ball.

1
2
tar -zxvf cacti-0.8.7g.tar.gz
cd cacti-0.8.7g

Create the MySQL database for Cacti. You have to type your root password to create database.

mysqladmin --user=root create cacti --password

Import the default Cacti database.

mysql -u root -p cacti < cacti.sql

Create a MySQL username and password for Cacti for security reasons.

1
2
3
4
mysql -u root -p mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipass!';
flush privileges;
exit

Edit “include/config.php” and specify the database type, name, host, user and password for your Cacti configuration.

nano include/config.php
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cactipass!”;

Move Cacti files into /var/www/html for web access.

1
2
cd /home
mv /home/cacti-0.8.7g /var/www/html/cacti

Go into Cacti directory and set the appropriate permissions for graph/log generation.

1
2
cd /var/www/html
chown -R apache:apache cacti

Add a line to your ”/etc/crontab” file.

nano /etc/crontab
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

Disable SeLinux to web restrictions.

nano /etc/sysconfig/selinux
SELINUX=disabled

Reboot your server to apply changes. After reboot, go to php.ini configuration and change timezone.

nano /etc/php.ini
date.timezone = “Europe/Istanbul”

We finished Cacti installation. Now go to your web browser and connect to http://yourserverip/cacti.

Choose “New Install” and click next.

Correct RRDTool default path.

RRDTool Binary Path: /usr/local/rrdtool/bin/rrdtool

Now Cacti is online!

You can login to Cacti with default username and password. After your first login, you should change password.

username: admin
password: admin

Now you can start adding your graphs :)


Comments (23)

Rafael

August 15th, 2011
02:12:19

GREAT! thanks for post!


Bernie Mac

October 29th, 2011
18:26:00

Thank you! I had to install this for a server config class, this tutorial was invaluable!!


josh

November 2nd, 2011
08:49:04

Excellent. Very clear. Very accurate. Worked with CentOS 6.0. The SELINUX part seemed to require that I edit /etc/sysconfig/selinux and explicitly set it to “disabled” (followed by a reboot).


Bedro

November 9th, 2011
09:19:35

Great tutorial, except I needed to install perl-ExtUtils-MakeMaker for compailing rrdtool on CentOS 6.0. Thank you!!!


Ric Wong

November 17th, 2011
12:06:02

Thank you. Detail instruction for setup cacti in CentOS 6 and cannot found any problem.


Lamletoi

November 19th, 2011
05:36:37

I have a problem,
When i go to http://192.168.0.4/cacti it show a blank site.
My firewall, selinux was disable.


John Is

November 21st, 2011
04:33:04

I have problem during RRDtools installation in part one.
After i hit ‘make’ step after ./configure it show 2 error.
Then after i hit ‘make install’ it show (make: *** [install-recursive] Error 1) error.

After i proceed to next step to test the RRDtool ‘./stripes.pl’ its show this error:
(Can’t locate RRDs.pm in @INC (@INC contains: /opt/rrdtool-1.4.5/lib/perl
/usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./stripes.pl line 7.

BEGIN failed–compilation aborted at ./stripes.pl line 7.)

Any idea how to solve the error and due to this problem i dont have file stripes.png. It only shows stripes.pl

Really appreciate if some can share their expertise here since i’m still new in this area.

Thanks in advance :)


Robert

November 25th, 2011
22:27:42

Wow fantastic tutorial. I had a few problems with libxml2 that were fixed by installing the libxml2-devel package to compile RRDTool. Other than that it worked perfectly. Thank you for taking the time to put this together! :-)


verns

November 29th, 2011
01:43:14

hi Admin,

I got same error that John Is experienced..i’m missing the stripes.png as well and exactly the same error message.


rob

December 21st, 2011
22:21:02

Thanks for one of the best tutorials I’ve seen.


Mohammed Habeebuddin

January 20th, 2012
03:12:03

U r awesome….Thanks man i configured with in half an hour without any errors great work and great step by step procedure.


Fatih

February 9th, 2012
17:05:27

Yusuf Hocam, çok güzel olmuş ellerine sağlık..


Josh

February 18th, 2012
00:37:49

Thanks for the tutorial, but it seemed that many pieces were incomplete. For example, the make errors were because there is a PHP module that needs to be installed. After I got that installed, and did the make and make install, rrdtool was installed right there in the opt directory (did I miss something?). Also, the SNMP utils were not installed by default, and when I did install them through yum they installed to /usr/bin instead of /usr/local/bin. Overall, a great tutorial, and I was able to get everything setup with a few extra Google searches. You might run through your tutorial again though and check for completeness. Thanks!


Josh

February 18th, 2012
00:39:08

Correction to my comment. I meant to say there is a Perl module that needs to be installed to correct the make errors, not a PHP module.


spencer

February 23rd, 2012
01:21:32

I’ve gone trough this a few times and I can never seem to find the right binary paths for it to work.


admin

March 6th, 2012
21:40:36

Hello Josh and Spencer,

This is all step by step document. If you’re facing with problems, are you sure that you use same versions and modules with me? Paths and requirements may change and depends on versions you use.

I would try same procedure on CentOS 6.2 and LIS v3.2 if you use them.

Regards,

Yusuf.


Jim

March 8th, 2012
04:29:01

@Josh – Dude…how about sharing what Perl module needs to be installed?


Sercan

May 4th, 2012
07:15:27

Hi Yusuf,

Before Correct RRDTool default path. people need to run : yum install net-snmp-utils

check before running with : rpm -qa | grep net-snmp-utils

Sercan


Tomislav

May 29th, 2012
13:38:48

I would recommend you add RPMforge/EPEL repossitories and just ‘yum install cacti’.
Also, never,ever, disable SElinux, prefered way is to learn to add exeptions to it.


Steve

June 12th, 2012
17:02:52

Thanks that filled in many of the blanks to the actual cacti documentation!

I didn’t need to compile RRD, just typed yum install RRD and it worked..


Steve

June 13th, 2012
20:18:21

Also you can’t use cactiuser to run that cron job because it doesn’t exist except as a mysql user. Need to create it with proper permissions for the dirs etc or let another user with the proper permissions run it.


Lou

August 25th, 2012
20:27:13

Great walk though thanks – having issue though and I believe it is all around mysql. this is the second CentOS 6.3 machine I’ve built this week to perform this Cacti function and I’m crapping out in the same place. seems to be permissions related. I will say this much – at least I’m consistent!

Anyone have any ideas:
FATAL: Cannot connect to MySQL server on ‘localhost’. Please make sure you have specified a valid MySQL database name in ‘include/config.php


Jens Jönsson

September 24th, 2012
16:32:45

my RRDTool bin installation ends up in path /opt/rrdtool-1.4.5/bin/rrdtool
Not as stated in /usr/local/rrdtool/bin/rrdtool

How come and how to fix ?
(I’m totally Linux noob)



Leave a Reply