[HOWTO] Cacti Installation on CentOS

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
pwozney
Posts: 32
Joined: Thu Dec 16, 2004 3:14 pm

[HOWTO] Cacti Installation on CentOS

Post by pwozney »

Here are the sites that I used to get here: Server Software Installation
yum update
yum install -y mysql mysql-server httpd mod_ssl php php-snmp php-mysql net-snmp net-snmp-utils rrdtool cacti
Start MySQL and apache, and make sure they start on boot
  • service mysqld start
    service httpd start
    service sendmail start
    chkconfig httpd on --levels 235
    chkconfig mysqld on --levels 235
    chkconfig sendmail on --levels 235
If you are running SELinux, it is necessary to modify allow the webserver to use sendmail
setsebool httpd_can_sendmail on

Configuring MySQL, HTTP
/usr/bin/mysql_secure_installation
  • current root password is BLANK
    set root password to: STRONGPASSWORD1
    remove anonymous users
    disallow remote root login
    remove test database
    reload privilege tables
mysqladmin -u root -p create cacti
mysql -p cacti < /usr/share/doc/cacti-0.8.7e/cacti.sql
mysql -u root -p mysql
  • GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'STRONGPASSWORD2';
    flush privileges;
    exit
Configuring Cacti
cp /etc/cacti/db.php /etc/cacti/db.php.orig
vi /etc/cacti/db.php
  • $database_password = "STRONGPASSWORD2";
vi /etc/cron.d/cacti
  • Remove the # from the beginning of this line so it looks like this:
    */5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
vi /etc/httpd/conf.d/cacti.conf
  • #
    # Cacti: An rrd based graphing tool
    #
    Alias /cacti /usr/share/cacti

    <Directory /usr/share/cacti/>
    • Order Deny,Allow
      Deny from all
      Allow from all
    </Directory>
Installing the Plugin Architecture
Find the link for the latest PA version (plugin architecture) wget http://mirror.cactiusers.org/downloads/ ... A-v2.6.zip
unzip cacti-plugin-0.8.7e-PA-v2.6.zip
cp -r cacti-plugin-arch/files-0.8.7e/* /usr/share/cacti
mysql -p cacti < cacti-plugin-arch/pa.sql
vi /usr/share/cacti/include/global.php
  • $database_password = "STRONGPASSWORD2";
    $config['url_path'] = '/cacti/';
Installing the Plugins
wget -O realtime-0.4.0-1.tar.gz http://docs.cacti.net/_media/plugin:rea ... ache=cache wget -O settings-latest.tgz http://docs.cacti.net/_media/plugin:set ... ache=cache wget -O thold-latest.tgz http://docs.cacti.net/_media/plugin:tho ... ache=cache
cp realtime-0.4.0-1.tar.gz /usr/share/cacti/plugins
cp settings-latest.tgz /usr/share/cacti/plugins
cp thold-latest.tgz /usr/share/cacti/plugins
cd /usr/share/cacti/plugins/
tar -zxf /usr/share/cacti/plugins/realtime-0.4.0-1.tar.gz
tar -zxf /usr/share/cacti/plugins/settings-latest.tgz
tar -zxf /usr/share/cacti/plugins/thold-latest.tgz
ln -s /usr/share/cacti/plugins/settings-0.6 /usr/share/cacti/plugins/settings
ln -s /usr/share/cacti/plugins/thold-0.41 /usr/share/cacti/plugins/thold
chown -R root:root /usr/share/cacti/plugins/*
chmod -R 755 /usr/share/cacti/plugins/realtime
chmod -R 755 /usr/share/cacti/plugins/settings
chmod -R 755 /usr/share/cacti/plugins/thold
mkdir /usr/share/cacti/realtime-rrd

If you are running SELinux, it is necessary to modify the settings of realtime (more on this later).
chcon -R -t httpd_cache_t /usr/share/cacti/realtime-rrd

Final Cacti Configuration
browse to http://serverip/cacti
  • Next
    Select New Install - Next
    Finish
    Log in as admin/admin
    • change admin password to: STRONGPASSWORD3
    User Management
    • check the box to allow Plugin Management and Save
    Plugin Management
    • Install and Enable Settings
      Install and Enable Realtime
      Install and Enable Thresholds
    User Management
    • check the box to allow View Thresholds
      check the box to allow Plugin -> Realtime and Save
    Settings
    • Misc
    • Set the Cache Directory to realtime-rrd
Creating Device Graphs
Devices
  • Add a device, and specify IP and SNMP credentials
    If SNMP is successful you will see SNMP Information in the top left of the device screen
    By default it should have added the SNMP – Interface Statistics to the Associated Data. You can also verify the status of the SNMP – Interface Statistics Data Query – it should say “success” and show a bunch of items and rows. If you're really curious, you can click Verbose Query to get the raw SNMP data.
    Create Graphs for this Host
    • Under Data Query, select the interfaces you need
      Select the appropriate Graph Type
      • For 10/100 interfaces you can use In/Out bits with 95th Percentile
        For GigE interfaces you can use In/Out bits (64 bit counters)
        Currently VLAN interfaces don't report statistics properly so don't bother
    Click Create
Managing the Graph Tree
Graph Trees
  • Click Add
    • Tree Item Type – Host
      Choose the Host that you want added to the tree
Additional Templates
Cisco – CPU Usage Graph Template
Add the template to your device, and create graphs
  • Devices
    Choose your device
    Associated Graph Template
    • Add Cisco – CPU Usage
    Save
    Create Graphs for this Host
    • Under Graph Templates, select Cisco – CPU Usage
      Graph Type can be In/Out bits with 95th Percentile
    Click Create
Cisco Router Memory Usage Data Querywget http://www.eric-a-hall.com/software/cac ... 0.3.tar.gz
tar -zxf cacti-cisco-memory.0.3.tar.gz
cd cacti-cisco-memory
cp resource/cisco_memory.xml /usr/share/cacti/resource/snmp_queries/
browse to http://serverip/cacti
  • Import Templates
    Choose File template/cisco_memory_data_query.xml
    Save
Now you just need to add the template to your device, and create graphs
  • Devices
    Choose your device
    Associated Data Queries
    • Add Cisco Router – Memory Usage
    Save
    Create Graphs for this Host
    • Under the Memory Pool Data Query, select all three graphs
      Graph Type can be In/Out bits with 95th Percentile
    Click Create
Attachments
Cacti Installation - public.pdf
Here is a nicely formatted PDF.
(109.21 KiB) Downloaded 3230 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Nice job.
Netcooler
Cacti User
Posts: 127
Joined: Thu Dec 24, 2009 9:08 am

Post by Netcooler »

nicely done..

just modified a few things for my install and noting that I never found a db.php file...


other than that I am up nd running fine. Needed to do this to proof an issue I am having at work from home. Thanks - I believe running through this was a great help!
Trivian
Posts: 1
Joined: Tue Oct 18, 2011 2:52 am

Re: [HOWTO] Cacti Installation on CentOS

Post by Trivian »

Great instructions, thanks!
One thing: in the line where you wrote:
chkconfig -level 345 mysqld on
your blogging software evidently converted the regular ASCII “-” character into a high-order ASCII character 0×96, a “high-order ASCII dash”.
bluebeam123
Posts: 4
Joined: Mon Aug 04, 2014 2:17 pm

Re: [HOWTO] Cacti Installation on CentOS

Post by bluebeam123 »

Hi.

Nice job !! i do step by step and it's working. :-)
anamika
Posts: 1
Joined: Sat Sep 06, 2014 1:36 am

Re: [HOWTO] Cacti Installation on CentOS

Post by anamika »

Got it working with Cacti 0.8.7 and Mactrack 1.1 by pasting in the "get_netscreen_arp_table" part into the bottom of mactrack_functions.php.
moriteza
Posts: 1
Joined: Wed Apr 08, 2015 4:06 am

Re: [HOWTO] Cacti Installation on CentOS

Post by moriteza »

hello every one I am finish installation.
when redirect to the login page I do not see any login box.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests