Cacti complete network graphing solution Oz Melamed E&M Computing Jun 2009
About Cacti Cacti is a complete network graphing solution designed to harness the power of RRDTool's data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices. 2
Screen Shot 3
What is Cacti? Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG. 4
Data Sources To handle data gathering, you can feed cacti the paths to any external script/command along with any data that the user will need to "fill in", cacti will then gather this data in a cron-job and populate a MySQL database/the round robin archives. Data Sources can also be created, which correspond to actual data on the graph. For instance, if a user would want to graph the ping times to a host, you could create a data source utilizing a script that pings a host and returns it's value in milliseconds. 5
Data Sources After defining options for RRDTool such as how to store the data you will be able to define any additional information that the data input source requires, such as a host to ping in this case. Once a data source is created, it is automatically maintained at 5 minute intervals 6
Graphs Once one or more data sources are defined, an RRDTool graph can be created using the data. Cacti allows you to create almost any imaginable RRDTool graph using all of the standard RRDTool graph types and consolidation functions. A color selection area and automatic text padding function also aid in the creation of graphs to make the process easier. 7
Graphs Not only can you create RRDTool based graphs in cacti, but there are many ways to display them. Along with a standard "list view" and a "preview mode", which resembles the RRDTool frontend 4 all, there is a "tree view", which allows you to put graphs onto a hierarchical tree for organizational purposes. 8
User Management Due to the many functions of cacti, a user based management tool is built in so you can add users and give them rights to certain areas of cacti. This would allow someone to create some users that can change graph parameters, while others can only view graphs. Each user also maintains their own settings when it comes to viewing graphs. 9
Features - Graphs Unlimited number of graph items can be defined for each graph optionally utilizing CDEFs or data sources from within cacti. Automatic grouping of GPRINT graph items to AREA, STACK, and LINE[1-3] to allow for quick re-sequencing of graph items. Auto-Padding support to make sure graph legend text lines up. 10
Cacti Scripts Best Post - Complete List of Cacti Scripts and http://forums.cacti.net/about11020.html 11
Data Sources Data sources can be created that utilize RRDTool's "create" and "update" functions. Each data source can be used to gather local or remote data and placed on a graph. Supports RRD files with more than one data source and can use an RRD file stored anywhere on the local file system. Round robin archive (RRA) settings can be customized giving the user the ability to gather data on non-standard timespans while store varying amounts of data. 12
Installation Cacti requires that the following software : Part of RedHat Distribution : MySQL 4.1.x or 5.x or greater PHP 4.3.6 or greater A Web Server e.g. Apache or IIS Free Download: RRDTool 1.0.49 or 1.2.x or greater 13
About RRDtool RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. http://oss.oetiker.ch/rrdtool/ http://dag.wieers.com/rpm/packages/rrdtool/ 14
Required Packages RPMS httpd php php-mysql php-snmp mysql mysql-server net-snmp 15
Start httpd & mysql chkconfig httpd on chkconfig --list grep -i http httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off service httpd start servive httpd status chkconfig mysqld chkconfig --list grep -i sql mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off service mysqld start servive mysqld status 16
Configure MySQL Set a password for the root user shell> mysqladmin --user=root password somepassword shell> mysqladmin --user=root --password reload 17
Install and Configure Cacti Download software (free) Extract the distribution tarball. cd /var/www/html tar xzvf cacti-version.tar.gz mv cacti-version cacti cd cacti Create the MySQL database: mysqladmin --user=root create cacti Import the default cacti database: 18
Mysql Configuration shell>mysql -u root -ppassword mysql>show databases; mysql>use cacti; mysql>show tables; shell>cat cacti.sql mysql -u root -ppassword -D cacti mysql>grant ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'password'; mysql>flush privileges; 19
Configure php Edit include/config.php and specify the database type, name, host, user and password for your Cacti configuration. $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cacti"; 20
Crontab Add a line to your /etc/crontab file similar to: */5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>& 1 Point your web browser to: http://your-server/cacti/ Log in the with a username/password of admin. You will be required to change this password immediately. 21
Add new graph http://www.cacti.net/downloads/docs/html/how_to.html The minimal steps to create a graph from a script are simply: Create a Data Input Method to tell Cacti how to call the script and what to expect from it. Create a Data Source to tell cacti how and where the data will be stored. Create a Graph to tell cacti how the data will be presented in graph form. Add Graph to Graph View so you can view the graph. View the Graph 22
23
תודה 24