Cacti

Install cacti software and packages included with it

yum -y install cacti mysql-server

Start MySQL database

/etc/init.d/mysql start

Set mysql root password it will be motorrobot in this case

/usr/bin/mysqladmin -u root password 'motorrobot'

Create cacti database, user and password

echo "create database cacti;" | mysql -uroot -pmotorrobot
echo "grant all on cacti.* to cacti@localhost identified by 'cactipassword';" | mysql -uroot -pmotorrobot
echo "flush privileges;" | mysql -uroot -pmotorrobot

Create cacti database from included sql file in yum rpm install

mysql -uroot -pmotorrobot cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql

Put mysql db info into cacti conf

vi /usr/share/cacti/include/config.php

Change the following lines to your conf

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipassword";
$database_port = "3306";
$database_ssl = false;

Edit apache conf
Tell apache to let you access cacti from anywhere on the network

vi /etc/httpd/conf.d/cacti.conf

Comment out Deny from All, and change All from localhost to All

#               Deny from all
                Allow from all     

Reload apache to have changes take affect

/etc/init.d/httpd reload

Finish install via browser
Navigate to http://192.168.7.2/cacti (192.168.7.2 is the IP address of my cacti server, you can also use the hostname if resolves in dns of host file)

Cacti Initial install license agreement
centos cacti install license agreement acceptance

Click next if you agree to this

Install type

Keep new install selected from the drop down and click next

Path information
This info should all be correct, but verify and click Finish.

This will bring you to the login screen.

Login for the first time
The username and password will be admin/admin.

Force change password
This screen will pop up and force you to change your password from “admin”

Cacti dashboard
You’re not logged into cacti, however none of the graphs will be populated, so we need to setup the cronjob for that.

Edit cacti cronjob
The rpm package yum installed created the cronjob, we just need to uncomment it and your graphs will begin populating.

vi /etc/cron.d/cacti

Uncommented the file will look like this.

*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Wait to let the data begin to populate
The data will now be populated when the cronjob runs which is every 5 minutes, so while that is beginning to populate lets configure the local server to get some data about it. If you want to force this to run, you will need to edit /etc/passwd and give the cacti user a shell like /bin/bash instead of /sbin/nologin. Then su – cacti and run the above script as cacti, then leave and put your /etc/passwd back. I prefer to just wait the 5 mins. If you run the command as root, the rrd files will be created as root not cacti, and cacti will not be able to update them. So in that case you’d need to chown cacti the files.

Configure Localhost

Click “Devices” on the left hand side navigation on the cacti dashboard

Click “Localhost” from the devices list.

Change “Downed device detection” from “Ping” to “Ping and SNMP uptime”

Click “Save” in the bottom right hand corner

Click “Create graphs” in the top right hand portion

Click the checkbox at the top labeled Graph Template Name to highlight all graphs

Click “Create” in the bottom right hand corner to create the graphs

View graphs for localhost
Once we’ve waited and the graphs start to populate, you can click “Graphs” at the top of the dashboard page, and click “localhost” on the left hand side. You will see the graphs and they will look like this.

PHP Timezone Warning
If you get a timezone warning when manually running cmd.php that looks like this.

PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in/usr/share/cacti/include/global_arrays.php on line 675

You can fix it by setting the timezone in /etc/php.ini

date.timezone =America/New_York
(Comments)

Comments