Cacti 0.8 Beginner's Guide - Thomas Urban - E-Book

Cacti 0.8 Beginner's Guide E-Book

Thomas Urban

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Cacti is a performance measurement tool that provides easy methods and functions for gathering and graphing system data. You can use Cacti to develop a robust event management system that can alert on just about anything you would like it to. But to do that, you need to gain a solid understanding of the basics of Cacti, its plugin architecture, and automation concepts.

Cacti 0.8 Beginner's Guide will introduce you to the wide variety of features of Cacti and will guide you on how to use them for maximum effectiveness. Advanced topics like the plugin architecture and Cacti automation using the command-line interface will help you build a professional performance measurement system.Designed as a beginner's guide, the book starts off with the basics of installing and using Cacti, and also covers the advanced topics that will show you how to customize and extend the core Cacti functionalities. The book offers essential tutorials for creating advanced graphs and using plugins to create enterprise-class reports to show your customers and colleagues.

From data templates to input methods and plugin installation to creating your own customized plugins, this book provides you with a rich selection of step-by-step instructions to reach your goals. It covers all you need to know to implement professional performance measurement techniques with Cacti and ways to fully customize Cacti to fit your needs.

By the end of the book, you will be able to implement and extend Cacti to monitor, display, and report the performance of your network exactly the way you want.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 344

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cacti 0.8Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What is Cacti?
System architecture of Cacti
Cacti is more than performance measurement
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action – heading
What just happened?
Pop quiz – heading
Have a go hero – heading
Reader feedback
Customer support
Errata
Piracy
Questions
1. Installing Cacti
Preparing the system—basic prerequisites
Web server
PHP
MySQL database
NET-SNMP package
Installing Cacti on a CentOS 5 system
Preparing the system
Time for action – installing the missing packages
What just happened?
Downloading and extracting Cacti
Time for action – downloading Cacti
What just happened?
Creating the database
Time for action – creating the database
What just happened?
Configuring Cacti
Time for action – configuring Cacti
What just happened?
Creating the poller cron entry and Cacti's system user
Time for action – creating the poller's cron entry and Cacti's system account
What just happened?
Installing the Spine poller
Time for action – installing Spine
What just happened?
Differences between source and APT/Yum installations
Have a go hero – remote server for database hosting
Installing Cacti on a Windows system
The community-built Windows Installer
Time for action – starting the Windows setup
What just happened?
Installing the Spine poller under Windows
Upgrading Cacti
Time for action – upgrading Cacti
What just happened?
Using Cacti for the first time
Time for action – configuring Cacti
What just happened?
The Cacti web interface explained
The Console tab
Create section
Management section
Collection methods section
Templates section
Import/export section
Configuration section
Utilities section
The Graphs tab
Before we continue
Pop quiz – a few questions about Chapter 1
Summary
2. Using Graphs to Monitor Networks and Devices
An introduction to Cacti graphs and the RRDtool
Creating graphs with the RRDtool
Basic RRDtool graph creation
Advanced RRDtool graph creation
Adding a label and title to the graph
Adding a legend to the graph
Adding a threshold line to the graph
Adding threshold breaches to the graph
Further reading
Have a go hero – creating a yellow warning area
Adding devices to Cacti
Creating a device
Time for action – creating a new device in Cacti
What just happened?
Selecting host templates for the device
Time for action – adding a host template to the device
What just happened?
Adding graphs to the device
Time for action – adding graphs to the device
What just happened?
Adding interface graphs to a device
Time for action – adding interface graphs to a device
What just happened?
Adding devices to the Cacti tree
Creating a tree
Time for action – creating a Cacti tree
What just happened?
Sub-tree items
Time for action – adding a sub-tree
What just happened?
Adding a device to the tree
Time for action – adding a device to the Cacti tree
What just happened?
Before we continue
Pop quiz – a few questions about Chapter 2
Summary
3. Creating and Using Templates
An introduction to templates
Data templates
Data input methods
Graph templates
Host templates
Data queries
Defining a data template
Time for action – defining a data template
What just happened?
Have a go hero – template for currently established TCP connections
Defining a graph template
CDEF definition
Time for action – defining a CDEF in Cacti
What just happened?
Defining the graph template
Time for action – defining the graph template
What just happened?
Adding the threshold line
Time for action – defining a graph template
What just happened?
Adding the green, yellow, and red areas
Time for action – adding the color areas
What just happened?
Adding a legend to the graph
Time for action – adding a legend
What just happened?
Back to basics—rrdtool graph command
Defining a host template
Time for action – defining a host template
What just happened?
Assigning a host template to a device
Importing/exporting templates
Importing templates
Time for action – importing a template
What just happened?
Exporting templates
Time for action – exporting a template
What just happened?
The template repository
Before we continue
Pop quiz – a few questions about Chapter 3
Summary
4. User Management
An introduction to Cacti user management
Users
Groups
Permissions
Creating a user
Time for action – creating the first Cacti user
What just happened?
General user settings
Graph Options
Authentication Realm
Realm and graph permissions
Realm permissions
Management permissions
Collection methods permissions
Template permissions
Import/export permissions
Configuration permissions
Utilities permissions
Time for action – setting realm permissions
What just happened?
Graph permissions
Time for action – setting graph permissions
What just happened?
Graph settings
The template user
Time for action – installing the missing packages
What just happened?
Copying permissions – the Batch Copy mode
Time for action – the Batch Copy
What just happened?
Integrate LDAP/Active Directory authentication
External user management
Time for action – setting up Active Directory authentication
What just happened?
Managing users with the Cacti CLI
Importing a list of users
Time for action – importing users from the CLI
What just happened?
Input validation
Check the existence of the template user
Reading the import file
Before we continue
Pop quiz – a few questions about Chapter 4
Summary
5. Data Management
An introduction to Cacti data management
Data input methods
Data queries
Creating data input methods
Preparation—creating the script
Gathering the data
Preparing the data for output
Installation of the script
Time for action – creating a data input method – Step 1
What just happened?
Time for action – creating a data input method – Step 2
What just happened?
The data template
Creating data queries
Building the XML data file
XML header
XML input
XML output
Installing the XML file
Creating the data query within Cacti
Time for action – creating a data query – Step 1
What just happened?
Time for action – creating a data query – Step 2
What just happened?
Create a remote SSH data input method
Preparation
The remote script
The local script
Input variables
The SSH command execution
Preparing the data
SSH public key authentication
Time for action – create SSH keys with PuTTY Key Generator
What just happened?
Creating the data input method
Time for action – creating the data input method
What just happened?
Creating the data template
Creating the graph template
Adding the graph to the device
Alternative methods
Have a go hero – remote command execution using SNMP
Before we continue
Pop quiz – a few questions about Chapter 5
Summary
6. Cacti Maintenance
An introduction to Cacti maintenance
Database
RRD files
The Cacti directory structure
docs
include
install
log
resource
rra
scripts
Backup and restore procedures
The MySQL database
Time for action – backup your Cacti database
What just happened?
Enhancing the database backup
Automatic file naming
Removing old backup files
The database backup
Compressing the backup
The whole script
The Cacti files
Building the backup file list
Time for action – backup your Cacti files
What just happened?
Enhancing the database backup script
Time for action – enhancing the backup script
What just happened?
Creating the cronjob—automating the backup
Time for action – creating a cronjob
What just happened?
Restoring from a backup
Restoring the Cacti database
Time for action – restoring the Cacti database
What just happened?
Restoring the Cacti files
Restoring all Cacti files
Time for action – restoring all Cacti files
What just happened?
Restoring a single file from the backup
Time for action – restoring the Cacti config.php file
What just happened?
Log file management
Time for action – configuring Logrotate
What just happened?
Cacti maintenance
List RRD files with no associated host
Time for action – finding orphaned RRD files
What just happened?
Automating the orphaned RRD file check
A short overview of the Cacti CLI functionality
Repairing templates
Repairing the database
Pop Quiz – a few questions about Chapter 6
Summary
7. Network and Server Monitoring
An introduction to network and server monitoring
Network devices
VMware ESX
Linux server
Windows WMI monitoring
Monitoring a network device
Configuring SNMP access on a Cisco switch
Time for action – set up SNMP on Cisco devices
What just happened?
Adding Cisco switch to Cacti
Time for action – adding a Cisco switch to Cacti
What just happened?
Configuring SNMP access on a Cisco PIX firewall
Time for action – set up SNMP access on Cisco PIX
What just happened?
Adding Cisco PIX Firewall to Cacti
Time for action – adding a Cisco PIX Firewall to Cacti
What just happened?
Monitoring VMware ESX servers
Set up SNMP access for VMware ESXi 4
Time for action – set up SNMP access on an ESXi 4 server
What just happened?
Set up SNMP access to VMware ESX 3.5
Time for action – set up SNMP access on an ESX 3.5 server
What just happened?
Adding VMware ESX servers to Cacti
Time for action – adding a VMware ESX host to Cacti
Windows monitoring
Windows SNMP setup
Time for action – enabling the SNMP server feature
What just happened?
Configuration of the Windows SNMP service
Time for action – configuring the Windows SNMP service
What just happened?
WMI setup
Time for action – setting up a Windows WMI user
What just happened?
Installing the CactiWMI add-on
Installing the wmi.php Cacti interface
Time for action – installing the CactiWMI add-on – Part 1
What just happened?
Installing the wmic command
Time for action – installing the CactiWMI add-on – Part 2
What just happened?
Performance measurement with CactiWMI
Time for action – performance measurement with CactiWMI
What just happened?
Pop quiz – a few questions about Chapter 7
Summary
8. Plugin Architecture
Introduction to the Plugin Architecture
Why plugins?
Plugin features
Common plugins
MAC Track plugin
Network WeatherMap
Thold
Installing the Plugin Architecture
Time for action – installing the Plugin Architecture
What just happened?
Upgrading the Plugin Architecture
Time for action – upgrading the Plugin Architecture
What just happened?
Configuring the Plugin Architecture
Time for action – configuring the Plugin Architecture
What just happened?
Downloading and installing plugins
PIA directory structure
Pre-PIA 2.x plugins
PIA 2.x plugins
The plugin repository
The settings plugin
Time for action – installing the settings plugin
What just happened?
Removing a plugin
Time for action – removing the settings plugin
What just happened?
Updating a plugin
Adding plugin permissions
Pop Quiz – a few questions about Chapter 8
Summary
9. Plugins
Plugin design
Plugin hooks
Plugin settings
The ntop_config_settings function
Display plugin data within Cacti
The ntop_show_tab function
Commonly used plugins
The settings plugin
Functionality
The superlinks plugin
Functionality
Installation
Configuration and usage
Time for action – adding an external page to Cacti
What just happened?
Creating a new plugin
File structure
Concept and design
PIA hooks
The tree_after hook
The draw_navigation_text hook
The config_arrays hook
The config_settings hook
The config_form hook
The api_device_save hook
The plugin setup
The plugin_cbEnhancedInfo_install function
Time for action – adding the realm permission functions
What just happened?
The cbEnhancedInfo_draw_navigation_text function
The cbEnhancedInfo_config_form function
The cbEnhancedInfo_api_device_save function
The cbEnhancedInfo_setup_table_new function
Time for action – adding additional fields to the host table
What just happened?
The cbEnhancedInfo_config_settings function
The cbEnhancedInfo_config_arrays function
Data presentation
Retrieve data from the database
Time for action – retrieve data from the database
What just happened?
Presenting data on the tree view page
Time for action – presenting data on the tree view page
What just happened?
Creating the table list web page
The action section
Time for action – deleting data
What just happened?
The data retrieval section
Time for action – sorting and retrieving data
What just happened?
The data presentation section
Time for action – presenting the data
What just happened?
Creating the add items form
The form_display function
The data retrieval section
The data presentation section
The form_save function
Time for action – retrieving data from the form post
What just happened?
Time for action – creating a new database item
What just happened?
Time for action – updating an existing item
What just happened?
Installing the plugin
Publishing
Pop Quiz – a few questions about Chapter 9
Summary
10. Threshold Monitoring with Thold
Threshold monitoring
Thold
Installing Thold
Downloading and installing Thold
Time for action – installing Thold
What just happened?
Configuring Thold
General options
Default Alerting Options
Default Emailing Options
Default Baseline Options
Using Thold
Assigning permissions and setting up an e-mail address
Time for action – give permission to a user
What just happened?
Creating a threshold
Time for action – creating your first threshold – Part 1
The threshold creation page
Basic and mandatory settings section
Threshold setup section
Alert setup section
What just happened?
Time for action – creating your first threshold – Part 2
What just happened?
Testing the threshold
Time for action – installing the stress tool
Viewing threshold breaches
Time for action – viewing breached thresholds
What just happened?
Creating threshold templates
Time for action – creating your first threshold template
What just happened?
Assigning threshold templates
Time for action – assigning a threshold template
What just happened?
Pop Quiz – A few questions about Chapter 10
Summary
11. Enterprise Reporting
Overview of Nectar and CereusReporting
Nectar
CereusReporting
Nectar
Time for action – installing Nectar
What just happened?
Report generation
Time for action – create your first Nectar report
What just happened?
Time for action – adding report items
What just happened?
CereusReporting
Installation
Time for action – installing CereusReporting
What just happened?
Plugin configuration
Time for action – configure CereusReporting
What just happened?
Report generation
On-demand report generation
Time for action – creating an on-demand report
What just happened?
Pre-defined report generation
Time for action – creating a pre-defined report
What just happened?
Scheduling a report
Time for action – scheduling a pre-defined report
What just happened?
Report Backup and Restore
Time for action – Backup and Restore a pre-defined report
What just happened?
Report scheduling and polling performance
Time for action – setup of a cron-based report generation
What just happened?
Advanced reporting features of CereusReporting
mPDF Report Engine
DSSTATS Reports
Availability reports
Smokeping reports
Mobile client support
Report templates
Pop Quiz – a few questions about Chapter 11
Summary
12. Cacti Automation for NOC
Overview of Cacti automation
The Cacti CLI
Users
Permissions
Trees
Devices
Graphs
Overview of Autom8
Trees
Graphs
Using the Cacti CLI
Adding permissions
Time for action – adding permissions to a user
What just happened?
Adding a Cacti tree
Time for action – adding a Cacti tree
What just happened?
Adding a device
Time for action – adding a single device to Cacti
What just happened?
Importing a list of devices into Cacti
Adding a graph to a device
Autom8 – true Cacti automation
Installation
Time for action – installing the Autom8 plugin
What just happened?
Patching the Cacti files
Time for action – patching the Cacti files
What just happened?
Autom8 rules
Tree rules
Time for action – adding a new Tree Rule
What just happened?
Time for action – applying an Autom8 rule to devices
What just happened?
Graph rules
Time for action – adding a Graph Rule
What just happened?
Further information
Pop Quiz – Let's test your knowledge about Chapter 12
Summary
A. Mobile Access / Administration
Overview of mobile solutions for Cacti
iCacti—the iPhone/iPad client
BBCacti—the BlackBerry client
nmidMobileClient—the Windows mobile client
The mobile plugin—mobile enhanced Cacti web page
The iPhone/iPad client
Requirements
Advantages
Disadvantages
Support
BBCacti—the BlackBerry client
Requirements
Advantages
Disadvantages
The nmidWebService plugin
Time for action – installing the WSO2 WebService framework
What just happened?
Installing the nmidWebService plugin
Time for action – installing the nmidWebService plugin
What just happened?
BBCacti installation
Time for action – installing the BBCacti client
What just happened?
BBCacti configuration
Time for action – configuration of BBCacti
What just happened?
Time for action – using the BBCacti client
What just happened?
The mobile plugin
Time for action – installing the mobile plugin
What just happened?
Summary
B. Online Resources
Cacti website
Spine
Plugin Architecture
Cacti documentation
Cacti forum
Cacti bug reporting
Cacti plugin hooks overview
Cacti Users' site
Howie's stuff
RRDTool
Tobi Oetiker
RRDTool, Cacti, and time zones
Xing German Cacti group
LinkedIn Cacti Group
NMID plugins and CereusReporting
C. Further Information
The Round Robin Database Tool
The RRD file architecture
SNMP: The Simple Network Management Protocol
The Management Information Base
SNMPv1
Security
SNMPv2 / SNMPv2c
Security
SNMPv3
SNMP support in Cacti
MRTG – Multi Router Traffic Grapher
Where to get support?
Cacti forums
Mailing list
Commercial support
D. Pop Quiz Answers
Index

Cacti 0.8Beginner's Guide

Cacti 0.8Beginner's Guide

Copyright © 2011 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: March 2011

Production Reference: 1110311

Published by Packt Publishing Ltd.

32 Lincoln Road

Olton

Birmingham, B27 6PA, UK.

ISBN 978-1-849513-92-0

www.packtpub.com

Cover Image by Ed Maclean (<[email protected]>)

Credits

Author

Thomas Urban

Reviewers

Michael Bouma

Mark Cutting

Acquisition Editor

Tarun Singh

Development Editor

Kartikey Pandey

Technical Editor

Kavita Iyer

Copy Editor

Neha Shetty

Indexers

Hemangini Bari

Tejal Daruwale

Editorial Team Leader

Akshara Aware

Project Team Leader

Ashwin Shetty

Project Coordinator

Poorvi Nair

Proofreader

Bernadette Watkins

Graphics

Nilesh Mohite

Production Coordinator

Aparna Bhagat

Cover Work

Aparna Bhagat

About the Author

ThomasUrban is the owner of Urban-Software.de, a software and consulting services company providing add-ons, plugins, and services for the Cacti and Zenoss Network Monitoring systems. He has been programming web applications for over 15 years, building reporting interfaces, network management software, asset management sites, and more.

I would like to thank the team at Packt Publishing—most of all for giving me this opportunity to write a book and also for taking care of schedules, providing support, guidance and feedback, and keeping me on track the whole way.

I would also like to thank all of the reviewers for taking the time to read, correct, and provide valuable feedback to the book throughout the 
writing process.

Lastly, I want to thank Despina—for making sure I never ran out of coffee on the countless evenings I spent sitting in front of the keyboard instead of with her and the children. I dedicate this book to her.

About the Reviewers

MichaelBouma in the IT business since 1990, starting as a programmer in assembly and Pascal.

He worked for more than 10 years in satellite communications, where he developed an interest for networks and network monitoring. Michael has worked with Cacti since 2001 and has introduced Cacti as the main monitoring product in three different companies. In his last two companies, he was also involved in writing several plugins for Cacti.

Michael is currently working as a network engineer at Atos Origin in the Netherlands. Here he is developing plugins for customers and setting up tooling and monitoring.

In his spare time he is active with Sloop Rowing races.

http://www.sterkesietze.nl

MarkCutting has been working in the IT arena for the last 20 years. During this time, he has worked in a variety of areas including manufacturing, commodity-based trading, and finance.

In these positions, he has been involved in numerous network and application builds/rollouts, projects, design standards, and day-to-day operations. He currently manages a network consisting of 10 sites globally where he supports the core network infrastructure and the applications that are key to the business functions.

These technologies include SQL, Windows 2003/2008, Cisco, Juniper, Citrix, and numerous others. He also supports a wide range of global MPLS networks, and has designed and developed a network fail-over strategy that provides minimum down time for critical business applications and voice traffic.

In addition to the activities above, Mark is a member of the Cacti forums, under the name of "mcutting". He is also a keen developer, working with technologies such as PHP, MySQL, Bash, AutoIT, and of course, Cacti.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and, as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read, and search across Packt's entire library of books. 

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via your web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

Generally speaking, network management refers to the tasks associated with running a network, along with the software, tools, and technology required to support these tasks. One major part of running a network is to monitor the devices on it in order to know what is happening.

One definition of network management from the ISO Telecommunications Management Network model and framework for network management is known as FCAPS. It divides network management into five disciplines: Fault, Configuration, Accounting, Performance, and Security. Most network management tools can be assigned to one of these disciplines and, out of the box, Cacti is generally more of a performance measurement tool than a management tool, but it can be enhanced to also perform additional tasks.

What is Cacti?

Cacti is an open source performance measurement and graphing application. The first version of Cacti was published on 23rd September, 2001, and provided a complete web-based frontend to RRDtool, the high performance data logging and graphing system created by Tobias Oetiker, two years earlier. Cacti stores all of the information required to gather this data and create the graphs in a MySQL database, all of which is completely configurable via its web interface.

For data gathering, Cacti uses external scripts and commands, as well as all 3 SNMP versions.

Even in its initial release, Cacti included much of the functionality needed for an enterprise class performance measurement tool:

Complete web-based RRD and RRA managementComplete RRD Graph configuration and generationWith external Script/Command and SNMP supportWith easy configuration for SNMP interface data graphingWith granular user rights management

System architecture of Cacti

From an architectural point of view, Cacti uses a cron/at-based poller to gather data from different sources, Round Robin Database (RRD) files to store the polled data, and a MySQL database to store the systems configuration. The primary user interface is a PHP web application that allows for easy management of all aspects of the system, as well as automatic display mechanisms for viewing the graphs.

Cacti is available for different operating systems such as Windows, Linux, and Solaris.

Cacti is more than performance measurement

Although the main area for which Cacti is used is performance measurement, it can be extended to do much more! With the introduction of the Plugin Architecture, Cacti can be extended to include tasks such as:

Threshold alertingReal-time monitoring of specific data sourcesCreating and sending scheduled reports System logging and analysisPerforming network configuration backupsIntegration of other network management softwareTracking network hardware

Many of these extensions or plugins are actively maintained and supported by the Cacti Group itself, while others are maintained by the Cacti community and the developer of each extension.

What this book covers

Chapter 1, Installing Cacti, will take you through the installation and configuration of Cacti. You will also learn how to upgrade an existing installation. The final part of the chapter will get you familiar with the different features of Cacti.

Chapter 2, Using Graphs to Monitor Networks and Devices, will teach you how to create graphs using RRDtool. Cacti uses RRDtool to store the polled data. In addition to storing data, RRDtool is also used to create performance graphs. This chapter also shows you how to add new devices and performance measurement graphs to them. Then you'll learn how to group devices using the Cacti tree. Cacti provides a facility to create templates for data, graphs, and hosts.

Chapter 3, Creating and Using Templates, will teach you how to create data templates and apply them to devices. You will create a threshold-based graph template and change the appearance of the graph depending on the data value. This chapter will also teach you how to create a selection of SNMP-based graphs and data queries, and how to import a template from the template repository and export our own host template.

Chapter 4, User Management, teaches you how to create a user and apply basic settings to it. Then we discuss different kinds of permissions, user authentication, and how to import a list of users through the command line interface.

Chapter 5, Data Management, will teach you about retrieving data for graphing with Cacti, which is more than just pulling SNMP data. Cacti allows several different methods for data retrieval. This chapter teaches you how to create your own data input methods and create custom scripts to gather remote data. After you complete this chapter, you will be comfortably able to manage a Cacti system.

Chapter 6, Cacti Maintenance, shows you how to create backups of your Cacti installation and how to restore it, as well as providing information on how to keep your Cacti instance clean of dead hosts and files. This chapter is dedicated to Cacti management.

Chapter 7, Network and Server Monitoring, will teach you how to set up Cisco network devices and prepare Windows systems to be monitored using the WMI interface. You will be provided with several instructions to configure your network devices, windows servers, and VMware ESX servers. Each of the different systems requires different methods and configuration tasks in order to poll the performance data.

Chapter 8, Plugin Architecture, shows you how to extend the capabilities of your Cacti instance with the available Plugin Architecture. Plugins allow end-users to implement missing features or create specific enhancements needed for internal corporate usage. At the end of this chapter, you will be able to add new features and functionality to your Cacti instance using external plugins.

Chapter 9, Plugins, provides an overview of the general plugin design based on the ntop plugin. It describes commonly used plugins and also helps you create your first plugin.

Chapter 10, Threshold Monitoring with Thold, provides an overview of the Thold plugin. It describes the different threshold types available. It shows you how to create a threshold and also helps you to build a threshold template and assign it to a data source.

Chapter 11, Enterprise Reporting, shows you how to define reports with the free Nectar and the commercially supported CereusReporting plugins.

Chapter 12, Cacti Automation for NOC, provides an overview of Cacti automation. It describes the process of using the CLI to add permissions, devices, and trees. It also guides you through the process of installation and usage of Autom8.

Appendix A, Mobile Access / Administration, gives some further information on how to access your Cacti installation with mobile devices.

Appendix B, Online Resources, gives more information on the other online resources available.

Appendix C, Further Information, gives more information on RRDtool, SNMP, and Cacti forums.

Appendix D, Pop Quiz Answers, gives answers to the pop-quizzes which appear at the end of each chapter.

What you need for this book

A Windows- or Linux-based system (CentOS is preferred)A code or text editorA browserThe code download for the book

Who this book is for

This book is for anyone who wants to implement performance measurement for trending, troubleshooting, and reporting purposes. The book also explains how to extend Cacti by implementing and creating your own plugins. If you are a network operator and know the basics of network management and SNMP, then this book is for you.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Tip

Downloading the example code for the book

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Installing Cacti

Let's get right on with setting up Cacti. Take a look at what we will do next.

In this chapter, we are going to:

Install Cacti's prerequisitesInstall Cacti on both a CentOS and a Windows systemCompile and install the spine pollerUpgrade an existing Cacti installationRun Cacti for the first timeProvide a quick overview on the Cacti web frontend

Here we go….

Preparing the system—basic prerequisites

In order to install and run Cacti, we need to make sure that all system prerequisites are met. Here we'll give an overview of the different components needed.

Web server

As most of Cacti is built as a web interface, a web server is needed. This can be Apache's httpd or Microsoft's Internet Information Server (IIS) if installing on Windows, but in fact, any PHP-capable web server can be used to run the web interface. For optimal support, the use of Apache or IIS is suggested.

PHP

Cacti is built with the PHP programming language and therefore needs PHP to be installed on the system. Most Linux distributions already have a base PHP environment installed, but some might need additional packages for Cacti to function properly. In particular, the LDAP, SNMP, and MySQL extensions should be installed.

MySQL database

Cacti uses the freely available MySQL database engine as its database server and it is available on most operating systems. One should note that the database server does not need to be installed on the same host as Cacti. For best performance, MySQL version 5 should be used.

NET-SNMP package

The NET-SNMP package provides the SNMP binaries used by Cacti and supports SNMPv1, SNMPv2c, and SNMPv3.

The NET-SNMP package also provides the SNMP daemon for Linux.

Installing Cacti on a CentOS 5 system

You're now going to install Cacti from source on a CentOS 5 system. You should use at least Centos 5.5 as it is 100% binary compatible with RedHat Enterprise Linux 5, but in fact you can follow most of the installation processes on other Linux distributions, such as Ubuntu or SuSe Linux, as well. By installing from source you'll get some insight into the inner workings of Cacti, and it will also provide you with a system which most Cacti and plugin developers are used to. There are differences between a source installation and a Yum/APT installation, but they will be described later on. Let's get started.

Preparing the system

Assume that the CentOS system has been installed with only the "Server Package" selected and there is no graphical user interface installed.

This is the default installation for a CentOS system with no manual package selection.

Time for action – installing the missing packages

The default CentOS installation is missing several important packages. So, we are now going to install these.

Install the RPMForge repository. For a 32bit CentOS installation this can be achieved by executing the following command (all on one line):
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
The RPMForge repository includes an RRDtool version for CentOS.Issue the following command to install all required packages:
yum install mysql-server php-mysql net-snmp-utils rrdtool php-snmp

What just happened?

You just gave the system a location to find the remaining packages needed for the Cacti installation and then installed them; therefore, you are now ready to start the next installation phase.

Downloading and extracting Cacti

Go to http://www.cacti.net and download the latest version of Cacti. In the top-left corner, under Latest Files, right-click on the tar.gz file and save the link address to the clipboard. You are going to need this link later. For simplicity we're assuming that your server has an Internet connection.

Time for action – downloading Cacti

It's now time to download the latest version of Cacti to your server. You will need your system username and password to login to your CentOS installation. If you have installed your CentOS system with the default settings, you should already have an SSH server running. If you're already logged on to the machine, you can ignore the first step.

From a Windows machine, logon to your system using an SSH client such as Putty. If this is the first time you have connected to the server, Putty will display a security alert and ask you to accept the RSA key. By doing so, Putty will display the logon prompt where you can logon to the system. Maximize the window, so that long text lines do not break at the end of the line. This will make things easier.You'll need to become the root user in order to be able to setup Cacti properly. Should that not be an option, performing these steps with sudo should achieve the same results.Navigate to /var/www/html. This is the document root for Apache.To download Cacti you can use the wget command. Enter the following command to download Cacti. After entering the wget command, right-clicking into the window client using Putty will paste the URL you copied earlier after the command:
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz

You should see the following output on your screen:

You now have the tar.gz file on your system, so let's move on and extract it. To do this, enter the following command:
tar-xzvf cacti-0.8.7g.tar.gz
This will extract the files and directories contained in the archive to the current directory. Finally you are going to create a symbolic link to this new Cacti directory. This will allow you to easily switch between different Cacti versions later, for example, when upgrading Cacti. To create a symbolic link, enter the following command:
ln –s cacti-0.8.7g cacti
This will create a link named cacti which points to the cacti-0.8.7g directory:

What just happened?

You downloaded the latest Cacti version to the root directory of the web server and created a symbolic link to the extracted directory. With the Cacti files in place, you are now ready for the next phase of the installation process.

Creating the database

The database isn't automatically created during the installation of Cacti. Therefore, you need to create it here. At the same time, a database user for Cacti should be created to allow it to access the database. It's also a good idea to secure the MySQL database server by using one of the included CentOS tools.