Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cacti 0.8 Beginner's Guide

You're reading from   Cacti 0.8 Beginner's Guide Learn Cacti and design a robust Network Operations Center

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher Packt
ISBN-13 9781849513920
Length 348 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Thomas Urban Thomas Urban
Author Profile Icon Thomas Urban
Thomas Urban
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Cacti 0.8Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing Cacti FREE CHAPTER 2. Using Graphs to Monitor Networks and Devices 3. Creating and Using Templates 4. User Management 5. Data Management 6. Cacti Maintenance 7. Network and Server Monitoring 8. Plugin Architecture 9. Plugins 10. Threshold Monitoring with Thold 11. Enterprise Reporting 12. Cacti Automation for NOC Mobile Access / Administration Online Resources Further Information Pop Quiz Answers
Index

Time for action – creating the database


To keep it simple let's assume that you're going to host the database on the same server as Cacti.

  1. Execute the following command to logon to the MySQL CLI:

    mysql –u root mysql
    
  2. The default MySQL root account does not have a password set, so you can set one as follows:

    SET PASSWORD FOR root@localhost = PASSWORD('MyN3wpassw0rd');
    
  3. You can now also remove the example database, as it is not needed:

    DROP DATABASE test;
    
  4. Together with the example database, some example users may have been created. You can remove these with the following command:

    DELETE FROM user WHERE NOT (host = "localhost" AND user = "mydbadmin");
    
  5. On a CentOS distribution you can use the following command to guide you through the above steps:

    /usr/bin/mysql_secure_installation
    
  6. Now that MySQL is secured, let's create the Cacti database. Enter the following command:

    mysqladmin -u root -p create cacti
    

    This will ask for the MySQL root password which you provided in Setup Step 1. When finished, you will have an empty database called cacti .

  7. As the database is still empty, you need to create the tables and fill it with the initial data that comes with Cacti. The following command will do just that:

    mysql -p cacti < /var/www/html/cacti/cacti.sql
    
  8. Again it will ask for the MySQL root password. Once the command finishes you'll have a working Cacti database. Unfortunately Cacti is still unable to access it, therefore you are now going to create a database user for Cacti.

  9. Enter the following command:

    mysql -u root -p mysql
    
  10. You'll see the following on the screen:

  11. Type the next few lines in the MySQL prompt to create the user. Make sure to choose a strong password:

    GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'MyV3ryStr0ngPassword'; flush privileges; exit
    

What just happened?

You used some tools to secure the MySQL server and created a database. You also filled the Cacti database with the initial data and created a MySQL user for Cacti. However, Cacti still needs to know how to access the database, so let's move on to the next step.

In case you are not using CentOS to install Cacti, you can use some MySQL internal functions to secure your installation.

Configuring Cacti

You need to tell Cacti where to find the database and which credentials it should use to access it. This is done by editing the config.php file in the include directory.

You have been reading a chapter from
Cacti 0.8 Beginner's Guide
Published in: Mar 2011
Publisher: Packt
ISBN-13: 9781849513920
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image